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.

`//eslint-disable-line`'s behavior is changed in 4.7.0

See original GitHub issue

Tell 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:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Sep 16, 2017

I think it makes the most sense for nesting to not be supported, and for eslint-disable and eslint-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.

1reaction
shellscapecommented, Sep 17, 2017

As @mysticatea commented, our block-disabling comments stopped working in 4.7.0 as well.

/* eslint-disable quotes */
console.log("foo");
/* eslint-enable quotes */

That now throws an error on console.log as it violates the config quotes rule, even though it’s disabled for that block.

Read more comments on GitHub >

github_iconTop 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 >

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