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

feat(rome_formatter): format export syntax #2008

Merged
merged 11 commits into from
Feb 1, 2022

Conversation

ematipico
Copy link
Contributor

@ematipico ematipico commented Jan 26, 2022

Summary

This PR is part of #1996

It implements the formatting of export ... syntax.

Test Plan

New tests to cover the majority of cases

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 26, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: ff5afa2
Status: ✅  Deploy successful!
Preview URL: https://5d7d3723.tools-8rn.pages.dev

View logs

@ematipico ematipico force-pushed the feature/format-import-export branch from d0d3997 to 939dde6 Compare January 28, 2022 09:06
@ematipico ematipico changed the title feat(rome_formatter): initial formatting of module feat(rome_formatter): format export syntax Jan 28, 2022
@ematipico ematipico force-pushed the feature/format-import-export branch 5 times, most recently from 726243d to ed1bcd7 Compare January 31, 2022 11:42
Base automatically changed from feature/format-import-export to main January 31, 2022 14:15
@ematipico ematipico force-pushed the feature/format-export-syntax branch 2 times, most recently from 65a5c7e to 899ec72 Compare January 31, 2022 14:47
@ematipico ematipico marked this pull request as ready for review January 31, 2022 14:51
@github-actions
Copy link

github-actions bot commented Jan 31, 2022

Parser conformance results on ubuntu-latest

TS

Test result main count This PR count Difference
Total 15976 15976 0
Passed 10473 10473 0
Failed 4153 4153 0
Panics 1350 1350 0
Coverage 65.55% 65.55% 0.00%

T262

Test result main count This PR count Difference
Total 45250 45250 0
Passed 44130 44130 0
Failed 1120 1120 0
Panics 0 0 0
Coverage 97.52% 97.52% 0.00%

@MichaReiser MichaReiser removed their request for review January 31, 2022 15:02
Comment on lines +10 to +14
let semicolon = if let Some(semicolon) = &self.semicolon_token() {
formatter.format_token(semicolon)?
} else {
token(";")
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Should there be a helper for this common use case? If there isn't one already (CC: @leops )

Copy link
Contributor

Choose a reason for hiding this comment

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

It could have been written as formatter.format_token(&self.semicolon_token()).unwrap_or_else(|| token(";")) but that's being deprecated in #2012 in favor of self.semicolon_token().format_or(formatter, || token(";"))

@ematipico ematipico force-pushed the feature/format-export-syntax branch from c19a3fd to ff5afa2 Compare February 1, 2022 08:51
@ematipico ematipico requested a review from leops February 1, 2022 10:18
@ematipico ematipico merged commit 8db8e13 into main Feb 1, 2022
@ematipico ematipico deleted the feature/format-export-syntax branch February 1, 2022 11:06
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