An ESLint no-eq-null null versus undefined suggestion asks you to make a decision about meaning. Before accepting a rewrite, decide whether a missing value and an explicit null should take the same branch. A comparison that looks stricter can still change your application’s result.
Our small JavaScript exercise evaluates four ordinary cases: an omitted property, explicit null, zero and an empty string. We read each value once. The results are reproducible, but they are not a survey of production bugs or evidence that a particular editor suggestion appeared.
What changed in ESLint 10.16.0?
The 27 November release note adds strict-comparison suggestions to no-eq-null, including alternatives with undefined. It also expands undefined-related suggestions in eqeqeq. A suggestion offers a choice; it does not establish which rules your project enables or what your application contract requires.
The no-eq-null documentation explains why a loose comparison with null can also match undefined. Meanwhile, the eqeqeq documentation distinguishes automatic fixes from suggestions that may change runtime behavior. Check the actual project configuration before treating a reported problem as a universal rule.
Read the value once, then compare four checks
For each fixture object, the script first records whether it owns the property. It then stores that property’s value in v. This keeps the exercise focused on ordinary values rather than repeatedly evaluating a getter or another expression with side effects. Omission and an explicit undefined value can read alike while differing in property presence.
const fixtures = [{}, {value: null}, {value: 0}, {value: ""}];
for (const object of fixtures) {
const v = object.value;
console.log(Object.hasOwn(object, "value"),
v == null, v === null || v === undefined,
v === null, !v);
}
| Chosen case | v == null | Strict pair | v === null | !v |
|---|---|---|---|---|
| omitted | true | true | false | true |
| null | true | true | true | true |
| zero | false | false | false | true |
| empty string | false | false | false | true |
The loose null check matches two rows. The explicit strict pair also matches two. Strict null alone matches only the null row. Finally, negation matches all four because zero and the empty string are falsy too. Therefore, replacing a nullish check with !v changes the selected behavior in this fixture.

Contract one: reject a missing required value
Imagine a fictional form where an absent value and null both mean that a required field has not been supplied. A nullish check can reject those cases together. However, a value of zero may be valid for a quantity, while an empty string may need a separate text validation rule. Neither decision follows merely from the value being falsy.
Write the accepted and rejected cases before editing the condition. Then compare the old and proposed expressions on those exact cases. If zero changes from accepted to rejected, decide whether that change is intentional. Do not describe a changed decision as a harmless style cleanup.
Contract two: omission leaves a field unchanged
Now imagine a fictional patch operation. An omitted property means leave the saved field alone. Explicit null means clear it, where the contract allows clearing. A value-only comparison cannot fully represent that distinction. First test whether the ordinary input object owns the property, then validate its supplied value.

An own property containing undefined needs an explicit policy as well. Reject it, normalize it or handle it under a documented internal contract. Do not silently treat it as identical to omission just because reading both properties produces undefined. This matters when your in-memory inputs contain values that a later serialization step may transform.
Download and reproduce the regression check
Use the truth table as an answer key, the contract examples as discussion prompts and the blank ledger for your project’s before-and-after decisions. Add cases from the real field rules. Keep the original and candidate conditions together so another reviewer can see exactly which outcomes changed.
- Four-case truth table (CSV)
- Fictional contract examples (CSV)
- Blank regression ledger (CSV)
- Primary sources and boundaries (CSV)
Method and limits
We evaluated the expressions locally using the retained script and recorded the runtime version with its output. We did not run a pinned ESLint installation, capture editor suggestions or inspect your project. The result covers the four selected ordinary read-once values, not exceptional host objects or repeated expressions with side effects.
For another reproducible-check example, see our Python application handoff worksheet. Both exercises separate an expected decision from evidence that the decision was actually checked. Keep the same discipline when reviewing a proposed lint rewrite.
