-
Notifications
You must be signed in to change notification settings - Fork 343
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
eslint-plugin-import
rule import/no-unused-modules
does not work with vscode-eslint.
#717
Comments
@ehmicky ESLint only validates the open files. This is comparable to running eslint in the terminal for a single file. E.g. There is also a eslint validate task that validates the whole project. It can be enable with |
@dbaeumer thanks for looking into this. If I understand you correctly, VSCode-ESLint only validates the opened files. This might be an issue with rules like Doing The |
@ehmicky thanks for the additional information. The problem is that we can't do that on typing since it would not scale parsing all files in a workspace. What would work is that we auto trigger the lint task on save so that there is not need for a user interaction. |
Good opportunity for a PR. |
@dbaeumer yes triggering the lint task on save would work for me, thanks! |
We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding and happy coding! |
I am still happy to accept a PR if someone wants to work on this. |
I get the same error would love to see a PR! |
I am seeing this issue manifest with two open files. ESLint on the command-line works fine. VSCode: The server trace logs appear to show only producing a notification that the unused module correction is fixed when the server is restarted. |
The plugin
eslint-plugin-import
has a ruleimport/no-unused-modules
that checks (among other things) for exports that are not used in other files.This does not work well with vscode-eslint: files that have not been opened in the editor yet are not taken into account. As a consequence exports are being reported as unused even though they are used.
For example, if I just open a new VSCode Window:
The
serialize()
exported function is reported, even after saving the file.Now if I open that other file which imports the
serialize()
function:Then go back to the first file and save it, the reporting is now gone:
It seems like only files that are open within VSCode are considered for the
import/no-unused-modules
rule.This behavior only seems to happen with VSCode. If I run
eslint
on the command line, everything works fine.I've initially opened an issue with
eslint-plugin-import
but got redirected here by its author.VSCode:
1.36.1
vscode-eslint:
1.9.0
OS: Ubuntu
19.04
ESLint:
6.0.1
eslint-plugin-import:
2.18.0
Node:
12.6.0
The text was updated successfully, but these errors were encountered: