Skip to content

promise/valid-params Correctness

This rule is turned on by default.

What it does

Enforces the proper number of arguments are passed to Promise functions.

Why is this bad?

Calling a Promise function with the incorrect number of arguments can lead to unexpected behavior or hard to spot bugs.

Examples

Examples of incorrect code for this rule:

javascript
Promise.resolve(1, 2);

Examples of correct code for this rule:

javascript
Promise.resolve(1);

How to use

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

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

References

Released under the MIT License.