Tweak JSX attributes and fix bug with function params

master
James Long 2017-01-09 14:28:23 -05:00
parent f40f5f11d6
commit 7ad69b05ca
1 changed files with 10 additions and 4 deletions

View File

@ -1049,7 +1049,13 @@ function genericPrintNoParens(path, options, print) {
case "JSXSpreadAttribute": case "JSXSpreadAttribute":
return concat([ "{...", path.call(print, "argument"), "}" ]); return concat([ "{...", path.call(print, "argument"), "}" ]);
case "JSXExpressionContainer": case "JSXExpressionContainer":
return concat([ "{", path.call(print, "expression"), "}" ]); return group(concat([
"{",
indent(options.tabWidth,
concat([softline, path.call(print, "expression")])),
softline,
"}"
]));
case "JSXElement": case "JSXElement":
var openingLines = path.call(print, "openingElement"); var openingLines = path.call(print, "openingElement");
@ -1100,7 +1106,7 @@ function genericPrintNoParens(path, options, print) {
concat([ concat([
"<", "<",
path.call(print, "name"), path.call(print, "name"),
concat(path.map(attr => concat([ " ", print(attr) ]), "attributes")), concat(path.map(attr => concat([" ", print(attr)]), "attributes")),
n.selfClosing ? " />" : ">" n.selfClosing ? " />" : ">"
]) ])
); );
@ -1757,10 +1763,10 @@ function printObjectMethod(path, options, print) {
} }
parts.push( parts.push(
multilineGroup([ multilineGroup(concat([
printFunctionParams(path, print, options), printFunctionParams(path, print, options),
printReturnType(path, print) printReturnType(path, print)
]), ])),
" ", " ",
path.call(print, "body") path.call(print, "body")
); );