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.

Allow comments after // eslint-disable-line <rule-name>

See original GitHub issue

The 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

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>. demo.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

kaicataldocommented, Jul 25, 2019

There is currently an RFC open for this:

Please track the issue there.

JvJefkecommented, Jun 20, 2019


Why is this solution better than having two comments? i.e.

You’re example is not really a real life one. This one is (kinda):

const someFunction() =>
    // Map the otherData to this list by index
    //, idx) => (item._templateMeta = otherData[idx])) // eslint-disable-line [some-rule]

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:

const someFunction() =>
    // Map the otherData to this list by index, idx) => (item._templateMeta = otherData[idx])) // eslint-disable-line [some-rule] because

So I do think this solution is better than the workaround you suggested.

Read more comments on GitHub >

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

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 Post

No results found

github_iconTop Related Hashnode Post

No results found