Force break if comment in return argument (#3665)

* Force break if comment in return argument

* add test case
master
Lucas Duailibe 2018-01-31 14:00:29 -03:00 committed by Jed Fox
parent a3b973c245
commit aac38fca49
3 changed files with 70 additions and 2 deletions

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,
")"
])
);

View File

@ -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()
);
});
`;

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()
);
});