Skip to content

Commit

Permalink
refactor(js_parser): parser TsImportType align with TypeScript Parser (
Browse files Browse the repository at this point in the history
  • Loading branch information
fireairforce authored Nov 8, 2024
1 parent 27b93c2 commit d0faaf4
Show file tree
Hide file tree
Showing 30 changed files with 2,187 additions and 410 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
### Bug fixes

- Fix [#4121](https://github.com/biomejs/biome/issues/4326), don't ident a CSS selector when has leading comments. Contributed by @fireairforce
- Fix [#4334](https://github.com/biomejs/biome/issues/4334), don't insert trailing comma on type import statement. Contributed by @fireairforce

### JavaScript APIs

Expand Down
82 changes: 80 additions & 2 deletions crates/biome_js_factory/src/generated/node_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 128 additions & 1 deletion crates/biome_js_factory/src/generated/syntax_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions crates/biome_js_formatter/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7809,6 +7809,120 @@ impl IntoFormat<JsFormatContext> for biome_js_syntax::TsImportType {
)
}
}
impl FormatRule<biome_js_syntax::TsImportTypeArguments>
for crate::ts::expressions::import_type_arguments::FormatTsImportTypeArguments
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &biome_js_syntax::TsImportTypeArguments,
f: &mut JsFormatter,
) -> FormatResult<()> {
FormatNodeRule::<biome_js_syntax::TsImportTypeArguments>::fmt(self, node, f)
}
}
impl AsFormat<JsFormatContext> for biome_js_syntax::TsImportTypeArguments {
type Format<'a> = FormatRefWithRule<
'a,
biome_js_syntax::TsImportTypeArguments,
crate::ts::expressions::import_type_arguments::FormatTsImportTypeArguments,
>;
fn format(&self) -> Self::Format<'_> {
#![allow(clippy::default_constructed_unit_structs)]
FormatRefWithRule::new(
self,
crate::ts::expressions::import_type_arguments::FormatTsImportTypeArguments::default(),
)
}
}
impl IntoFormat<JsFormatContext> for biome_js_syntax::TsImportTypeArguments {
type Format = FormatOwnedWithRule<
biome_js_syntax::TsImportTypeArguments,
crate::ts::expressions::import_type_arguments::FormatTsImportTypeArguments,
>;
fn into_format(self) -> Self::Format {
#![allow(clippy::default_constructed_unit_structs)]
FormatOwnedWithRule::new(
self,
crate::ts::expressions::import_type_arguments::FormatTsImportTypeArguments::default(),
)
}
}
impl FormatRule<biome_js_syntax::TsImportTypeAssertion>
for crate::ts::module::import_type_assertion::FormatTsImportTypeAssertion
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &biome_js_syntax::TsImportTypeAssertion,
f: &mut JsFormatter,
) -> FormatResult<()> {
FormatNodeRule::<biome_js_syntax::TsImportTypeAssertion>::fmt(self, node, f)
}
}
impl AsFormat<JsFormatContext> for biome_js_syntax::TsImportTypeAssertion {
type Format<'a> = FormatRefWithRule<
'a,
biome_js_syntax::TsImportTypeAssertion,
crate::ts::module::import_type_assertion::FormatTsImportTypeAssertion,
>;
fn format(&self) -> Self::Format<'_> {
#![allow(clippy::default_constructed_unit_structs)]
FormatRefWithRule::new(
self,
crate::ts::module::import_type_assertion::FormatTsImportTypeAssertion::default(),
)
}
}
impl IntoFormat<JsFormatContext> for biome_js_syntax::TsImportTypeAssertion {
type Format = FormatOwnedWithRule<
biome_js_syntax::TsImportTypeAssertion,
crate::ts::module::import_type_assertion::FormatTsImportTypeAssertion,
>;
fn into_format(self) -> Self::Format {
#![allow(clippy::default_constructed_unit_structs)]
FormatOwnedWithRule::new(
self,
crate::ts::module::import_type_assertion::FormatTsImportTypeAssertion::default(),
)
}
}
impl FormatRule<biome_js_syntax::TsImportTypeAssertionBlock>
for crate::ts::module::import_type_assertion_block::FormatTsImportTypeAssertionBlock
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &biome_js_syntax::TsImportTypeAssertionBlock,
f: &mut JsFormatter,
) -> FormatResult<()> {
FormatNodeRule::<biome_js_syntax::TsImportTypeAssertionBlock>::fmt(self, node, f)
}
}
impl AsFormat<JsFormatContext> for biome_js_syntax::TsImportTypeAssertionBlock {
type Format<'a> = FormatRefWithRule<
'a,
biome_js_syntax::TsImportTypeAssertionBlock,
crate::ts::module::import_type_assertion_block::FormatTsImportTypeAssertionBlock,
>;
fn format(&self) -> Self::Format<'_> {
#![allow(clippy::default_constructed_unit_structs)]
FormatRefWithRule :: new (self , crate :: ts :: module :: import_type_assertion_block :: FormatTsImportTypeAssertionBlock :: default ())
}
}
impl IntoFormat<JsFormatContext> for biome_js_syntax::TsImportTypeAssertionBlock {
type Format = FormatOwnedWithRule<
biome_js_syntax::TsImportTypeAssertionBlock,
crate::ts::module::import_type_assertion_block::FormatTsImportTypeAssertionBlock,
>;
fn into_format(self) -> Self::Format {
#![allow(clippy::default_constructed_unit_structs)]
FormatOwnedWithRule :: new (self , crate :: ts :: module :: import_type_assertion_block :: FormatTsImportTypeAssertionBlock :: default ())
}
}
impl FormatRule<biome_js_syntax::TsImportTypeQualifier>
for crate::ts::module::import_type_qualifier::FormatTsImportTypeQualifier
{
Expand Down
Loading

0 comments on commit d0faaf4

Please sign in to comment.