no-multiple-resolved
Configuration
Disallow creating new promises where the executor can settle the promise more than once.
Rule Details
A Promise executor that calls both resolve and reject (or calls either one twice) on the same
execution path settles the promise twice. The second settlement has no effect, but it indicates a
logic error and can mask real bugs.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Differences from ESLint
-
Correlated conditions across separate
ifstatements (e.g.if (err) { reject(err) }followed byif (!err) { resolve(val) }) are not recognized as mutually exclusive. This rule reports them as potential double-resolution. Full ESLint code-path analysis handles these; our simplified state-based analysis does not. -
Calling an outer resolver multiple times inside a nested executor is reported here, whereas ESLint does not report it. For example: