Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(js_parser): parser TsImportType align with TypeScript Parser #4454

Merged
merged 6 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading