Skip to content

Function call in chained calls results in unexpected indentation #2832

Description

@chrisvoll

Prettier 1.7.0
Playground link

I encountered a minor formatting issue with some enzyme code in our test files. Admittedly it's a bit edge-casey, but the combination of chained calls, the prop('x')() function call, and the callback break the indentation.

This issue is new as of upgrading from Prettier 1.5.0 to 1.7.0. Let me know if there are any other details I can provide that will help. Thanks!

Input:

wrapper.find('SomewhatLongNodeName').prop('longPropFunctionName')().then(function() {
  doSomething();
});

Output:

wrapper
  .find("SomewhatLongNodeName")
  .prop("longPropFunctionName")().then(function() {
  doSomething();
});

Expected behavior:

wrapper
  .find("SomewhatLongNodeName")
  .prop("longPropFunctionName")()
  .then(function() {
    doSomething();
  });

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

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions