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.

Multiline eslint-disable comments with leading asterisks fail to disable rules

See original GitHub issue
  • ESLint Version: 4.11.0
  • Node Version: 9.1.0
  • npm Version: 5.5.1
Configuration
{
    "parserOptions": {
        "ecmaVersion": 5,
        "sourceType": "script",
        "ecmaFeatures": {}
    },
    "rules": {
        "eqeqeq": 2,
        "semi": 2
    },
    "env": {}
}

Currently the only way to put disable directives on separate lines is to omit any leading asterisks *.

// THIS WORKS AS EXPECTED
/* eslint-disable
   eqeqeq,
   semi
*/
1 == true
/* eslint-enable */

//  DOES NOT WORK WITH LEADING ASTERISKS
/* eslint-disable
 * eqeqeq,
 * semi
 */
1 == true
/* eslint-enable */

It is a common pattern to separate multiple lines in comments with leading asterisks. My editor places these automatically when I press return. There is one consideration: making sure this style is compatible with any documentation parsers such as JSDoc, but this should be fine as long as those parsers use the double asterisk pattern /** at the start of the comment block.

Reproduction Link

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Dec 14, 2017

I think this would require TSC consensus since it’s a core change.

1reaction
ilyavolodincommented, Dec 23, 2017

TSC Summary: Currently ESLint directives don’t support multi-line comments with leading asterisks. TSC Question: Proposal is to allow this behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
How to stop ReSharper from formatting multi-line comments in ...
When I make a multi-line comment using a backslash and asterisks, it inserts asterisks on every line and does not keep the spacing...
Read more >
eslint-plugin-jsdoc - npm
ignorePrivate - Disables all rules for the comment block on which a @private tag (or @access private ) occurs. Defaults to false ....
Read more >
eslint-plugin-jsdoc/README.md - UNPKG
ignorePrivate` - Disables all rules for the comment block ... 1244, // Message: @example error: Unused eslint-disable directive (no problems were reported ...
Read more >
node_modules/eslint/CHANGELOG.md ... - GitLab
3f2b908 New: add option to report unused eslint-disable directives (fixes ... 0d60db7 Fix: Curly rule doesn't account for leading comment (fixes #7538) ...
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