-
Notifications
You must be signed in to change notification settings - Fork 84
Add strict equality check rule #6879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Enforces strict equality checks (=== and !==) throughout the Admin UI codebase by adding the eqeqeq ESLint rule.
- Added
eqeqeq: ["error", "always"]to ESLint configuration to prevent type coercion bugs - Updated 6 files to replace loose equality (
==,!=) with strict equality (===,!==) - All changes correctly handle null/undefined checks with explicit comparisons
- Simplified label fallback logic in
taxonomy/helpers.tsusing truthy operator while maintaining equivalent behavior
The changes are straightforward refactoring to comply with the new linting rule and improve code safety.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- All changes are mechanical refactoring to enforce strict equality, with no logic changes. The transformations correctly preserve existing behavior while adding type safety.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| clients/admin-ui/.eslintrc.cjs | 5/5 | Added eqeqeq rule to enforce strict equality checks throughout codebase |
| clients/admin-ui/src/features/common/ConnectedCircle.tsx | 5/5 | Updated nullish check to use strict equality for connected prop |
| clients/admin-ui/src/features/common/helpers.ts | 5/5 | Updated type guard functions to use strict equality for null checks |
| clients/admin-ui/src/features/taxonomy/helpers.ts | 5/5 | Replaced loose equality with strict checks and simplified label fallback logic using truthy operator |
7 files reviewed, no comments
45bb515 to
47800d1
Compare
lucanovera
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this rule. This is bound to prevent some bugs. Tested connected circle and request manager table filters, everything works. Approved.
You might want to add a DX changelog entry?
@lucanovera I didn't think this warranted an entry. What do you think? |
I think so. It is a DX improvement to me. |
a1a73fd to
9f44f04
Compare
Description Of Changes
This change was prompted by a near-miss bug in #6872
Frankly, I'm surprised this hasn't been a linting rule of ours all along.
Enforced strict equality checks (
===and!==) throughout the Admin UI codebase by adding theeqeqeqESLint rule. This prevents potential bugs from JavaScript's type coercion behavior and makes null/undefined checks more explicit.Code Changes
eqeqeq: ["error", "always"]ESLint rule to enforce strict equalityConnectedCircle.tsxto explicitly check fornullandundefinedhelpers.tstype guards to use strict equality for null checksuseTableState.tsfilter cleanup to explicitly check fornullandundefinedDataUsesForm.tsxskip condition to use strict equalityDatasetYamlForm.tsxtype guard to use strict equalitytaxonomy/helpers.tsto use strict equality and simplified label fallback logicSteps to Confirm
npm run lintin theclients/admin-uidirectory to verify no ESLint errorsConnectedCirclecomponent withundefined,null,true, andfalsevalues to ensure correct colors are displayedPre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works