-
Notifications
You must be signed in to change notification settings - Fork 148
Bug: no-dom-import
false negatives with several Testing Library imports
#586
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
Comments
no-dom-import
false negatives with several Testing Library imports
Actually, it doesn't need to update the internal helpers if we just look for the corresponding imports within this rule. I'll give it a try later. |
@Belco90 I noticed that you had said that you'd like to submit a PR to fix this. Would you mind if I submit one, since you haven't done one yet? |
I couldn't work on this, so please feel free to submit a PR to fix it! 🙏 |
Use the new refactored utils function to get a list of all testing-library imports and make sure that none of them are a dom import. Ref: testing-library#586
Use the new refactored utils function to get a list of all testing-library imports and make sure that none of them are a dom import. Ref: testing-library#586
Alright, the PR is now open! I noticed that other rules ( |
🎉 This issue has been resolved in version 5.7.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Refactoring those rules would be amazing! Better to open an issue for that so we can discuss the approach properly. |
Have you read the Troubleshooting section?
Yes
Plugin version
5.3.3
ESLint version
v8.14.0
Node.js version
v16.15.0
package manager and version
npm v8.9.0
Operating system
macOS v12.3.1
Bug description
If there are several Testing Library imports,
no-dom-import
doesn't report@testing-library/dom
imports if they are other than the first occurrence between Testing Library imports.Steps to reproduce
This should be reported but it's not:
Error output/screenshots
N/A
ESLint configuration
N/A
Rule(s) affected
no-dom-import
Anything else?
This is related to how we store the imported Testing Library module in the internal helpers. This only allows one Testing Library module, so the first one found it's the chosen one for later checks.
I remember mentioning this in another issue/PR, but I can't remember which one. This is not that simple to fix since we need to store a list of Testing Library modules used rather than a single one, updating all the helpers provided internally too.
After we allow storing several Testing Library modules in our core helpers, we will be able to fix the actual issue reported.
Do you want to submit a pull request to fix this bug?
Yes
The text was updated successfully, but these errors were encountered: