question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lint unnecessary disabled reporting comments

See original GitHub issue

Repost 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:29 (29 by maintainers)

github_iconTop GitHub Comments

2reactions
mysticateacommented, Oct 10, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-comments/no-unused-disable - mysticatea
This rule warns unnecessary eslint-disable directive-comments. # Rule Details. Examples of 👎 incorrect code for this rule: 1.
Read more >
How disable comments make static analysis tools worse
Unnecessary disable comments ​​ Some tools will report when disable comments are used that don't suppress anything anymore, usually because the ...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
Note: Comments that disable warnings for a portion of a file tell ESLint not to report rule violations for the disabled code.
Read more >
Is there any syntax to add additional info to an eslint-disable ...
According to the docs on using configuration comments: ... comments can include descriptions to explain why the comment is necessary.
Read more >
Suppressing Lint Warnings - Android Studio Project Site
Here's a sample lint.xml file (the comments are obviously not needed; I've added them here to explain what ... Disable the given check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found