diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index acfe7d854..94cef624e 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -761,8 +761,8 @@ function printPathNoParens(path, options, print, args) { parts.push( concat([ " (", - indent(concat([softline, path.call(print, "argument")])), - line, + indent(concat([hardline, path.call(print, "argument")])), + hardline, ")" ]) ); diff --git a/tests/return/__snapshots__/jsfmt.spec.js.snap b/tests/return/__snapshots__/jsfmt.spec.js.snap index 44eb387f5..5f9bb854e 100644 --- a/tests/return/__snapshots__/jsfmt.spec.js.snap +++ b/tests/return/__snapshots__/jsfmt.spec.js.snap @@ -55,9 +55,55 @@ exports[`comment.js 1`] = ` function f() { return /* a */; } + +function x() { + return func2 + //comment + .bar(); +} + +function f() { + return ( + foo + // comment + .bar() + ); +} + +fn(function f() { + return ( + foo + // comment + .bar() + ); +}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function f() { return /* a */; } +function x() { + return ( + func2 + //comment + .bar() + ); +} + +function f() { + return ( + foo + // comment + .bar() + ); +} + +fn(function f() { + return ( + foo + // comment + .bar() + ); +}); + `; diff --git a/tests/return/comment.js b/tests/return/comment.js index 0313022ea..06126f9f0 100644 --- a/tests/return/comment.js +++ b/tests/return/comment.js @@ -1,3 +1,25 @@ function f() { return /* a */; } + +function x() { + return func2 + //comment + .bar(); +} + +function f() { + return ( + foo + // comment + .bar() + ); +} + +fn(function f() { + return ( + foo + // comment + .bar() + ); +});