-
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(js_formatter): don't insert trailing comma on type import statement
- Loading branch information
1 parent
7627ab0
commit d66797e
Showing
20 changed files
with
1,658 additions
and
389 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
crates/biome_js_formatter/src/ts/expressions/import_type_arguments.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::prelude::*; | ||
use biome_js_syntax::{TsImportTypeArguments, TsImportTypeArgumentsFields}; | ||
use biome_formatter::FormatError::SyntaxError; | ||
use biome_formatter::write; | ||
#[derive(Debug, Clone, Default)] | ||
pub(crate) struct FormatTsImportTypeArguments; | ||
impl FormatNodeRule<TsImportTypeArguments> for FormatTsImportTypeArguments { | ||
fn fmt_fields(&self, node: &TsImportTypeArguments, f: &mut JsFormatter) -> FormatResult<()> { | ||
let TsImportTypeArgumentsFields { | ||
l_paren_token, | ||
argument, | ||
comma_token, | ||
ts_import_type_assertion_block, | ||
r_paren_token | ||
} = node.as_fields(); | ||
|
||
|
||
if comma_token.is_some() && ts_import_type_assertion_block.is_some() { | ||
write!(f, [ | ||
l_paren_token.format(), | ||
argument.format(), | ||
comma_token.format(), | ||
ts_import_type_assertion_block.format(), | ||
r_paren_token.format() | ||
]) | ||
} else { | ||
return Err(SyntaxError); | ||
} | ||
} | ||
} |
Oops, something went wrong.