Skip to content

Conversation

@FSVetaz
Copy link
Contributor

@FSVetaz FSVetaz commented Oct 6, 2025

@eslint-community/eslint-comments can replace eslint-plugin-bestpractices as it is a community-wide eslint plugin.

https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/ to see the rules.

The rule that specifically replaces the old bestpractices/no-eslint-disable is require-description. It does basically the same. The difference is that it only affects real eslint-disable directives. For example, it doesn't affect // eslint-disable-next as that doesn't actually disable any linting rules. See https://eslint.org/docs/latest/use/configure/rules.

The plugin adds its recommended rules automatically. Those rules are: disable-enable-pair, no-aggregating-enable, no-duplicate-disable, no-unlimited-disable, no-unused-disable, no-unused-enable. They are all treated as errors. The only way to turn them off is to turn them off individually as the plugin doesn't allow consumers to just get the plugin and define which rules to turn on. I do think those rules are nice to have though, so I think it is fine to keep them. I particularly like the no-unlimited-disable to make developers be specific on what they are disabling.

I updated the example test to do a common eslint disable directive (eslint-disable-next-line) that actually disables a eslint rule on the next line. This triggers both the @eslint-community/eslint-comments/require-description and @eslint-community/eslint-comments/no-unlimited-disable rules.

To-Dos

  • Run tests (part of pre-push hook)
  • Update demo and tests, if linting configuration is being changed
  • Update documentation & README
  • Increment package.json version

Add the recommended rules of disable-enable-pair, no-aggregating-enable, no-duplicate-disable, no-unlimited-disable, no-unused-disable, no-unused-enable as errors and the one we most care about, require-description, (as a warning) which is a direct replacement of bestpractices/no-eslint-disable.
@FSVetaz FSVetaz requested a review from a team as a code owner October 6, 2025 16:51
Comment on lines +8302 to +8303
8:0 warning Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary @eslint-community/eslint-comments/require-description␊
8:0 error Unexpected unlimited 'eslint-disable-next-line' comment. Specify some rule names to disable @eslint-community/eslint-comments/no-unlimited-disable␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In VSCode, you can see better that it is only these top two that changed and that the rest just changed the line number.

@FSVetaz FSVetaz merged commit 58e1ddd into master Oct 13, 2025
1 check passed
@FSVetaz FSVetaz deleted the jordi/eslint-comments branch October 13, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants