Skip to content

fix(no-node-access): prevent duplicate errors for chained property access#1260

Merged
Belco90 merged 2 commits intomainfrom
fix/no-node-access-duplicate-errors
Mar 19, 2026
Merged

fix(no-node-access): prevent duplicate errors for chained property access#1260
Belco90 merged 2 commits intomainfrom
fix/no-node-access-duplicate-errors

Conversation

@y-hsgw
Copy link
Member

@y-hsgw y-hsgw commented Mar 19, 2026

Changes

  • Skip reporting MemberExpression nodes that are the object of another MemberExpression

Context

Fixes #1256

The no-node-access rule was reporting duplicate errors when DOM properties were chained (e.g., element.parentElement.nextElementSibling). This was because the selector 'VariableDeclarator MemberExpression' matched all nested MemberExpression nodes.

The fix adds a check to skip MemberExpression nodes that serve as the object of parent MemberExpressions, preventing duplicate reports for chained property access.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.35%. Comparing base (d5aa504) to head (547177c).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1260   +/-   ##
=======================================
  Coverage   97.35%   97.35%           
=======================================
  Files          49       49           
  Lines        6009     6012    +3     
  Branches     1536     1538    +2     
=======================================
+ Hits         5850     5853    +3     
  Misses        157      157           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Belco90 Belco90 merged commit 74ce9dd into main Mar 19, 2026
27 checks passed
@Belco90 Belco90 deleted the fix/no-node-access-duplicate-errors branch March 19, 2026 10:26
@github-actions
Copy link

🎉 This PR is included in version 7.16.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

testing-library/no-node-access reported twice

2 participants