`//eslint-disable-line`'s behavior is changed in 4.7.0
See original GitHub issueTell us about your environment
- ESLint Version: 4.7.0
- Node Version: 8.4.0
- npm Version: 5.4.2
What parser (default, Babel-ESLint, etc.) are you using?
- default
Please show your full configuration:
- nothing
What did you do? Please include the actual source code causing the issue.
/* eslint-disable no-unused-vars */
var foo; // eslint-disable-line no-unused-vars
var bar;
/* eslint-enable no-unused-vars */
$ eslint test.js --rule no-unused-vars:error
What did you expect to happen?
No errors as same as 4.6.0
.
What actually happened? Please include the actual, raw output from ESLint.
~\dev\sandbox> eslint test.js --rule no-unused-vars:error
C:\Users\t-nagashima.MSS\dev\sandbox\test.js
6:5 error 'bar' is defined but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:17 (14 by maintainers)
Top Results From Across the Web
Working with Rules - ESLint - Pluggable JavaScript Linter
"suggestion" means the rule is identifying something that could be done in a better way but no errors will occur if the code...
Read more >Turning off eslint rule for a specific file
1) Disabling "All rules" Two ways you can do this: Put /* eslint-disable-line */ at the end of the line(s), or /* eslint-disable-next-line...
Read more >eslint-plugin-weex-vue - npm Package Health Analysis
If you want to disallow eslint-disable functionality, please disable vue/comment-directive rule. ⚙️ Configs. This plugin provides two ...
Read more >module build failed (from ./node_modules/eslint-loader/dist/cjs.js ...
eslint -loader has been deprecated now, and i change to use eslint-webpack-plugin ... Therefore, you must remove below line, and again run your...
Read more >README.md
We commit to keeping the breaking changes minimal so you can upgrade ... force the linter to ignore any line by adding `//...
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 FreeTop 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
Top GitHub Comments
I think it makes the most sense for nesting to not be supported, and for
eslint-disable
andeslint-disable-line
comments to be considered separately without relying on nesting. That way, the examples in https://github.com/eslint/eslint/issues/9318#issue-258221265 and https://github.com/eslint/eslint/issues/9318#issuecomment-329979578 will be considered correct), and the examples in https://github.com/eslint/eslint/pull/9216#discussion_r136707906 and https://github.com/eslint/eslint/issues/9215 will be considered incorrect.Alternatively, we could update the implementation to support nesting again. (I don’t think reverting would work well since we’ve made some additional changes to the code since the original refactor landed). However, this could end up being confusing, because the behavior in https://github.com/eslint/eslint/issues/9215 definitely seems incorrect to me.
As @mysticatea commented, our block-disabling comments stopped working in 4.7.0 as well.
That now throws an error on
console.log
as it violates the config quotes rule, even though it’s disabled for that block.