Skip to content

Commit

Permalink
Allow block-less arrow function expression to break (fixes #61)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlongster committed Jan 10, 2017
1 parent 4825e56 commit 321bd6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,14 @@ function genericPrintNoParens(path, options, print) {
])));
}

parts.push(" => ", path.call(print, "body"));
parts.push(" => ");

return concat(parts);
return conditionalGroup([
concat([ concat(parts), path.call(print, "body") ]),
concat([ concat(parts),
indent(options.tabWidth,
concat([line, path.call(print, "body")]))])
])
case "MethodDefinition":
if (n.static) {
parts.push("static ");
Expand Down
5 changes: 2 additions & 3 deletions tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ var a1 = (x: mixed): %checks => x !== null;
(x): %checks => x !== null;
const insert_a_really_big_predicated_arrow_function_name_here = (
x
): %checks => x !== null;
const insert_a_really_big_predicated_arrow_function_name_here = (x): %checks =>
x !== null;
declare var x;
x;
Expand Down

0 comments on commit 321bd6a

Please sign in to comment.