Skip to content

eslint/no-shadow-restricted-names Correctness

This rule is turned on by default.

What it does

Disallow redefine the global variables like 'undefined', 'NaN', 'Infinity', 'eval', 'arguments'.

Why is this bad?

Example

javascript
function NaN() {}

!function (Infinity) {};

var undefined = 5;

try {
} catch (eval) {}

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny no-shadow-restricted-names
json
{
  "rules": {
    "no-shadow-restricted-names": "error"
  }
}

References

Released under the MIT License.