A declaration hides undefined, NaN, Infinity, eval or arguments

tx0/ts:restricted-name-shadowedrecommendedwarningsmell

What it finds

undefined, NaN and Infinity are global values that every reader takes at face value, and eval and arguments have special meaning to the language. A local declaration with one of these names makes x === undefined or eval(code) mean something else in its scope, and is an error in strict code for eval and arguments.

Every declaration counts: variables, functions, classes, parameters, catch parameters and imports. Types, which live apart from values, do not, and declaration files, which describe the environment, are left alone.

From the rule's source, restricted_name_shadowed.rs.

Example from the rule's tests
export function wrap(undefined: unknown) {tx0 reports: hides the global undefined  const NaN = 1;tx0 reports: hides the global NaN  type eval = string;  return [undefined, NaN];}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/ts:restricted-name-shadowed" = "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:restricted-name-shadowed] reason="..."

tx0 explain tx0/ts:restricted-name-shadowed shows the same in the terminal. Found a false positive? Report it.