Skip to content

Improve formatting for do expressions #10660

Closed
@sosukesuzuki

Description

Prettier 2.2.1
Playground link

--parser babel

Input:

expect(do {
  var bar = "foo";
  bar;
}).toBe("foo");

Output:

expect(
  do {
    var bar = "foo";
    bar;
  }
).toBe("foo");

Expected behavior:
Same as input

expect(do {
  var bar = "foo";
  bar;
}).toBe("foo");

Additional context:

Original was reported by @nicolo-ribaudo at babel/babel#13122 (comment)

Metadata

Assignees

No one assigned

    Labels

    lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.type:bugIssues identifying ugly output, or a defect in the program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions