Skip to content

Implicit arrow return of test function and timeout is hard to read #5365

@SimenB

Description

@SimenB

Prettier 1.15.1
Playground link

--parser babylon

Input:

  it(
    'succeeds if the test finishes in time',
    () => new Promise(resolve => setTimeout(resolve, 10)),
    250
  );

Output:

it("succeeds if the test finishes in time", () =>
  new Promise(resolve => setTimeout(resolve, 10)), 250);

Expected behavior:
Not sure, actually. But I find it pretty hard to read at first glance that 250 is an argument to it and not part of the statement in the body of the callback function.

Related to #5085 (FWIW, I'm highly supportive of that change, I just think the arrow return case is hard to read)

Metadata

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.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