always-return
Configuration
Require returning inside each then() to create readable and reusable Promise chains.
Rule Details
This rule checks inline callbacks passed as the first argument to .then(). A
block-bodied callback must explicitly return, throw, call process.exit(),
or call process.abort() on every path. Expression-bodied arrow callbacks are
allowed because their expression is implicitly returned.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
ignoreLastCallback
Pass { "ignoreLastCallback": true } to allow the last .then() callback in a
promise chain to omit a return. This is useful when the last callback only
performs side effects. Default is false.
ignoreAssignmentVariable
Pass { "ignoreAssignmentVariable": ["globalThis"] } to allow the last
.then() callback to omit a return when it assigns to one of the configured
root variables. Default is ["globalThis"].
Differences from ESLint
None known.