Skip to main content

no-promise-executor-return

The executor function passed to new Promise should not return a value. The return value is ignored and returning a value is usually a mistake.
Rule Type: Problem
Fixable: No

Why This Rule Exists

The executor function of a Promise should call resolve() 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. Only return without a value (for control flow) is allowed.

Examples

Incorrect Code

Correct Code

Common Patterns

Mixing Return with Resolve

Don’t confuse return with resolve(). They serve different purposes in Promise executors.

Arrow Function Gotchas

Early Exit Pattern

Options

allowVoid

Type: boolean
Default: false
Allows returning void values (explicit void operator).
The allowVoid option is useful if you prefer the explicit void operator to make it clear you’re intentionally discarding a return value.

Configuration

Best Practices

1. Call resolve/reject, don’t return

2. Use Promise.resolve/reject for immediate values

3. Avoid the Promise constructor when possible

4. Use async/await instead

When Not to Use It

This rule should almost never be disabled. If you’re returning values from Promise executors, you likely have a bug or misunderstanding.

Further Reading