Skip to content

JavaScript: Incorrect formatting for conditional expression and end of line comment after ? #8708

@sosukesuzuki

Description

@sosukesuzuki

Original from: #8554 (comment)
Prettier 2.0.5
Playground link

--parser babel

Input:

test ? // comment
  foo
  : bar;

Output:

test // comment
  ? foo
  : bar;

Expected behavior:

test
  ? // comment
    foo
  : bar;

Metadata

Metadata

Assignees

Labels

area:commentsIssues with how Prettier prints commentslang:javascriptIssues affecting JS

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions