Skip to content

limit no-node-access errors reported #334

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

Closed
Belco90 opened this issue Apr 12, 2021 · 2 comments · Fixed by #338
Closed

limit no-node-access errors reported #334

Belco90 opened this issue Apr 12, 2021 · 2 comments · Fixed by #338
Assignees
Labels
bug Something isn't working released

Comments

@Belco90
Copy link
Member

Belco90 commented Apr 12, 2021

Originated by #331. I don't think no-node-access should report DOM elements queried from document since we can't detect properly if being used for a test because of Aggressive Reporting.

In the rule doc it says this case is invalid:

// If is not importing a testing-library package

document.getElementById('submit-btn').closest('button');

But we can't actually know this for the reason mentioned before.

@Belco90 Belco90 added the bug Something isn't working label Apr 12, 2021
@Belco90 Belco90 self-assigned this Apr 13, 2021
@Belco90
Copy link
Member Author

Belco90 commented Apr 13, 2021

Additionally, seems this rule is too aggressive and could trigger tons of false positives outside test files, I think it's necessary to avoid Aggressive Reporting on this rule and make it reporting errors only if @testing-library/* or custom module set through Shared Settings imported.

This would make the previously mentioned invalid case doable. It could still cause some false negatives and silence some errors here and there, but I think it's necessary given how aggressive this rule is.

@Belco90 Belco90 changed the title no-node-access should not report properties from document limit no-node-access errors reported Apr 13, 2021
Belco90 added a commit that referenced this issue Apr 14, 2021
…ort (#338)

* test(no-node-access): improve current invalid cases asserts

* fix(no-node-access): skip Aggressive Reporting

* refactor: simplify check for strict module imported

Closes #334
@github-actions
Copy link

🎉 This issue has been resolved in version 4.0.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
bug Something isn't working released
Projects
None yet
1 participant