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
44 stars 6 forks source link

`eslint-comments/require-description` should allow ignoring particular rules #134

Closed tylerlaprade closed 5 months ago

tylerlaprade commented 8 months ago

It's very nice that we can ignore categories of eslint directives. I would find it very helpful to also be able to ignore particular ESLint rules that we disable for self-evident reasons, such as importing a forbidden library is only allowed in our ui-component folder.

(cloned from https://github.com/mysticatea/eslint-plugin-eslint-comments/issues/76)

mcongrove commented 8 months ago

Ran into this need in my codebase; we have a variable we use throughout the app which causes a render-loop if we add it as a React hook dependency, so we ended up with quite a few eslint-disable-next-line react-hooks/exhaustive-deps. Having to add the same comment over and over in this case would be unnecessary, as everyone using the codebase understands why the rule is being disabled.

I've popped up a PR for this.

tylerlaprade commented 8 months ago

Thank you very much for the PR, @mcongrove! It sounds like your use case would be better served by a variable-name exclusion for that particular rule, though, so that the rule would still work on other variables.

mcongrove commented 8 months ago

It sounds like your use case would be better served by a variable-name exclusion for that particular rule, though, so that the rule would still work on other variables.

I over-simplified a bit for the example; it's actually quite a few variables. It's probably indicative of a bigger issue in the libraries we choose and how we utilize hooks, but I'm just in charge of linting rules :)

github-actions[bot] commented 5 months ago

This issue has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from issues that aren't actionable. Please reach out if you have more information for us! 🙂

fregante commented 4 months ago

everyone using the codebase understands why the rule is being disabled

Do they? Developer memory is limited. At some point someone new will see the code and they won't have any context. Comments outlive developers.