Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

feat(rome_js_formatter): Member assignment formatting #3061

Merged
merged 2 commits into from
Aug 16, 2022

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented Aug 15, 2022

This PR improves the formatting of static and computed assignment expressions that Prettier formats the same as static/computed member expressions.

This is done by introducing new JsAnyStaticMemberLike and JsAnyComputedMemberLike union types that implement the common formatting logic.

This PR also fixes the formatting of the special case a[5] to match prettier's formatting.

Test Plan

I manually compared Rome's and Prettier's output before updating the snapshots.

File Based Average Prettier Similarity: 79.75% ->79.91%
Line Based Average Prettier Similarity: 76.52% -> 76.58%

@MichaReiser MichaReiser requested a review from a team August 15, 2022 12:27
@MichaReiser MichaReiser temporarily deployed to aws August 15, 2022 12:27 Inactive
@MichaReiser MichaReiser added the A-Formatter Area: formatter label Aug 15, 2022
@MichaReiser MichaReiser modified the milestones: 0.10.0, 0.9.0 Aug 15, 2022
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 15, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 96f01f5
Status: ✅  Deploy successful!
Preview URL: https://8792e9c0.tools-8rn.pages.dev
Branch Preview URL: https://feat-member-like.tools-8rn.pages.dev

View logs

@github-actions
Copy link

github-actions bot commented Aug 15, 2022

@ematipico
Copy link
Contributor

Could you add the updated metrics to the description please?

@MichaReiser
Copy link
Contributor Author

Could you add the updated metrics to the description please?

Done

@MichaReiser MichaReiser mentioned this pull request Aug 16, 2022
17 tasks
This PR improves the formatting of static member assignment to match the formatting of static member expressions.
This PR improves the formatting of computed member assignment to match the formatting of computed member expressions.
@MichaReiser MichaReiser temporarily deployed to aws August 16, 2022 13:59 Inactive
Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Same as the other PR, could we update/add some test case where mark where we expect a certain layout? Other than that, let's 🚢 it!

@MichaReiser MichaReiser merged commit 85ddb4b into main Aug 16, 2022
@MichaReiser MichaReiser deleted the feat/member-like branch August 16, 2022 15:53
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.
Labels
A-Formatter Area: formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants