mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(prettier): should be newline if break in AssigmentExpression (#1484)
This commit is contained in:
parent
332ed81e1e
commit
f1874c7955
3 changed files with 5 additions and 10 deletions
|
|
@ -30,7 +30,7 @@ use oxc_span::{GetSpan, Span};
|
|||
use crate::{
|
||||
array,
|
||||
doc::{Doc, Group, Separator},
|
||||
format, group, hardline, indent, line, softline, ss, string, wrap, Prettier,
|
||||
format, group, hardline, indent, indent_if_break, line, softline, ss, string, wrap, Prettier,
|
||||
};
|
||||
|
||||
use self::{
|
||||
|
|
@ -1557,13 +1557,12 @@ impl<'a> Format<'a> for ConditionalExpression<'a> {
|
|||
impl<'a> Format<'a> for AssignmentExpression<'a> {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
wrap!(p, self, AssignmentExpression, {
|
||||
array![
|
||||
group![
|
||||
p,
|
||||
format!(p, self.left),
|
||||
ss!(" "),
|
||||
string!(p, self.operator.as_str()),
|
||||
ss!(" "),
|
||||
format!(p, self.right)
|
||||
indent_if_break!(p, line!(), format!(p, self.right))
|
||||
]
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ impl<'a> Printer<'a> {
|
|||
}
|
||||
Mode::Break => {
|
||||
self.cmds.extend(docs.into_iter().rev().map(|doc| {
|
||||
Command::new(Indent { length: indent.length + 1 }, Mode::Flat, doc)
|
||||
Command::new(Indent { length: indent.length + 1 }, Mode::Break, doc)
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 134/601 (22.30%)
|
||||
Compatibility: 138/601 (22.96%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -61,10 +61,8 @@ Compatibility: 134/601 (22.30%)
|
|||
* assignment/destructuring.js
|
||||
* assignment/discussion-15196.js
|
||||
* assignment/issue-10218.js
|
||||
* assignment/issue-1419.js
|
||||
* assignment/issue-15534.js
|
||||
* assignment/issue-1966.js
|
||||
* assignment/issue-2482-1.js
|
||||
* assignment/issue-2482-2.js
|
||||
* assignment/issue-2540.js
|
||||
* assignment/issue-3819.js
|
||||
|
|
@ -73,7 +71,6 @@ Compatibility: 134/601 (22.30%)
|
|||
* assignment/issue-6922.js
|
||||
* assignment/issue-7091.js
|
||||
* assignment/issue-7572.js
|
||||
* assignment/issue-7961.js
|
||||
* assignment/issue-8218.js
|
||||
* assignment/lone-arg.js
|
||||
* assignment/sequence.js
|
||||
|
|
@ -664,7 +661,6 @@ Compatibility: 134/601 (22.30%)
|
|||
|
||||
### variable_declarator
|
||||
* variable_declarator/multiple.js
|
||||
* variable_declarator/string.js
|
||||
|
||||
### while
|
||||
* while/indent.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue