Skip to content

Fix comma when an arrow function with no arguments breaks - #210

Merged
jlongster merged 1 commit into
prettier:masterfrom
vjeux:no_arrow
Jan 15, 2017
Merged

jlongster merged 1 commit into
prettier:masterfrom
vjeux:no_arrow

Conversation

@vjeux

@vjeux vjeux commented Jan 15, 2017

Copy link
Copy Markdown
Contributor

Fixes #118

Comment thread src/printer.js

return concat([
"(",
indent(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also tried adding printed.length > 0 && next to options.trailingComma, which is the correct, fix but it doesn't look really good.

veryLongCall(VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT, (

) =>
  {});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, this is the easiest thing to do! The representation below can't completely collapse in this case because it wants to break across lines. But because we can statically analyze this and easily know we never want to break up the parens your solution is correct.

Comment thread src/printer.js

return concat([
"(",
indent(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, this is the easiest thing to do! The representation below can't completely collapse in this case because it wants to break across lines. But because we can statically analyze this and easily know we never want to break up the parens your solution is correct.

@jlongster
jlongster merged commit b9d2d1a into prettier:master Jan 15, 2017
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 21, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 21, 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.

2 participants