-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
no-unused-modules: ignore imports in files listed in ignoreExports #2976
Comments
Colocation definitely makes this trickier - however, can you try to set |
@ljharb yes, I tried and got an error Error: Error while loading rule 'import/no-unused-modules': No files matching '!src/**/*.test.js' were found. I think negation isn't working in |
aha, perhaps that's the request. I wouldn't have thought of the need because I think colocation of tests is a bad idea :-) |
Actually, it doesn't matter where you put your tests (or something else), cause ignoring hypothetical tests folder do nothing. The issue with the imports in ignored files, the plugin see them and doesn't throw any warn, if I got your message correctly. Thank you for labels! :) |
if the test files aren't in |
hm, interesting, ok - then this becomes much more important. |
Hello,
I've faced with a problem that it's impossible to warn about unused modules in case the module has imports only to test files, for instance.
Example
Suppose, we have a simple file structure like:
do-something.js
imported only insidedo-something.test.js
for tests, obviously.At the same time files with name
*.test.js
are ignored byimport/no-unused-modules
rule in .eslintrc.js:Finally,
do-something.js
has no imports anywhere, except in ignored file with tests of itself. So, it's better to deletedo-something.js
file and everything related to it.Is there any way to do something like that in the current version?
The text was updated successfully, but these errors were encountered: