Skip to main content

What it flags

A new Promise(...) whose executor does nothing but forward an existing promise: new Promise((resolve, reject) => source.then(resolve, reject)), source.then(resolve).catch(reject) or source.then(resolve), as the executor’s only statement. The source can be any expression, including a call such as api.get(url). The wrapper adds a layer that does nothing, and a version that forgets reject never settles when the inner promise fails. It stays quiet when the executor does other work (for example setTimeout(resolve, ms) or transforming the value before resolve), when it has more than one statement, and when Promise is imported or declared in the file. An async executor is reported by the reliability rule async-promise-executor.

How to review

Return the inner promise directly, or await it inside an async function:
If callers rely on the wrapper to turn a thenable into a native promise, use Promise.resolve(source) instead. There is no automatic fix.

Configuration

Set the rule to "off" in loadwise.config.json to drop its findings: