File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
crates/biome_css_formatter/src Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 22" @biomejs/biome " : patch
33---
44
5- Update CSS formatting of dimensions to use correct casing for Q, Hz and kHz
5+ Update CSS formatting of dimension units to use correct casing for Q, Hz and kHz
66
77** Before:**
88
Original file line number Diff line number Diff line change 1- use crate :: { prelude:: * , utils:: string_utils:: FormatDimension } ;
1+ use crate :: { prelude:: * , utils:: string_utils:: FormatDimensionUnit } ;
22use biome_css_syntax:: { CssRegularDimension , CssRegularDimensionFields } ;
33use biome_formatter:: { token:: number:: NumberFormatOptions , write} ;
44
@@ -15,7 +15,7 @@ impl FormatNodeRule<CssRegularDimension> for FormatCssRegularDimension {
1515 f,
1616 [
1717 format_number_token( & value_token?, NumberFormatOptions :: default ( ) ) ,
18- FormatDimension :: from( unit_token?) ,
18+ FormatDimensionUnit :: from( unit_token?) ,
1919 ]
2020 )
2121 }
Original file line number Diff line number Diff line change 11use crate :: {
22 prelude:: * ,
3- utils:: string_utils:: { FormatDimension , FormatTokenAsLowercase } ,
3+ utils:: string_utils:: { FormatDimensionUnit , FormatTokenAsLowercase } ,
44} ;
55use biome_css_syntax:: { CssUnknownDimension , CssUnknownDimensionFields } ;
66use biome_formatter:: write;
@@ -18,7 +18,7 @@ impl FormatNodeRule<CssUnknownDimension> for FormatCssUnknownDimension {
1818 f,
1919 [
2020 FormatTokenAsLowercase :: from( value_token?) ,
21- FormatDimension :: from( unit_token?) ,
21+ FormatDimensionUnit :: from( unit_token?) ,
2222 ]
2323 ) ;
2424 var_name
Original file line number Diff line number Diff line change @@ -297,17 +297,17 @@ impl<'token> LiteralStringNormaliser<'token> {
297297 }
298298}
299299
300- pub ( crate ) struct FormatDimension {
300+ pub ( crate ) struct FormatDimensionUnit {
301301 token : SyntaxToken < CssLanguage > ,
302302}
303303
304- impl From < SyntaxToken < CssLanguage > > for FormatDimension {
304+ impl From < SyntaxToken < CssLanguage > > for FormatDimensionUnit {
305305 fn from ( value : SyntaxToken < CssLanguage > ) -> Self {
306306 Self { token : value }
307307 }
308308}
309309
310- impl Format < CssFormatContext > for FormatDimension {
310+ impl Format < CssFormatContext > for FormatDimensionUnit {
311311 fn fmt ( & self , f : & mut CssFormatter ) -> FormatResult < ( ) > {
312312 let original = self . token . text_trimmed ( ) ;
313313 match original. to_ascii_lowercase_cow ( ) {
@@ -318,7 +318,7 @@ impl Format<CssFormatContext> for FormatDimension {
318318 [ format_replaced(
319319 & self . token,
320320 & text(
321- // Most CSS dimensions can be formatted as lower case, but there are
321+ // Most CSS dimension units can be formatted as lower case, but there are
322322 // a few that are more commonly formatted with some uppercase characters.
323323 // This maps those few cases to the correct casing. This matches the
324324 // behavior of the Prettier formatter.
You can’t perform that action at this time.
0 commit comments