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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:9 (8 by maintainers)
Top 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 >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 this would require TSC consensus since it’s a core change.
TSC Summary: Currently ESLint directives don’t support multi-line comments with leading asterisks. TSC Question: Proposal is to allow this behavior.