prefer-rest-params
What it does
Section titled “What it does”Reports arguments used in an ordinary function, except as the object of a member read by name (arguments.length). arguments[0] and passing arguments on are reported; an arrow function has no arguments of its own and is not checked.
Why it matters
Section titled “Why it matters”arguments is an array-like object, not an array, and is tied to the function in ways that disable some optimizations, so arguments.map(...) fails. A rest parameter (...args) is a real array and shows in the parameter list.
To fix, declare ...args.
Example
Section titled “Example”...let c = 3;c = 4;function f() { return arguments;}...f.apply(null, [1]);...Configuration
Section titled “Configuration”js: lint: rules: prefer-rest-params: warn # off (default), warn, errorEnabled by the presets: js/typescript-eslint-recommended, js/biome-recommended.
Suppress one line with sudsy-disable-next-line prefer-rest-params in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint | prefer-rest-params |
full |