# promise/valid-params

> Require the right number of arguments for `Promise` methods

`Promise` methods don't complain about extra or missing arguments. `Promise.all(a, b)` ignores `b`, and rejects unless `a` is iterable. `promise.catch()` without a handler catches nothing.

| Method | Arguments |
| --- | --- |
| `Promise.resolve`, `Promise.reject` | 0 or 1 |
| `Promise.all`, `Promise.allSettled`, `Promise.any`, `Promise.race` | 1 |
| `then` | 1 or 2 |
| `catch`, `finally` | 1 |

A `then`, `catch` or `finally` method on something that clearly isn't a promise, such as an object literal or `new Parser()`, isn't reported.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"promise/valid-params" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
const results = Promise.all(loadUser(), loadOrders());
```

{/* bad {"count": 2} */}
```js
save(draft).then().catch();
```

Not reported:

{/* good */}
```js
const results = Promise.all([loadUser(), loadOrders()]);

save(draft).then(notify, retry).catch(showError);

const parser = new Parser();
parser.then();
```
