no-undef
eslint
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"no-undef": "error",
},
},
];Disallow the use of undeclared variables unless mentioned in /*global */ comments
const foo = someFunction();
const bar = a + 1;/*global someFunction, a*/
/*eslint no-undef: "error"*/
const foo = someFunction();
const bar = a + 1;Examples from the ESLint documentation.
no-undef
eslint
export default [
{
rules: {
"no-undef": "error",
},
},
];no-undef
eslint plugin · nursery
{
"rules": {
"no-undef": "error"
}
}correctness/noUndeclaredVariables
correctness · since 1.0.0
{
"linter": {
"rules": {
"correctness": {
"noUndeclaredVariables": "error"
}
}
}
}Require spread operators instead of .apply()
Disallow confusing multiline expressions
Disallow losing originally caught error when re-throwing custom errors
Disallow variable assignments when the value is not used