unicorn/no-useless-undefined
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-useless-undefined": "error",
},
},
];let foo = undefined;const {foo = undefined} = bar;const noop = () => undefined;let foo;const {foo} = bar;const noop = () => {};Examples from the ESLint documentation.
unicorn/no-useless-undefined
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-useless-undefined": "error",
},
},
];unicorn/no-useless-undefined
unicorn plugin · pedantic
{
"rules": {
"unicorn/no-useless-undefined": "error"
}
}complexity/noUselessUndefined
complexity · since 2.0.0
{
"linter": {
"rules": {
"complexity": {
"noUselessUndefined": "error"
}
}
}
}Move function definitions to the highest possible scope.
Enforce proper case for numeric literals.
Enforce consistent break/return/continue/throw position in case clauses.
Enforce consistent brace style for case clauses.
Prefer the spread operator over Array.from(…), Array#concat(…), Array#{slice,toSpliced}(), and trivial for…of copies.