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.

Reports Predicate.isNull, isNotNull, isUndefined and isNotUndefined calls. Prefer isNullish/isNotNullish. If a boundary must distinguish null and undefined, suppress with an explicit reason instead of weakening the shared policy.

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 reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/prefer-is-nullish -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the Effect preset.

prefer-is-nullish.ts · Tests