mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(prettier): add parens to new class {} (#1604)
This commit is contained in:
parent
bb61f10399
commit
811b219b27
2 changed files with 10 additions and 3 deletions
|
|
@ -70,7 +70,15 @@ impl<'a> Prettier<'a> {
|
|||
_ => false,
|
||||
}
|
||||
}
|
||||
AstKind::Class(c) if c.is_expression() => self.check_object_function_class(c.span),
|
||||
AstKind::Class(c) if c.is_expression() => {
|
||||
if self.check_object_function_class(c.span) {
|
||||
return true;
|
||||
}
|
||||
if let AstKind::NewExpression(new_expr) = parent_kind {
|
||||
return new_expr.callee.span() == c.span;
|
||||
}
|
||||
false
|
||||
}
|
||||
AstKind::AssignmentExpression(assign_expr) => match parent_kind {
|
||||
AstKind::ArrowExpression(arrow_expr)
|
||||
if arrow_expr
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 215/561 (38.32%)
|
||||
Compatibility: 216/561 (38.50%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -114,7 +114,6 @@ Compatibility: 215/561 (38.32%)
|
|||
* classes/assignment.js
|
||||
* classes/empty.js
|
||||
* classes/method.js
|
||||
* classes/new.js
|
||||
* classes/property.js
|
||||
|
||||
### classes-private-fields
|
||||
|
|
|
|||
Loading…
Reference in a new issue