Skip to content

Multi-line arrow functions #332

@ksmithbaylor

Description

@ksmithbaylor

Currently, when the body of an arrow function that returns an immediate value is split over multiple lines, the second line (the value) is aligned even with the line above:

const someVeryLongIdentifier = (a, b, c) =>
anotherVeryLongExpressionThatWillNotFitOnASingleLineNicely();

nextLine();

In my opinion, it should be indented one level more than the line on which it started, but still allow the following lines to stay at the same level as before:

const someVeryLongIdentifier = (a, b, c) =>
  anotherVeryLongExpressionThatWillNotFitOnASingleLineNicely();

nextLine();

This should also apply to arrow functions defined as function arguments. Current behavior:

someVeryLongIdentifier.getThings().filter(Boolean).map(x =>
                                                       anotherVeryLongExpressionThatWillNotFitOnASingleLineNicely());

                                                       nextLine();

Expected behavior:

someVeryLongIdentifier.getThings().filter(Boolean).map(x =>
  anotherVeryLongExpressionThatWillNotFitOnASingleLineNicely());

nextLine();

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions