no-promise-executor-return
The executor function passed tonew Promise should not return a value. The return value is ignored and returning a value is usually a mistake.
Rule Type: Problem
Fixable: No
Fixable: No
Why This Rule Exists
The executor function of a Promise should callresolve() or reject() to settle the promise. The return value of the executor is ignored, so returning a value is pointless and usually indicates a misunderstanding of how Promises work.
Rule Details
This rule disallows returning values from Promise executor functions. Onlyreturn without a value (for control flow) is allowed.
Examples
Incorrect Code
Correct Code
Common Patterns
Mixing Return with Resolve
Arrow Function Gotchas
Early Exit Pattern
Options
allowVoid
Type: booleanDefault:
false
Allows returning void values (explicit void operator).