Skip to content

fix: support sequential CallExpressions in member chains#2990

Merged
azz merged 3 commits into
prettier:masterfrom
chrisvoll:cv-chain-function-2832
Oct 8, 2017
Merged

fix: support sequential CallExpressions in member chains#2990
azz merged 3 commits into
prettier:masterfrom
chrisvoll:cv-chain-function-2832

Conversation

@chrisvoll
Copy link
Copy Markdown
Contributor

fixes #2832

This PR fixes the formatting for this input:

Input:

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

Before:

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

After:

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

This is my first PR for Prettier, so I'm more than happy to make any adjustments as needed. Thanks!

Copy link
Copy Markdown
Member

@azz azz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Could we add one or two tests for when the second function call has arguments?

@chrisvoll
Copy link
Copy Markdown
Contributor Author

@azz will do, thanks for reviewing!

Copy link
Copy Markdown
Member

@azz azz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@azz azz merged commit 4a6b61a into prettier:master Oct 8, 2017
@chrisvoll chrisvoll deleted the cv-chain-function-2832 branch October 9, 2017 21:08
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 19, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function call in chained calls results in unexpected indentation

2 participants