Skip to content

Leave one-line functions alone #4125

@RyanZim

Description

@RyanZim

Prettier 1.10.2
Playground link

--arrow-parens always

Input:

const sha256 = (data) => crypto.createHash("sha256").update(data).digest("hex");

Output:

const sha256 = (data) =>
  crypto
    .createHash("sha256")
    .update(data)
    .digest("hex");

Expected behavior:

The input was perfectly fine as it stood; it was a nice one-liner, exactly 80 characters long. Breaking it into multiple lines just makes it less clear. Is there a specific reason prettier behaves this way?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions