# no-eq-null

Rule `eslint/no-eq-null`. Disallow `null` comparisons without type-checking operators

- Source: eslint
- Technologies: JavaScript
- Kind: suspicious
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 2.5M weekly downloads of presets that enable it
- Trend: +96.2% last quarter
- Rank: #1479 by reach, #273 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-eq-null` | no | suggestion | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-eq-null) |
| Oxlint | `no-eq-null` | no | unsafe | plugin `eslint`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-eq-null.html) |
| Biome | `suspicious/noEqualsToNull` | no | unsafe | group suspicious, since 2.3.8 | [docs](https://biomejs.dev/linter/rules/no-equals-to-null/) |

## Code examples

### Incorrect: the rule reports this

```js
if (foo == null) {
  bar();
}

while (qux != null) {
  baz();
}
```

### Correct: the rule accepts this

```js
if (foo === null) {
  bar();
}

while (qux !== null) {
  baz();
}

if (foo === null || foo === undefined) {
  bar();
}

while (qux !== null && qux !== undefined) {
  baz();
}
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "no-eq-null": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-eq-null": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "noEqualsToNull": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [eslint/func-name-matching](https://lintradar.dev/rules/eslint/func-name-matching.md): Require function names to match the name of the variable or property to which they are assigned
- [eslint/no-restricted-imports](https://lintradar.dev/rules/eslint/no-restricted-imports.md): Disallow specified modules when loaded by `import`
- [eslint/no-implicit-globals](https://lintradar.dev/rules/eslint/no-implicit-globals.md): Disallow declarations in the global scope
- [eslint/no-warning-comments](https://lintradar.dev/rules/eslint/no-warning-comments.md): Disallow specified warning terms in comments
- [eslint/prefer-object-has-own](https://lintradar.dev/rules/eslint/prefer-object-has-own.md): Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`
- [eslint/prefer-named-capture-group](https://lintradar.dev/rules/eslint/prefer-named-capture-group.md): Enforce using named capture group in regular expression

---

Web page: https://lintradar.dev/rules/eslint/no-eq-null. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
