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

feature(rome_js_formatter): Static Member Expression formatting #2727

Merged
merged 2 commits into from
Jun 23, 2022

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented Jun 17, 2022

Summary

This PR improves the grouping of static member expressions (does not yet include computed members) by choosing the best layout for a given assignment.

Test Plan

cargo test

There's one failing test because of an instability in the comments formatting

@MichaReiser MichaReiser linked an issue Jun 17, 2022 that may be closed by this pull request
@MichaReiser MichaReiser force-pushed the feature/format-static-member-expression branch from 05135f3 to c2c9890 Compare June 20, 2022 06:27
@cloudflare-pages
Copy link

cloudflare-pages bot commented Jun 20, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 89f616e
Status: ✅  Deploy successful!
Preview URL: https://d21071e3.tools-8rn.pages.dev
Branch Preview URL: https://feature-format-static-member.tools-8rn.pages.dev

View logs

@MichaReiser MichaReiser temporarily deployed to aws June 20, 2022 06:27 Inactive
@MichaReiser MichaReiser force-pushed the feature/format-static-member-expression branch from c2c9890 to 1d596c4 Compare June 20, 2022 06:28
@MichaReiser MichaReiser temporarily deployed to aws June 20, 2022 06:28 Inactive
@github-actions
Copy link

github-actions bot commented Jun 20, 2022

@github-actions
Copy link

github-actions bot commented Jun 20, 2022

Parser conformance results on ubuntu-latest

js/262

Test result main count This PR count Difference
Total 45878 45878 0
Passed 44938 44938 0
Failed 940 940 0
Panics 0 0 0
Coverage 97.95% 97.95% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 39 39 0
Passed 36 36 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.31% 92.31% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5946 5946 0
Passed 388 388 0
Failed 5558 5558 0
Panics 0 0 0
Coverage 6.53% 6.53% 0.00%

ts/babel

Test result main count This PR count Difference
Total 588 588 0
Passed 519 519 0
Failed 69 69 0
Panics 0 0 0
Coverage 88.27% 88.27% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 16257 16257 0
Passed 12393 12393 0
Failed 3864 3864 0
Panics 0 0 0
Coverage 76.23% 76.23% 0.00%

@@ -107,11 +106,7 @@ const composition = (ViewComponent, ContainerComponent) =>

romise.then(
(result) =>
result.veryLongVariable.veryLongPropertyName > someOtherVariable ? "ok" : "fail",
result.veryLongVariable
.veryLongPropertyName > someOtherVariable ? "ok" : "fail",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This formatting doesn't yet match Prettier's because Rome formats conditional expressions differently. Same for all other tests that involve conditional expressions.

this.dummy.type8.dummyPropertyFunction = () => {
return "dummy";
};
this.dummy.type1.dummyPropertyFunction = this.dummy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rome's assignment like expression formatting differs from Prettier's

@MichaReiser MichaReiser force-pushed the feature/format-static-member-expression branch from 1d596c4 to 9cf4b36 Compare June 21, 2022 06:30
@MichaReiser MichaReiser temporarily deployed to aws June 21, 2022 06:31 Inactive
@MichaReiser MichaReiser force-pushed the feature/format-static-member-expression branch from 9cf4b36 to 89f616e Compare June 23, 2022 11:44
@MichaReiser MichaReiser temporarily deployed to aws June 23, 2022 11:44 Inactive
@MichaReiser MichaReiser marked this pull request as ready for review June 23, 2022 11:57
@MichaReiser MichaReiser merged commit ffe1f92 into main Jun 23, 2022
@MichaReiser MichaReiser deleted the feature/format-static-member-expression branch June 23, 2022 12:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Static member expressions
2 participants