How can I remove unused imports/declarations from the entire project of React Typescript?

后端 未结 1 606
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 05:43

I\'m trying to remove unused imports and declarations as answered in this SO thread for Angular. I\'m trying to achieve the goal using eslint-plugin-react, but not found any opt

相关标签:
1条回答
  • 2021-02-08 06:02

    Using unused-imports plugin and unused-imports/no-unused-imports-ts rule, eslint --fix will remove the imports.

    Here is an example repo which --fix removes the unused imports.

    https://github.com/moshfeu/eslint-ts-unused-imports

    Old answer

    eslint has a built-in fix option.

    eslint ... --fix
    

    If rules contains no-unused-vars, eslint will "fix" the unused import by removing them (along with other auto fixes).

    0 讨论(0)
提交回复
热议问题