Rules

prefer-is-nullish

Treat null and undefined uniformly unless the distinction is intentional.

Purpose and behavior

Treat null and undefined uniformly unless the distinction is intentional.

The rule reports Predicate.isNull, isNotNull, isUndefined and isNotUndefined member access, including references without calls. Use isNullish or isNotNullish. Give a suppression reason when a boundary requires the distinction between null and undefined.

Options

No configurable options. Enable with "rules/prefer-is-nullish": "error".

Invalid example

if (Predicate.isNull(x)) {}

Valid example

if (Predicate.isNullish(x)) {}

Fixes and exceptions

This rule provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/prefer-is-nullish -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the Effect preset.

prefer-is-nullish.ts · Tests