mirror of
https://github.com/danbulant/oxc
synced 2026-05-22 05:38:54 +00:00
fix(prettier): semi colon after class property (#2387)
This commit is contained in:
parent
0df7e296f9
commit
871a73afdd
3 changed files with 11 additions and 2 deletions
|
|
@ -2000,6 +2000,15 @@ impl<'a> ClassElement<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_property(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::PropertyDefinition(_)
|
||||
| Self::AccessorProperty(_)
|
||||
| Self::TSAbstractPropertyDefinition(_)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_ts_empty_body_function(&self) -> bool {
|
||||
match self {
|
||||
Self::PropertyDefinition(_)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ pub(super) fn print_class_body<'a>(p: &mut Prettier<'a>, class_body: &ClassBody<
|
|||
parts_inner.push(node.format(p));
|
||||
|
||||
if !p.options.semi
|
||||
&& node.is_property()
|
||||
&& should_print_semicolon_after_class_property(node, class_body.body.get(i + 1))
|
||||
{
|
||||
parts_inner.push(ss!(";"));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 239/562 (42.53%)
|
||||
Compatibility: 240/562 (42.70%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -107,7 +107,6 @@ Compatibility: 239/562 (42.53%)
|
|||
* classes/property.js
|
||||
|
||||
### classes-private-fields
|
||||
* classes-private-fields/private_fields.js
|
||||
* classes-private-fields/with_comments.js
|
||||
|
||||
### comments
|
||||
|
|
|
|||
Loading…
Reference in a new issue