A function of this file is called with two arguments named after its parameters, in the opposite order
What it finds
move(to, from) for a function declared move(from, to) passes each value to the other parameter. When the arguments are variables with exactly the names of two parameters, swapped, the order is almost certainly wrong.
Reported are calls of functions declared in the file where two arguments are names equal to the names of the parameters at each other's positions.
From the rule's source, swapped_arguments.rs.
function move(from: string, to: string) { return `${from}->${to}`;}export function back(from: string, to: string) { return move(to, from);tx0 reports: to and from are passed in the opposite order} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:swapped-arguments" = "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:swapped-arguments] reason="..."tx0 explain tx0/ts:swapped-arguments shows the same in the terminal. Found a false positive? Report it.