Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function call in chained calls results in unexpected indentation #2832

Closed
chrisvoll opened this issue Sep 15, 2017 · 0 comments · Fixed by #2990

Comments

@chrisvoll
Copy link
Contributor

commented Sep 15, 2017

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();
  });
@lydell lydell added the type:bug label Sep 15, 2017
@azz azz added the lang:javascript label Oct 4, 2017
chrisvoll added a commit to chrisvoll/prettier that referenced this issue Oct 7, 2017
@azz azz closed this in #2990 Oct 8, 2017
azz added a commit that referenced this issue Oct 8, 2017
* fix: support sequential CallExpressions in member chains

fixes #2832

* test: add additional test cases for sequential CallExpressions

* test: regenerate method-chain snapshot
@lock lock bot locked as resolved and limited conversation to collaborators Jul 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.