Support block-comment version of eslint-disable-line
See original GitHub issueTell us about your environment
- ESLint Version: master
- Node Version: any
- npm Version: any
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
{ "rules": { "no-alert": [1] } }
What did you do? Please include the actual source code causing the issue.
/* eslint-disable-line */ alert(1);
What did you expect to happen?
It should work like in JSCS:
/* jscs:ignore */ alert(1)
What actually happened? Please include the actual, raw output from ESLint.
Error reported.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:47 (45 by maintainers)
Top Results From Across the Web
Is there any syntax to add additional info to an eslint-disable ...
Is there any syntax we can add a description or explanation for why we're disabling the rule, on the same line, without triggering...
Read more >multiline-comment-style - ESLint - Pluggable JavaScript Linter
"separate-lines" : Disallows block comments in favor of consecutive line comments. The rule always ignores directive comments such as /* eslint-disable */ ....
Read more >eslint-plugin-no-comments - npm
Prevents leaving comment blocks in the file. This plugin will ignore all comments starting from string global or eslint in order to keep...
Read more >User Guide | eslint-plugin-vue
Official ESLint plugin for Vue.js. ... Status of Vue.js 3.x supports ... comment // @vue/component that marks an object in the next line...
Read more >svelte/comment-directive
Sole purpose of this rule is to provide eslint-disable functionality in the template HTML. It supports usage of the following comments: ... We...
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
I think it would be best to report a problem at that location, and ignore the comment. However, it might be a breaking change to start reporting a problem for those cases, since we previously always ignored them.
We could ignore them for now, then start reporting a problem for them in the next major release.
I think it’s fine to just ignore disable the entire line in that case. We already do that with
// eslint-disable-line
at the end of a line, so in my opinion it’s not too confusing to to also ignore the entire line if there is a block comment in the middle.I think this should disable both rules, by just processing the comments separately.
We already do the same thing in a similar case:
We already handle similar cases:
With the current behavior, reporting is disabled for
foo
, but enabled forbar
.Right now, we preprocess all
disable-line
anddisable-next-line
directives into regulardisable
andenable
directives:So I think we could just do the same thing here regardless of whether the
disable-line
comment is a block.Would it make sense to also make
eslint-disable-next-line
also available in block comments to fix this issue?