Skip to content

Does not respect print width when chaining method call after property #5051

@ghost

Description

Prettier 1.14.2
Playground link

--parser babylon

Input:

async function HelloWorld() {
  const myLongVar: LongTypeDefinition = await CallingObject.thenMethod().anotherObject.anotherMethod();
}

Output:

async function HelloWorld() {
  const myLongVar: LongTypeDefinition = await CallingObject.thenMethod().anotherObject.anotherMethod();
}

Expected behavior:

async function HelloWorld() {
  const myLongVar: LongTypeDefinition = await CallingObject
    .thenMethod()
    .anotherObject
    .anotherMethod();
}

Possibly a duplicate of #2548, but that issue has been open for over a year and have been ignored. Couldn't find a case where people are complaining the chaining from object to method to object is not formatting.

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.type:duplicateIssues that are a duplicate of a previous issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions