Skip to content

prefer-rest-params

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.

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.

Reported
...
let c = 3;
c = 4;
function f() {
return arguments;
}
...
f.apply(null, [1]);
...
js:
lint:
rules:
prefer-rest-params: warn # off (default), warn, error

Enabled 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.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint prefer-rest-params full