Whitelist UnaryExpression for parentless objects (#545)
It seems like unary are unlikely to need parenthesis Fixes #542master
parent
e56fd38604
commit
b6c9e42705
|
@ -2665,7 +2665,8 @@ function shouldPrintSameLine(node) {
|
|||
type === "ObjectPattern" ||
|
||||
type === "StringLiteral" ||
|
||||
type === "ThisExpression" ||
|
||||
type === "TypeCastExpression";
|
||||
type === "TypeCastExpression" ||
|
||||
type === "UnaryExpression";
|
||||
}
|
||||
|
||||
function printAstToDoc(ast, options) {
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
exports[`test object.js 1`] = `
|
||||
"state = {
|
||||
// students
|
||||
hoverColumn: -1
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
state = {
|
||||
// students
|
||||
hoverColumn: -1
|
||||
};
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test series.js 1`] = `
|
||||
"1 + ++x;
|
||||
1 + x++;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
state = {
|
||||
// students
|
||||
hoverColumn: -1
|
||||
};
|
Loading…
Reference in New Issue