Closed tylerlaprade closed 5 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.
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.
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 :)
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! 🙂
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.
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 ourui-component
folder.(cloned from https://github.com/mysticatea/eslint-plugin-eslint-comments/issues/76)