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

refactor(rome_js_formatter): Remove format_root from Formatter #2478

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

MichaReiser
Copy link
Contributor

This PR removes the format_root method from the Formatter so that it can be used to format any value implementing Format.

  • Rename existing format_node method to format_sub_tree
  • Move FormatError and FormatResult to rome_formatter
  • Rename Formatted to Printed
  • format_node to reduce Formatted which is the formatted IR that hasn't been printed. Can be printed by calling print
  • Formatted replaces to_format_element
  • Introduce new format method to format any type implementing Format

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 21, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6c20b1f
Status: ✅  Deploy successful!
Preview URL: https://580fa2f4.tools-8rn.pages.dev

View logs

Base automatically changed from refactor/format-node to main April 21, 2022 16:03
This PR removes the `format_root` method from the `Formatter` so that it can be used to format any value implementing `Format`.

* Rename existing `format_node` method to `format_sub_tree`
* Move `FormatError` and `FormatResult` to `rome_formatter`
* Rename `Formatted` to `Printed`
* `format_node` to reduce `Formatted` which is the formatted IR that hasn't been printed. Can be printed by calling `print`
* `Formatted` replaces `to_format_element`
* Introduce new `format` method to format any type implementing `Format`
@MichaReiser MichaReiser temporarily deployed to aws April 21, 2022 16:14 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%

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 12391 12391 0
Failed 3866 3866 0
Panics 0 0 0
Coverage 76.22% 76.22% 0.00%

@github-actions
Copy link

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.

I think the quantity of changes can be drastically reduced by keeping the majority of use create:: and by re-exporting FormatResult and FormatError inside rome_js_formatter::lib

@MichaReiser MichaReiser merged commit db61c4b into main Apr 22, 2022
@MichaReiser MichaReiser deleted the refactor/format-root branch April 22, 2022 11:29
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.

3 participants