Force break if comment in return argument (#3665)

* Force break if comment in return argument

* add test case
This commit is contained in:
Lucas Duailibe authored and Jed Fox committed 2018-01-31 12:00:29 -05:00
1 parent a3b973c245
commit aac38fca49
3 files changed
+70 -2

No files matched your search

+2 -2
View File
@@ -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,
")"
])
);
@@ -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()
);
});
`;
+22
View File
@@ -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()
);
});