eslint-plugin-unused-imports icon indicating copy to clipboard operation
eslint-plugin-unused-imports copied to clipboard

Feature request: propose fix as a suggestion

Open Ayc0 opened this issue 1 year ago • 4 comments

Hello 👋

This feature is related to https://github.com/sweepline/eslint-plugin-unused-imports/issues/26.

Can we add an option in the rule config to tell whether the fix should be proposed as an autofix (auto applied with all the other rules with --fix or on save in some IDEs), or as a suggestions (have to be manually applied)

The reasons for this are:

  • in some IDEs (like VSCode), when a rule as an autofix, it'll be applied in all cases (even when the rule is in warning). But as mentioned in #26, sometimes people may save while still coding and if the imports haven't been used yet, they'll be removed, which can be a bad user experience (and worse when format on save is enabled)
  • some imports can have side effects, so auto-removing them can have impact on the codebase. So we could let people decide if they want to apply the autofix or not.

Ayc0 avatar Dec 12 '22 10:12 Ayc0