mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
fix(prettier) print computed object property key correctly (#1599)
This commit is contained in:
parent
0134211b6f
commit
66452c95f5
2 changed files with 6 additions and 4 deletions
|
|
@ -1475,7 +1475,11 @@ impl<'a> Format<'a> for ObjectProperty<'a> {
|
|||
return self.value.format(p);
|
||||
}
|
||||
|
||||
let left_doc = format!(p, self.key);
|
||||
let left_doc = if self.computed {
|
||||
array!(p, ss!("["), format!(p, self.key), ss!("]"))
|
||||
} else {
|
||||
format!(p, self.key)
|
||||
};
|
||||
|
||||
assignment::print_assignment(
|
||||
p,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 210/561 (37.43%)
|
||||
Compatibility: 212/561 (37.79%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -366,7 +366,6 @@ Compatibility: 210/561 (37.43%)
|
|||
* objects/right-break.js
|
||||
|
||||
### objects/assignment-expression
|
||||
* objects/assignment-expression/object-property.js
|
||||
* objects/assignment-expression/object-value.js
|
||||
|
||||
### optional-chaining
|
||||
|
|
@ -402,7 +401,6 @@ Compatibility: 210/561 (37.43%)
|
|||
### quote-props
|
||||
* quote-props/numeric-separator.js
|
||||
* quote-props/objects.js
|
||||
* quote-props/with_member_expressions.js
|
||||
|
||||
### quotes
|
||||
* quotes/objects.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue