no-shadow-restricted-names
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”...var NaN, undefined, eval; function arguments() {} try {} catch (Infinity) {}Configuration
Section titled “Configuration”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.
Upstream equivalents
Section titled “Upstream equivalents”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 |