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

feature(rome_js_formatter): Class formatting (including heritage) #2742

Merged
merged 2 commits into from
Jun 20, 2022

Conversation

MichaReiser
Copy link
Contributor

This PR brings Rome's class formatting closer to Prettier's.

Test

Manually verified the output of each updated snapshot test with prettier's to make sure they match (except for comment positioning)

Before:
File Based Average Prettier Similarity: 74.79%
Line Based Average Prettier Similarity: 69.89%

After:

File Based Average Prettier Similarity: 74.99%
Line Based Average Prettier Similarity: 70.40%

Summary

@MichaReiser MichaReiser temporarily deployed to aws June 20, 2022 15:03 Inactive
This PR brings Rome's class formatting closer to Prettier's.

## Test

Manually verified the output of each updated snapshot test with prettier's to make sure they match (except for comment positioning)
@MichaReiser MichaReiser temporarily deployed to aws June 20, 2022 15:06 Inactive
@github-actions
Copy link

github-actions bot commented Jun 20, 2022

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jun 20, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 41f5963
Status: ✅  Deploy successful!
Preview URL: https://5af011da.tools-8rn.pages.dev
Branch Preview URL: https://feat-format-class.tools-8rn.pages.dev

View logs

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.

It looks good to me! Would you mind adding new test cases to cover in our test suite?

@MichaReiser
Copy link
Contributor Author

It looks good to me! Would you mind adding new test cases to cover in our test suite?

I'm not sure how much value they bring because the prettier test suite already covers them well. I would literally end up copy pasting the test cases from prettier to ours and I believe that this only ends up generating noise.

@ematipico
Copy link
Contributor

It looks good to me! Would you mind adding new test cases to cover in our test suite?

I'm not sure how much value they bring because the prettier test suite already covers them well. I would literally end up copy pasting the test cases from prettier to ours and I believe that this only ends up generating noise.

Simply because one day in the future we might want to rely on our test suite because we don't want to follow prettier anymore. And if that happens (it will for many things), having our test suites is more reliable, and we cover us from possible regressions.

@MichaReiser
Copy link
Contributor Author

It looks good to me! Would you mind adding new test cases to cover in our test suite?

I'm not sure how much value they bring because the prettier test suite already covers them well. I would literally end up copy pasting the test cases from prettier to ours and I believe that this only ends up generating noise.

Simply because one day in the future we might want to rely on our test suite because we don't want to follow prettier anymore. And if that happens (it will for many things), having our test suites is more reliable, and we cover us from possible regressions.

I can see how we ultimately want to have our own tests but I would I would recommend to move all Prettier tests into our test suite if that moment comes or we risk to loose test coverage.

To remove special handling in formatter code gen
@MichaReiser MichaReiser temporarily deployed to aws June 20, 2022 16:37 Inactive
@github-actions
Copy link

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 350 350 0
Failed 5596 5596 0
Panics 0 0 0
Coverage 5.89% 5.89% 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%

@MichaReiser MichaReiser merged commit 48b03ff into main Jun 20, 2022
@MichaReiser MichaReiser deleted the feat/format-class branch June 20, 2022 16:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants