Skip to content

no-shadow-restricted-names

Reports a variable, function, class, parameter or function-expression name that is NaN, Infinity, eval, arguments or undefined. var undefined; without a value is not reported.

These names are read as the global values everywhere else in the program. A local called undefined or NaN changes what a test such as x === undefined means inside its scope, and a variable named eval or arguments is a syntax error in strict mode.

To fix, rename the variable.

Reported
...
var NaN, undefined, eval; function arguments() {} try {} catch (Infinity) {}
js:
lint:
rules:
no-shadow-restricted-names: error # off, warn, error (default)

Enabled by the presets: js/eslint-recommended, js/biome-recommended, js/oxlint.

Suppress one line with sudsy-disable-next-line no-shadow-restricted-names in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
eslint no-shadow-restricted-names partial without scope analysis var undefined; is accepted whatever is assigned to it later