spec-only
UnreleasedConfiguration
Disallow non-standard Promise methods (promise/spec-only).
Depending on Promise extensions can make it harder to migrate between implementations. This rule checks member access on Promise, including method references and calls, and checks members of Promise.prototype.
Rule Details
The allowed static methods are all, allSettled, any, race, reject, resolve, and withResolvers. The allowed prototype methods are then, catch, and finally.
Examples of incorrect code:
Examples of correct code:
Computed identifiers such as Promise[method] are allowed. String keys are checked directly. Only members whose object is named Promise are checked; aliases and promise instances are not tracked.
Options
allowedMethods
An array of additional method names to allow on both Promise and Promise.prototype. Defaults to an empty array.
Compatibility
Optional access to a private member, such as Promise?.#done inside a class declaring #done, is rejected by the TypeScript parser before this rule runs.
For computed regular-expression keys, rslint uses the literal's string representation. ESLint running on an older Node.js version can instead report Promise.null when that runtime cannot construct a regular expression using newer syntax, such as modifier groups in Promise[/(?i:a)/].