Allow comments after // eslint-disable-line <rule-name>
See original GitHub issueThe version of ESLint you are using. 5.12.1
The problem you want to solve. I’ve just filed an issue against an incorrect (in my opinion) application of a rule. I want to disable that rule in my code, and mention why I’ve done so:
// eslint-disable-line no-unsafe-finally because https://github.com/eslint/eslint/issues/11297
Including the URL on the same comment line is handy because I can click it from my IDE and check on the status, then remove the entire comment once the issue is fixed.
Another use case is simply explaining why a rule was removed.
Your take on the correct solution to problem.
eslint should ignore non-rule comments following // eslint-disable-line <rule-name>
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Rules - ESLint - Pluggable JavaScript Linter
To configure rules inside of a file using configuration comments, use a comment in the following format: /* eslint eqeqeq: "off", curly: "error"...
Read more >Turning off eslint rule for a specific line - Stack Overflow
I use a combination of prettier and eslint to format my code. This does not allow for inline comments. Many /* eslint-disable-next-line ......
Read more >eslint-comments/no-unlimited-disable - mysticatea
The "extends": "plugin:eslint-comments/recommended" property in a configuration file enables this rule. eslint-disable directive-comments disable all rules ...
Read more >no-invalid-double-slash-comments - Stylelint
If you are using a preprocessor that allows // single-line comments (e.g. Sass, Less, Stylus), this rule will not complain about those.
Read more >Enable and Disable Comments | WordPress.com Support
Comments are a way for visitors to add feedback to your posts and pages. If you choose to enable comments for your posts,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There is currently an RFC open for this: https://github.com/eslint/rfcs/pull/33
Please track the issue there.
@kaicataldo
You’re example is not really a real life one. This one is (kinda):
There is more visual correlation between te “real” comment than the eslint comment which makes it just confusing. If you could do something like OP suggests, it isn’t:
So I do think this solution is better than the workaround you suggested.