Skip to content

Invalid indentation: return (foo ? bar1 : bar2).baz() #4976

@thorn0

Description

@thorn0

Prettier 1.14.2
Playground link

--parser babylon
--tab-width 4

Input:

  const decorated = ((arg, ignoreRequestError) => {
      return (
          typeof arg === 'string' ||
          (arg && arg.valueOf && typeof arg.valueOf() === 'string')
              ? $delegate(arg, ignoreRequestError)
              : handleAsyncOperations(arg, ignoreRequestError)
      ).foo();
  });

Output:

const decorated = (arg, ignoreRequestError) => {
    return (typeof arg === "string" ||
    (arg && arg.valueOf && typeof arg.valueOf() === "string")
        ? $delegate(arg, ignoreRequestError)
        : handleAsyncOperations(arg, ignoreRequestError)
    ).foo();
};

Expected behavior:

Correct indentation after return.

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions