eslint: make --fix remove unused imports - #1076
Conversation
eslint: make --fix remove unused imports
|
Yeah, I definitely did take a look at #640 :). A quick naive implementation had it making a bunch of changes, so I stopped for now. Will update the tagging on the existing imports. |
991f18e to
4d64561
Compare
|
I've tagged the existing unused imports with |
|
From the meetup: we looked at https://github.com/import-js/eslint-plugin-import briefly but didn't see a rule for removing unused imports. no-unused-modules seems to be more about finding exports in your own modules that aren't used. @auscompgeek let me know if I missed it. If there is, we can use it. Otherwise, this should be ready to merge and we can take a look at adding some of eslint-plugin-import's rules as a follow up change, as I imagine that would be valuable in their own right. |
|
@auscompgeek @pokey can we merge this? |
I noticed that
eslint --fixdidn't remove unused imports andeslint src --ext tscomplained with a warning about an existing unused one:I imagine this is because most people are fixing this up using the Visual Studio Code action, but it's nice to have everything working from the command line. Also JetBrains will only do it if
eslint --fixdoes, hence my motivation :)This adds the configuration such that
eslint src --ext ts --fixremoved unused imports, and fixes the existing unused imports in the codebase. Let me know if I made a mistake.Checklist