Skip to content

Force break if comment in return argument - #3665

Merged
j-f1 merged 2 commits into
prettier:masterfrom
duailibe:return-comment
Jan 31, 2018
Merged

j-f1 merged 2 commits into
prettier:masterfrom
duailibe:return-comment

Conversation

@duailibe

@duailibe duailibe commented Jan 7, 2018

Copy link
Copy Markdown
Collaborator

This one was kind of tricky, I'm still not sure why it was breaking in (function () { /* code */ }) but not fn(function() { /* code */ });. Either way, if there's a comment in a return argument it probably requires a hardline, instead of a softline/line. Apparently, there weren't any specific tests relying on the softline/line so I guess this should be ok?

Fixes #3648

@azz

azz commented Jan 7, 2018 •

Copy link
Copy Markdown
Member

Could you add another test case for

function x() {
  return func2
      //comment
      .bar();
};

@duailibe

duailibe commented Jan 8, 2018

Copy link
Copy Markdown
Collaborator Author

done!

@duailibe

duailibe commented Jan 8, 2018 •

Copy link
Copy Markdown
Collaborator Author

Now I don't think this is the correct fix...

This shouldn't have parens, right?

function x() {
  return func2
      //comment
      .bar();
};

@duailibe

duailibe commented Jan 8, 2018 •

Copy link
Copy Markdown
Collaborator Author

Looks like the above is already the expected output of prettier... we should probably go forward with this fix then

@j-f1
j-f1 merged commit aac38fc into prettier:master Jan 31, 2018
@duailibe
duailibe deleted the return-comment branch February 20, 2018 15:29
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 18, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 18, 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.

3 participants