-
Notifications
You must be signed in to change notification settings - Fork 429
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
Make identifier lambdas parenless #1692
Conversation
Summary: Test Plan: Reviewers: CC:
Summary: Stop printing unneeded parens around single identifier lambdas. This brings us closer to compatibility with the JS convention. Test Plan: Reviewers: CC:
@@ -19,42 +19,42 @@ fff >>= xx(yy) >>= aa(bb); | |||
fff >>= (xx(yy) >>= aa(bb)); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glennsl This is the kind of stuff this diff cleans up.
@@ -205,7 +205,7 @@ let selfClosing3 = | |||
b="cause the entire thing to wrap" | |||
/>; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And jsx callback arguments.
@@ -1084,7 +1084,7 @@ let server = { | |||
) | |||
) | |||
>>= ( | |||
(body) => | |||
body => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm forgot this case in the callback PR.
The body =>
should dock on the same line as >>= (
, shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure - printing these have bigger issues - like knowing when exactly we can omit the parens. We're fairly certain that determining when the () can be omitted is such a hard problem that it requires integration with the parser.
This partially addresses the issue that @bobzhang and @glennsl brought up about the new syntax having too many parens. I tried formatting a large project and noticed that the most jarring use of parens was:
We can't really remove the parens around record arguments to lambdas at the moment because then it opens up this precedent which we cannot uphold for tuples.
But still, single identifier lambda arguments were the biggest offender of paren-fatigue in my example project.
cc @IwanKaramazow @chenglou @rickyvetter