diff --git a/src/printer.js b/src/printer.js index a86cc6bf1..a0dbd9185 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1023,10 +1023,9 @@ function genericPrintNoParens(path, options, print) { ); parts.push( - indent( - options.tabWidth, - concat([ isCurlyBracket(cons) ? " " : hardline, cons ]) - ) + isCurlyBracket(cons) + ? concat([ " ", cons ]) + : indent(options.tabWidth, concat([ hardline, cons ])) ); } diff --git a/tests/break/__snapshots__/jsfmt.spec.js.snap b/tests/break/__snapshots__/jsfmt.spec.js.snap index 1bae9c78d..63f2225f4 100644 --- a/tests/break/__snapshots__/jsfmt.spec.js.snap +++ b/tests/break/__snapshots__/jsfmt.spec.js.snap @@ -105,15 +105,15 @@ function bar2(b) { return; switch (\"\") { case 0: { - let y: number = x; - // error: boolean !~> number - x = \"\"; - } + let y: number = x; + // error: boolean !~> number + x = \"\"; + } case 1: { - let z: number = x; - // 2 errors: (boolean | string) !~> number - break; - } + let z: number = x; + // 2 errors: (boolean | string) !~> number + break; + } case 2: } var w: number = x; // 2 errors: (boolean | string) !~> number diff --git a/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap b/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap index 601e84036..c02561f0f 100644 --- a/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap +++ b/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap @@ -264,27 +264,27 @@ export function emitExpression(node: TypedNode): t.Expression { false ); case \"binary_op\": { - const lhs = emitExpression(node.lhs); - const rhs = emitExpression(node.rhs); + const lhs = emitExpression(node.lhs); + const rhs = emitExpression(node.rhs); - const op = getBinaryOp(node.binaryOp); - return b.binaryExpression(op, lhs, rhs); - } + const op = getBinaryOp(node.binaryOp); + return b.binaryExpression(op, lhs, rhs); + } case \"unary_minus\": { - const operand = emitExpression(node.op); - return b.unaryExpression(\"-\", operand, true); - } + const operand = emitExpression(node.op); + return b.unaryExpression(\"-\", operand, true); + } case \"function_invocation\": { - const callee = b.memberExpression( - b.identifier(\"fns\"), - b.identifier(node.name), - false - ); + const callee = b.memberExpression( + b.identifier(\"fns\"), + b.identifier(node.name), + false + ); - const args = node.parameters.map(n => emitExpression(n)); + const args = node.parameters.map(n => emitExpression(n)); - return b.callExpression(callee, args); - } + return b.callExpression(callee, args); + } default: throw new Error(\"Unknown expression type: \" + node.type); }