Turn on unused-imports/no-unused-imports#54953
Conversation
ravicious
left a comment
There was a problem hiding this comment.
Thanks for taking care of this.
There was a problem hiding this comment.
I found a small issue but it has more to do with my editor rather than the ESLint plugin. I'm posting this in case other people run into this problem.
I run both Prettier and ESLint autofix on save. Prettier seems to run first, which doesn't seem to make sense, given that ESLint is able to modify the file after Prettier finishes. Which is exactly what happens in certain scenarios.
For example, if I append AgentCompatibilityError to the list of imported values here…
…what ends up happening is that Prettier first transforms the import statement into a multi-line statement and then the ESLint plugin removes the import of AgentCompatibilityError. On the next save, the import statement is transformed back into a single-line statement. But the first save results in a file that's considered by Prettier to not be formatted.
|
Note: I'll need to split this PR in two, because otherwise, there's no other way to include necessary changes to e/ without breaking the build. |
This allows removing unused imports automatically when executing `pnpm lint-fix`.
0a8b9a0 to
96cdd93
Compare
* Add eslint-plugin-unused-imports * Turn on unused-imports/no-unused-imports This allows removing unused imports automatically when executing `pnpm lint-fix`.
* Add eslint-plugin-unused-imports * Turn on unused-imports/no-unused-imports This allows removing unused imports automatically when executing `pnpm lint-fix`.
This allows removing unused imports automatically when executing
pnpm lint-fix.Requires https://github.com/gravitational/teleport.e/pull/6548
This is a final PR of a 3-PR train. Since I don't want to babysit 9 PRs + e/ updates just for that, I'll prepare backports separately.