Skip to content

promise/spec-only Restriction

What it does

Disallow use of non-standard Promise static methods.

Why is this bad?

Non-standard Promises may cost more maintenance work.

Examples

Examples of incorrect code for this rule:

js
Promise.done();

Examples of correct code for this rule:

js
Promise.resolve();

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny promise/spec-only --promise-plugin
json
{
  "plugins": ["promise"],
  "rules": {
    "promise/spec-only": "error"
  }
}

References

Released under the MIT License.