eslint-community / eslint-plugin-eslint-comments

Additional ESLint rules for directive comments of ESLint.
https://eslint-community.github.io/eslint-plugin-eslint-comments
MIT License
51 stars 7 forks source link

`@eslint-community/eslint-comments/no-unused-disable` option to disable autofix #234

Open Samuel-Therrien-Beslogic opened 3 months ago

Samuel-Therrien-Beslogic commented 3 months ago

Normally to disable a rule's autofix through configuration, I'd simply use https://github.com/aladdin-add/eslint-plugin/tree/master/packages/no-autofix . But due to the special way this rule works (as mentionned in its documentation https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html#known-limitations ), no-autofix/@eslint-community/eslint-comments/no-unused-disable doesn't work.

I want to be warned about rules that no longer trigger, but I don't want that change to be automated.

voxpelli commented 3 months ago

Ideally this would be handled at the ESLint level rather than within any specific rule. That's a bigger task though and not one that excludes this.

Samuel-Therrien-Beslogic commented 2 months ago

Ideally this would be handled at the ESLint level rather than within any specific rule.

Agreed.

As a note for anyone else reading this, ESLint has https://eslint.org/docs/v8.x/use/configure/rules#report-unused-eslint-disable-comments , but that has a few issues that don't obsolete @eslint-community/eslint-comments/no-unused-disable:

  1. Cannot be configured as warning in v8 through configurations (only through CLI, v9 has https://eslint.org/docs/latest/use/configure/rules#report-unused-eslint-disable-comments )
  2. Doesn't seem to be picked up by extending configurations
  3. Cannot be configured to be autofixed or not (either through configs or CLI). Well, neither can @eslint-community/eslint-comments/no-unused-disable at the moment, but that's what this request is about.
voxpelli commented 2 months ago

I meant that the option to disable autofix for any individual rule should be supported by ESLint, as eg. Biome does: https://biomejs.dev/linter/#configure-the-rule-fix :)

Samuel-Therrien-Beslogic commented 2 months ago

Ah yes, that too !