Lint unnecessary disabled reporting comments
See original GitHub issueRepost of #6188 as an Issue
ESLint configuration comments are handy for temporarily allowing an exception or hack. But sometimes the hack is fixed but the comment is still left in place.
A clever way to implement this would be with a eslint rule itself. However this is error prone. The most obvious thing is that disabling all rules in a file would then disable this meta rule.
Similar to allowInlineConfig
, this probably means it needs to be implemented outside of the rule processing code path. I took a stab at plumbing a similar CLI flag to enable these checks.
If this is something that won’t be accepted, would you at least consider publicly exposing the data on reportConfig
? Theres really no way to access this without monkey patching api.report
. api.getReportingConfig()
would probably be enough for my needs.
Related https://github.com/eslint/eslint/issues/5659 https://github.com/sindresorhus/xo/issues/103 https://github.com/bbatsov/rubocop/issues/1865
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:29 (29 by maintainers)
Top GitHub Comments
Today, I published eslint-plugin-eslint-comments experimentally.
This plugin includes 6 rules to use ESLint directive-comments (e.g.
/*eslint-disable*/
) correctly. One of them is inspired by above GitHub’s rule, but it has more correct behavior.Just I found: https://github.com/github/eslint-plugin-github/blob/master/lib/rules/no-unused-disabled-rules.js