no-undef-init
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"no-undef-init": "error",
},
},
];var foo = undefined;
let bar = undefined;var foo;
let bar;const foo = undefined;
using foo1 = undefined;
await using foo2 = undefined;
let { bar = undefined } = baz;
[quux = undefined] = quuux;
(foo = undefined) => {};
class Foo {
bar = undefined;
}Examples from the ESLint documentation.
no-undef-init
eslint
export default [
{
rules: {
"no-undef-init": "error",
},
},
];Oxlint does not have this rule.
complexity/noUselessUndefinedInitialization
complexity · since 1.7.2
{
"linter": {
"rules": {
"complexity": {
"noUselessUndefinedInitialization": "error"
}
}
}
}Disallow labels that share a name with a variable
Require constructor names to begin with a capital letter
Enforce default clauses in switch statements to be last