From 7ad69b05ca2420656145a2bd6f86af56b51a3a70 Mon Sep 17 00:00:00 2001 From: James Long Date: Mon, 9 Jan 2017 14:28:23 -0500 Subject: [PATCH] Tweak JSX attributes and fix bug with function params --- src/printer.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/printer.js b/src/printer.js index 93a7b9ab..c22fe6d8 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1049,7 +1049,13 @@ function genericPrintNoParens(path, options, print) { case "JSXSpreadAttribute": return concat([ "{...", path.call(print, "argument"), "}" ]); case "JSXExpressionContainer": - return concat([ "{", path.call(print, "expression"), "}" ]); + return group(concat([ + "{", + indent(options.tabWidth, + concat([softline, path.call(print, "expression")])), + softline, + "}" + ])); case "JSXElement": var openingLines = path.call(print, "openingElement"); @@ -1100,7 +1106,7 @@ function genericPrintNoParens(path, options, print) { concat([ "<", path.call(print, "name"), - concat(path.map(attr => concat([ " ", print(attr) ]), "attributes")), + concat(path.map(attr => concat([" ", print(attr)]), "attributes")), n.selfClosing ? " />" : ">" ]) ); @@ -1757,10 +1763,10 @@ function printObjectMethod(path, options, print) { } parts.push( - multilineGroup([ + multilineGroup(concat([ printFunctionParams(path, print, options), printReturnType(path, print) - ]), + ])), " ", path.call(print, "body") );