-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
[Bug?] no-unused-modules (and deprecation) #90
Comments
Apologies. I'm still new to the whole eslint ecosystem and I'm slowly digging deeper into it. The issue is related to eslint/eslint#18087 |
ESLint might add multi-file analysis support in the future. But for now, ESLint works on one rule at a time, where there is no concept of information from one file being available in another file. Thus I am considering deprecating the Since you are contributing import-js#3011 (and #86), I'd like to hear about your ideas about this rule. Contexts: |
Hey there, I'm afraid I can't contribute something useful. I'm still in the process of getting familiar with the whole eslint ecosystem and I haven't heard of knip before but might try it in the near future. Deprecating 'no-unused-modules' would be fine. Cheers |
I can't judge knip until it actually works for me (webpro-nl/knip#725). |
And no, I don't think it's a good idea to deprecate a lint rule because that tool exists. The rule is focused on just finding unused code while that tool does check many more things and seems to have problems with false-positives, so will require fiddling with config. Also, it adds 15 dependencies totalling almost 6MB which is too much for me personally. |
In eslint/eslint#18087 they proposed a solution but ljharb didn't have a repo to test it out so the eslint changes weren't shipped in time (eslint/eslint#18087 (comment)). Could a maintainer here perhaps validate the proposal and reply there? As for knip - sadly it doesn't have vscode support like eslint does (ie highlighting what's unused inside a file), also not looking forward to adding and configuring a new dependency in umpteen microservices, so I'm happy that You're not considering removing the rule completely. edit: knip does work fast though, I'll give them that |
For my personal config, I will just disable |
Hmmm, actually In the long term, we want ESLint to provide official cross-file reference support. |
I was using 0.5.something, saw that new version was out and hoped that that would fix it but no, I still get the error. I made a barebones example of what I'm doing here https://github.com/KristjanTammekivi/eslint-plugin-import-x-flat-config-debug/tree/main |
Actually I thought again and will give the rule another chance once #116 is in. It is a useful rule when doing big refactors and I' definitely want to keep these checks in eslint, not some other tool (reasons: I don't want any more dependencies and I want editor integration). |
I concur with the assertions mentioned in the referenced comments. It definitely feels like a case of trying to force a tool to do something it wasn't intended to do. I'm a big proponent of using the right tool for the right job, and knip works great for what it does. Just my two cents. With that said, i don't mind porting over that implementation, since it's pretty straightforward to do. But just wanted to weigh in and raise the "should" vs "could" question to consider. |
Yes, I need to investigate knip further, now that webpro-nl/knip#725 is fixed it works on a basic level, but still has a lot of false-positive issues for the other stuff it checks like dependencies. If knip can be made to check only for unused exports, it might be immedately useful for me as a replacement for this rule. |
Hey there,
so there are two possibilities: either I'm completely confused and can't see what I'm doing wrong or this is a real bug.
Setting the rule 'import-x/no-unused-modules' results in the following error in the output of vscode:
And the usual one in the cli:
While using the following setup:
Here's a reproduction of the error:
https://github.com/error-four-o-four/eslint-config-404/blob/repro-no-unused-modules/eslint.config.js
Additionally
The text was updated successfully, but these errors were encountered: