eslint-plugin-no-null

raw JSON →
1.0.2 verified Sat Apr 25 auth: no javascript maintenance

An ESLint plugin that provides a single rule to disallow null literals, enforcing the use of undefined instead. Version 1.0.2 is the latest stable release. It has no dependencies beyond ESLint (peer dependency >=3.0.0) and is not actively maintained (last release likely older). Differentiators: simple, focused rule for teams preferring undefined over null.

error ESLint: Failed to load plugin 'no-null': Cannot find module 'eslint-plugin-no-null'
cause The plugin is not installed or missing from node_modules.
fix
Run npm install eslint-plugin-no-null --save-dev
error ESLint: Configuration for rule 'no-null/no-null' is invalid: Value "2" is invalid for rule severity.
cause Using numeric severity instead of string in ESLint config.
fix
Change "no-null/no-null": 2 to "no-null/no-null": "error"
deprecated Plugin is no longer actively maintained; may not work with latest ESLint versions.
fix Consider alternatives like ESLint's built-in 'no-restricted-syntax' rule or 'unicorn/no-null'.
gotcha Rule only flags null literals, not expressions that may evaluate to null.
fix Use 'no-restricted-syntax' with a custom selector for more comprehensive null detection.
npm install eslint-plugin-no-null
yarn add eslint-plugin-no-null
pnpm add eslint-plugin-no-null

Shows installation, configuration, and usage of the no-null rule in an ESLint config.

// Install ESLint and plugin
// npm install eslint eslint-plugin-no-null --save-dev

// .eslintrc.json
{
  "plugins": ["no-null"],
  "rules": {
    "no-null/no-null": "error"
  }
}

// Example file: app.js
// Disallowed: let x = null;
// Allowed: let y = undefined;