A function reads the arguments object instead of a rest parameter
What it finds
The arguments object is array-like but not an array, it hides how many parameters a function takes, and in sloppy code it is tied to the named parameters. A rest parameter, ...args, is a real array and appears in the signature.
Reported are uses of arguments that do not refer to a variable of that name, inside a function other than an arrow function, which has no arguments of its own. arguments.callee and arguments.caller are left to legacy-introspection.
From the rule's source, arguments_object.rs.
export function sum() { let total = 0; for (const n of arguments) {tx0 reports: arguments is read here total += n; } return total;}export function named(...args: number[]) { return args.length;}export function legacy() { return arguments.callee;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:arguments-object" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:arguments-object] reason="..."tx0 explain tx0/ts:arguments-object shows the same in the terminal. Found a false positive? Report it.