Allow multiple nested arrow functions to be expanded as last call arg (fixes #65)

This commit is contained in:
James Long committed 2017-01-10 16:20:24 -05:00
1 parent c904281027
commit 4825e56227
1 file changed
+4 -5
+4 -5
View File
@@ -1648,7 +1648,8 @@ function printArgumentsList(path, options, print) {
lastArg.type === "ArrayExpression" ||
lastArg.type === "FunctionExpression" ||
(lastArg.type === "ArrowFunctionExpression" &&
lastArg.body.type === "BlockStatement") ||
(lastArg.body.type === "BlockStatement" ||
lastArg.body.type === "ArrowFunctionExpression")) ||
lastArg.type === "NewExpression";
if (groupLastArg) {
@@ -1681,8 +1682,7 @@ function printArgumentsList(path, options, print) {
);
}
const shouldBreak = printed.some(hasHardLine);
return group(
return multilineGroup(
concat([
"(",
indent(
@@ -1692,8 +1692,7 @@ function printArgumentsList(path, options, print) {
ifBreak(options.trailingComma ? "," : ""),
softline,
")"
]),
{shouldBreak}
])
);
}