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
Closed

Function call in chained calls results in unexpected indentation #2832

chrisvoll opened this issue Sep 15, 2017 · 0 comments · Fixed by #2990
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@chrisvoll
Copy link
Contributor

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 Issues identifying ugly output, or a defect in the program label Sep 15, 2017
@azz azz added the lang:javascript Issues affecting JS label Oct 4, 2017
chrisvoll added a commit to chrisvoll/prettier that referenced this issue Oct 7, 2017
@azz azz closed this as completed in #2990 Oct 8, 2017
azz pushed 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 added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 6, 2018
@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.
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants