lint: zero out eqeqeq violations (225 → 0) via null-ignore config + codemod#36
Closed
adm01-debug wants to merge 1 commit into
Closed
lint: zero out eqeqeq violations (225 → 0) via null-ignore config + codemod#36adm01-debug wants to merge 1 commit into
adm01-debug wants to merge 1 commit into
Conversation
Brings ESLint problem count from 1939 → 1725 (−214) by eliminating
all 225 'eqeqeq' violations.
## eslint.config.js — accept idiomatic null checks
'eqeqeq': ['error', 'always', { null: 'ignore' }]
Categorization of the 225 violations: **all are 'x == null' /
'x != null'** patterns — the canonical 'is null OR undefined' check
used in many places (e.g. price formatting, optional FK checks).
Forcing strict equality here would either:
(a) require '${x === null || x === undefined}' boilerplate at
every site, or
(b) introduce subtle bugs by missing the undefined branch.
The 'null: ignore' option is the standard typescript-eslint
recommendation for codebases that use this idiom.
## scripts/codemod-strict-equality.mjs (new)
Defensive tool for any FUTURE non-null '==' / '!=' that slip through.
Token-aware scanner that:
- Skips strings (single, double, template), comments (line + block),
and regex literals (heuristic disambiguation)
- Recognizes '==' and '!=' that are NOT part of '===', '!==', '=>',
'==>'
- Preserves operands that are the literal 'null' (the eslint config
above already silences these, but the codemod keeps them too as
defense-in-depth)
- Promotes '==' → '===' and '!=' → '!==' otherwise
Usage:
node scripts/codemod-strict-equality.mjs # rewrite src/
node scripts/codemod-strict-equality.mjs --check # CI gate
node scripts/codemod-strict-equality.mjs path/file # one file
Tested on /tmp/test.ts with mixed cases (== null preserved, == 5
promoted, != null preserved, != 5 promoted). Did NOT find any
non-null cases in src/ (the config change was sufficient for all
225 violations), but stays as a defensive tool for the future.
## Validation
eslint 1939 → 1725 problems (1430 → 1213 errors)
eqeqeq 225 → 0 violations
tsc exit 0
tests no regressions (same 10 pre-existing failures)
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ESLint problems: 1939 → 1725 (−214). All 225
eqeqeqviolations resolved.What changed
eslint.config.js— accept idiomatic null checksCategorization of the 225 violations: all are
x == null/x != nullpatterns — the canonical "is null OR undefined" check used in many places (price formatting, optional FK checks, etc.). Forcing strict equality here would either:(x === null || x === undefined)boilerplate at every site, ORundefinedbranch.The
{ null: 'ignore' }option is the standardtypescript-eslintrecommendation for codebases that use this idiom.scripts/codemod-strict-equality.mjs(new)Defensive tool for any future non-null
==/!=that slip through. Token-aware scanner that:==and!=that are NOT part of===,!==,=>,==>null(config already silences these, but the codemod keeps them too as defense-in-depth)==→===and!=→!==otherwiseTested on a mixed-cases sandbox (
== nullpreserved,== 5promoted,!= nullpreserved,!= 5promoted). Did not find any non-null cases in currentsrc/(the config change handled all 225), but stays as a defensive tool for future regressions.Note on the build process
I initially attempted a more aggressive codemod that promoted all
==→===(including null comparisons), but reverted it after a bug produced====artifacts. The fixed codemod (with proper boundary guards on===/!==token detection) is what's shipped.Validation
eqeqeqviolationstsc --noEmitnpm run testfailing fileshttps://claude.ai/code/session_01KWeDG
Generated by Claude Code