This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 659
feat(rome_js_formatter): Hug function parameters #2993
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MichaReiser
force-pushed
the
feat/function-parameters
branch
from
August 3, 2022 08:45
088ead9
to
c1721d0
Compare
Deploying with Cloudflare Pages
|
!bench_formatter |
Formatter Benchmark Results
|
ematipico
approved these changes
Aug 3, 2022
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.
No particular concerns, mostly questions and documentation suggestions
MichaReiser
force-pushed
the
feat/function-parameters
branch
from
August 3, 2022 11:47
c1721d0
to
a67dcaa
Compare
Implement the same heuristic as Prettier for grouping parameters with the return type annotation. This ensures that a return type will break FIRST before the parameters and the parameters only break if they don't fit on the same line together with the expanded return type annotation. This PR further unifies the formatting of methods and functions to achieve better code reuse.
MichaReiser
force-pushed
the
feat/function-parameters
branch
from
August 3, 2022 11:48
a67dcaa
to
1e8130d
Compare
IWANABETHATGUY
pushed a commit
to IWANABETHATGUY/tools
that referenced
this pull request
Aug 22, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the heuristic for when we want that the
(
and)
hug the first parameter. This is desired when:(
. This is the case for arrays and object literals OR identifiers where the type annotation is an object typeThis PR further unifies the formatting logic of normal parameters and constructor parameters.
This PR does not implement the special formatting of last argument yet.
Test Plan
I manually reviewed the snapshot changes.
File Based Average Prettier Similarity: 78.10% -> 78.53%
Line Based Average Prettier Similarity: 73.19% -> 74.03%