bamlab/react-native-project-config

[RFC]: unused-imports/no-unused-imports

matthieugicquel opened this issue · 0 comments

Why?

This rule eliminates one of the most boring tasks we need to do multiple times an hour as devs: deleting unused imports. Thanks to an autofix, they get deleted automatically on save.

It's especially useful since imports are at the top of the file so you often don't even see the errors.

In my experience, without this rule, >80% of CI failures caused by linting errors are because of unused imports that were not removed.

Rule Documentation 📜

https://github.com/sweepline/eslint-plugin-unused-imports

Config Selection 🛠

recommended

(Optional) Additional Details 📝

  • we've been using it successfully in my last 2 projects
  • it's not included in eslint core because it might technically change what the code does if an import has side-effects, but in practice it's not problem
  • it's included in theodo generator's eslint config
  • only drawback: when commenting out code temporarily eg for debugging, the imports get removed, and when you uncomment, you have to re-import (or get in the habit of using cmd-z instead of uncommmenting)