Skip to content

no-async-promise-executor

Reports new Promise(async ...): an async function (or arrow function) as the executor, with or without a second argument.

The Promise constructor ignores what its executor returns. An error thrown in an async executor rejects the promise the executor returned, which nobody holds, so the new promise never settles and the caller waits forever; the error shows up only as an unhandled rejection, if at all.

To fix, give the executor as a normal function and call resolve and reject yourself, or drop new Promise and write an async function that returns the value.

Reported
...
new Promise(async (resolve) => resolve()); new Promise(async function () {}); new Promise((resolve) => resolve()); new Promise();
...
js:
lint:
rules:
no-async-promise-executor: warn # off, warn (default), error

Enabled by the presets: js/eslint-recommended, js/biome-recommended, js/oxlint.

Suppress one line with sudsy-disable-next-line no-async-promise-executor in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint no-async-promise-executor full