Skip to content

Should prerrier when arrow function as function param #6668

@fisker

Description

@fisker

Prettier 1.18.2
Playground link

--parser babel

Input:

test(
  "API getFileInfo with no args", 
  () => expect(prettier.getFileInfo()).rejects.toThrow(new TypeError("expect `filePath` to be a string, got `undefined`"))
);

Output:

test("API getFileInfo with no args", () =>
  expect(prettier.getFileInfo()).rejects.toThrow(
    new TypeError("expect `filePath` to be a string, got `undefined`")
  ));

Expected behavior:

maybe

test(
  "API getFileInfo with no args", 
  () => expect(prettier.getFileInfo()).rejects.toThrow(
    new TypeError("expect `filePath` to be a string, got `undefined`")
  )
);

or

test(
  "API getFileInfo with no args", 
  () => expect(prettier.getFileInfo())
      .rejects
      .toThrow(new TypeError("expect `filePath` to be a string, got `undefined`"))
);

this code is from my commit 5c2c2ac

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:needs discussionIssues needing discussion and a decision to be made before action can be taken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions