Fix formatting for AssignmentExpression with ClassExpression (#9741)
* Fix formatting for asignment with superClass * Add tests * Changelog * For only AssignmentExpression * Remove unnecesary ifBreak
This commit is contained in:
1 parent
4f330f0a78
commit
3208b948fc
4 files changed
+53
-10
No files matched your search
@@ -131,13 +131,13 @@ function printList(path, options, print, listName) {
|
||||
function printSuperClass(path, options, print) {
|
||||
const printed = path.call(print, "superClass");
|
||||
const parent = path.getParentNode();
|
||||
if (parent && parent.type === "AssignmentExpression") {
|
||||
return concat([
|
||||
ifBreak("("),
|
||||
indent(concat([softline, printed])),
|
||||
softline,
|
||||
ifBreak(")"),
|
||||
]);
|
||||
if (parent.type === "AssignmentExpression") {
|
||||
return group(
|
||||
ifBreak(
|
||||
concat(["(", indent(concat([softline, printed])), softline, ")"]),
|
||||
printed
|
||||
)
|
||||
);
|
||||
}
|
||||
return printed;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user