-
Notifications
You must be signed in to change notification settings - Fork 455
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
Smart linebreak printer for pipe chains #6411
Conversation
jscomp/syntax/tests/conversion/reason/expected/fastPipe.res.txt
Outdated
Show resolved
Hide resolved
95ac27b
to
46a8b33
Compare
Found out that it did not break correctly if the newline was before the last pipe (no matter how many pipes there were in total). Fixed now. |
I formatted a big codebase with this change and the only thing that changed were some Hooks like this one: - React.useCallback(
- () =>
- flatListRef.current
- ->Nullable.toOption
- ->Option.forEach(flatList => flatList->FlatList.scrollToOffset({offset: 0.})),
- [],
- )
+ React.useCallback(() =>
+ flatListRef.current
+ ->Nullable.toOption
+ ->Option.forEach(flatList => flatList->FlatList.scrollToOffset({offset: 0.}))
+ , []) However, if you wrapped the former callback body in curly braces it was already formatted like that: React.useCallback(() => {
flatListRef.current
->Nullable.toOption
->Option.forEach(flatList => flatList->FlatList.scrollToOffset({offset: 0.}))
}, []) If this change is ok, the PR is ready to review |
Looks great to me! @cristianoc ? |
Looks great |
@fhammerschmidt fix that merge conflict and then let's merge? This is really worthy of a forum post as well given this is something many have complained about over the years. Great work! ⭐ |
c811622
to
7ac4831
Compare
7ac4831
to
34bc121
Compare
This PR is an alternative to #6387
Fixes #6380