Skip to content

Comments on lines before leading semis are indented in 1.15.1 #5409

@paulmelnikow

Description

@paulmelnikow

Prettier 1.15.1
Playground link

--parser babylon
--no-semi

Input:

const foo = 123
// Nothing to see here.
;["2", "3"].forEach(x => console.log(x))

Output:

const foo = 123
  // Nothing to see here.
;["2", "3"].forEach(x => console.log(x))

Expected behavior:

const foo = 123
// Nothing to see here.
;["2", "3"].forEach(x => console.log(x))

This worked as expected in 1.14.3 and is a new issue in 1.15.1:
https://github.com/badges/shields/pull/2289/files#diff-676bb6a761a788e31078b1ca347c3e63

Apologies if this has already been reported! There are some related issues around semicolons and comments including #5022 but they are older and seem to be different from this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:commentsIssues with how Prettier prints commentslang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions