From fd80269cbe414e07139e4b9ce2c0a8899f6c29e7 Mon Sep 17 00:00:00 2001 From: mdm317 Date: Sun, 6 Oct 2024 14:35:50 +0900 Subject: [PATCH 1/3] fix: space to hardspace --- crates/biome_js_formatter/src/utils/format_class.rs | 2 +- .../tests/specs/ts/class/implements_clause.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/biome_js_formatter/src/utils/format_class.rs b/crates/biome_js_formatter/src/utils/format_class.rs index 94e8cba631e6..9a9574b7801c 100644 --- a/crates/biome_js_formatter/src/utils/format_class.rs +++ b/crates/biome_js_formatter/src/utils/format_class.rs @@ -133,7 +133,7 @@ impl Format for FormatClass<'_> { let heritage_id = f.group_id("heritageGroup"); write!( f, - [group(&indented).with_group_id(Some(heritage_id)), space()] + [group(&indented).with_group_id(Some(heritage_id)), hard_space()] )?; if !members.is_empty() { diff --git a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts index c924a49380a4..8d055149bc6c 100644 --- a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts +++ b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts @@ -1,3 +1,7 @@ class ClassName implements Interface { } -class LongClassName implements Interface1, Interface2, Interface3, Interface4, Interface5 { } \ No newline at end of file +class LongClassName implements Interface1, Interface2, Interface3, Interface4, Interface5 { } + +class LongClassName implements InterfaceNameLengthIsSixtySevenCharactersssssssssssssssssssssssssss { + constructer(){} + } \ No newline at end of file From 6d5184c0e9a523be7c00e8abe1f2191dfbe9feb8 Mon Sep 17 00:00:00 2001 From: mdm317 Date: Sun, 6 Oct 2024 14:50:26 +0900 Subject: [PATCH 2/3] test: add test case --- .../tests/specs/ts/class/implements_clause.ts | 4 ++++ .../specs/ts/class/implements_clause.ts.snap | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts index 8d055149bc6c..6717cd0ae715 100644 --- a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts +++ b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts @@ -2,6 +2,10 @@ class ClassName implements Interface { } class LongClassName implements Interface1, Interface2, Interface3, Interface4, Interface5 { } +class LongClassName implements InterfaceNameLengthIsSixtySixCharacterssssssssssssssssssssssssssss { + constructer(){} + } + class LongClassName implements InterfaceNameLengthIsSixtySevenCharactersssssssssssssssssssssssssss { constructer(){} } \ No newline at end of file diff --git a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap index 17f9135e08a0..66793f60a520 100644 --- a/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap +++ b/crates/biome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap @@ -8,6 +8,14 @@ info: ts/class/implements_clause.ts class ClassName implements Interface { } class LongClassName implements Interface1, Interface2, Interface3, Interface4, Interface5 { } + +class LongClassName implements InterfaceNameLengthIsSixtySixCharacterssssssssssssssssssssssssssss { + constructer(){} + } + +class LongClassName implements InterfaceNameLengthIsSixtySevenCharactersssssssssssssssssssssssssss { + constructer(){} + } ``` @@ -38,4 +46,17 @@ class ClassName implements Interface {} class LongClassName implements Interface1, Interface2, Interface3, Interface4, Interface5 {} + +class LongClassName + implements InterfaceNameLengthIsSixtySixCharacterssssssssssssssssssssssssssss +{ + constructer() {} +} + +class LongClassName + implements + InterfaceNameLengthIsSixtySevenCharactersssssssssssssssssssssssssss +{ + constructer() {} +} ``` From 035bd4040a55c26df1da29df595103afa0b96b6e Mon Sep 17 00:00:00 2001 From: mdm317 Date: Sun, 6 Oct 2024 14:54:14 +0900 Subject: [PATCH 3/3] refactor: format --- crates/biome_js_formatter/src/utils/format_class.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/biome_js_formatter/src/utils/format_class.rs b/crates/biome_js_formatter/src/utils/format_class.rs index 9a9574b7801c..f7a56f315117 100644 --- a/crates/biome_js_formatter/src/utils/format_class.rs +++ b/crates/biome_js_formatter/src/utils/format_class.rs @@ -133,7 +133,10 @@ impl Format for FormatClass<'_> { let heritage_id = f.group_id("heritageGroup"); write!( f, - [group(&indented).with_group_id(Some(heritage_id)), hard_space()] + [ + group(&indented).with_group_id(Some(heritage_id)), + hard_space() + ] )?; if !members.is_empty() {