diff --git a/src/printer.js b/src/printer.js index 465b4729..934a0f72 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1768,7 +1768,8 @@ function printArgumentsList(path, options, print) { ifBreak(options.trailingComma ? "," : ""), softline, ")" - ]) + ]), + { shouldBreak: printed.some(willBreak) } ); } diff --git a/tests/break-calls/__snapshots__/jsfmt.spec.js.snap b/tests/break-calls/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..f60f0bc1 --- /dev/null +++ b/tests/break-calls/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,14 @@ +exports[`test break.js 1`] = ` +"h(f(g(() => { + a +}))) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +h( + f( + g(() => { + a; + }) + ) +); +" +`; diff --git a/tests/break-calls/break.js b/tests/break-calls/break.js new file mode 100644 index 00000000..f7141fbc --- /dev/null +++ b/tests/break-calls/break.js @@ -0,0 +1,3 @@ +h(f(g(() => { + a +}))) diff --git a/tests/break-calls/jsfmt.spec.js b/tests/break-calls/jsfmt.spec.js new file mode 100644 index 00000000..989047bc --- /dev/null +++ b/tests/break-calls/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname);