💼 This rule is enabled in the ✅ recommended
config.
🔧💡 This rule is automatically fixable by the --fix
CLI option and manually fixable by editor suggestions.
Disallow the use of the null
literal, to encourage using undefined
instead. You can learn why in sindresorhus/meta#7
let foo = null;
if (bar == null) {}
let foo;
const foo = Object.create(null);
if (foo === null) {}
Type: object
Type: boolean
Default: false
Strict equality(===
) and strict inequality(!==
) is ignored by default.
// eslint unicorn/no-null: ["error", {"checkStrictEquality": true}]
if (foo === null) {}
- “Intent to stop using
null
in my JS code”. - TypeScript coding guidelines.
- ESLint rule proposal.
- Douglas Crockford on bottom values in JavaScript.