no-undefined
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-undefined": "error",
},
},
];const foo = undefined;
const undefined = "foo";
if (foo === undefined) {
// ...
}
function baz(undefined) {
// ...
}
bar(undefined, "lorem");const foo = void 0;
const Undefined = "foo";
if (typeof foo === "undefined") {
// ...
}
global.undefined = "foo";
bar(void 0, "lorem");Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
no-undefined
eslint
export default [
{
rules: {
"no-undefined": "error",
},
},
];no-undefined
eslint plugin · restriction
{
"rules": {
"no-undefined": "error"
}
}Biome does not have this rule.
Enforce a maximum number of statements allowed in function blocks