eslint/no-undefined Restriction
What it does
Disallow the use of undefined
as an identifier
Why is this bad?
Example of bad code
javascript
var foo = undefined;
var undefined = "foo";
if (foo === undefined) {
// ...
}
function baz(undefined) {
// ...
}
bar(undefined, "lorem");
Example of good code
javascript
var foo = void 0;
var Undefined = "foo";
if (typeof foo === "undefined") {
// ...
}
global.undefined = "foo";
bar(void 0, "lorem");
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny no-undefined
json
{
"rules": {
"no-undefined": "error"
}
}