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

fix(formatter): incompatibility for class and implements #4183

Closed
wants to merge 3 commits into from
Closed
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
5 changes: 4 additions & 1 deletion crates/biome_js_formatter/src/utils/format_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ impl Format<JsFormatContext> 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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
class ClassName implements Interface { }

class LongClassName implements Interface1, Interface2, Interface3, Interface4, Interface5 { }
class LongClassName implements Interface1, Interface2, Interface3, Interface4, Interface5 { }

class LongClassName implements InterfaceNameLengthIsSixtySixCharacterssssssssssssssssssssssssssss {
constructer(){}
}

class LongClassName implements InterfaceNameLengthIsSixtySevenCharactersssssssssssssssssssssssssss {
constructer(){}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(){}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: typo

}

class LongClassName implements InterfaceNameLengthIsSixtySevenCharactersssssssssssssssssssssssssss {
constructer(){}
}
```


Expand Down Expand Up @@ -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() {}
}
```