Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[multiline-comment-style] autofix removes indentation in the comment #12312

Closed
mysticatea opened this issue Sep 25, 2019 · 1 comment · Fixed by #12316, basics/vector#111, basics/vector#113, thinkwee/thinkwee.github.io#39 or alxtford/numconv#46
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion autofix This change is related to ESLint's autofixing capabilities bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@mysticatea
Copy link
Member

Tell us about your environment

  • ESLint Version: 6.4.0
  • Node Version: 12.10.0
  • npm Version: 6.11.3

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

Default.

Please show your full configuration:
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Online Demo.

/*eslint multiline-comment-style: [error] */

/*
{
    "foo": 1,
    "bar": 2
}
*/

What did you expect to happen?

ESLint fixes it to:

/*eslint multiline-comment-style: [error] */

/*
 * {
 *     "foo": 1,
 *     "bar": 2
 * }
 */

What actually happened? Please include the actual, raw output from ESLint.

ESLint fixed it to:

/*eslint multiline-comment-style: [error] */

/*
 * {
 * "foo": 1,
 * "bar": 2
 * }
 */

The indentation in the comment is broken.

Are you willing to submit a pull request to fix this bug?

Yes.

@mysticatea mysticatea added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Sep 25, 2019
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Sep 25, 2019
@kaicataldo
Copy link
Member

Verified and agree that this looks like a bug.

@kaicataldo kaicataldo added the autofix This change is related to ESLint's autofixing capabilities label Sep 26, 2019
kaicataldo added a commit that referenced this issue Nov 18, 2019
…12316)

* Fix: preserve whitespace in multiline-comment-style (fixes #12312)

* Add support for preserving whitespace in other comment types

* Handle blank lines in starred-block comments correctly

* Add more tests

* Fix starred-block alignment/missing star fixer

* Use RegExp to check for whitespace-only lines

* Fix up comments
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 18, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.