Eslint: Proposal: Add option to make multiline-comment-style not coalesce non-consecutive single line comments

Created on 16 Oct 2017  路  1Comment  路  Source: eslint/eslint

Tell us about your environment

  • ESLint Version: 4.9.0
  • Node Version: 8.6.0
  • npm Version: 5.5.1

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:


Configuration

{
    "parserOptions": {
        "ecmaVersion": 8,
        "sourceType": "script",
        "ecmaFeatures": {}
    },
    "rules": {
        "multiline-comment-style": 2
    },
    "env": {}
}

What did you do? Please include the actual source code causing the issue.

//someCommentedOutLineOfCode();

// Useful documentation about the next line

What did you expect to happen?
I expected fixing multiline-comment-style to leave two separate single-line comments.

What actually happened? Please include the actual, raw output from ESLint.
The fixer combines the two comments into:

/*
 *someCommentedOutLineOfCode();
 *Useful documentation about the next line
 */

I believe it would be useful to have an option to have the rule not flag/fix single line comments with an empty line in between them. It seems like the intent behind the rule is to combine "block" comments composed of single line comments into a single real block comment, and I think that this option would more accurately reflect that desire.

accepted archived due to age bug rule

Most helpful comment

IMO, your proposal should be the default behavior. I don't think the current grouping behavior was intended.

>All comments

IMO, your proposal should be the default behavior. I don't think the current grouping behavior was intended.

Was this page helpful?
0 / 5 - 0 ratings