Break if the first group has an end of line comment (#1681)

This was unstable
master
Christopher Chedeau 2017-05-23 13:14:13 -07:00 committed by GitHub
parent c46f230a40
commit f69c5496c6
3 changed files with 33 additions and 0 deletions

View File

@ -3347,6 +3347,7 @@ function printMemberChain(path, options, print) {
const printedGroups = groups.map(printGroup);
const oneLine = concat(printedGroups);
const hasComment =
groups[0][groups[0].length - 1].node.comments ||
(groups.length >= 2 && groups[1][0].node.comments) ||
(groups.length >= 3 && groups[2][0].node.comments);

View File

@ -230,6 +230,17 @@ Something
// $FlowFixMe(>=0.41.0)
.getInstance(this.props.dao)
.getters()
// Warm-up first
measure()
.then(() => {
SomethingLong();
});
measure() // Warm-up first
.then(() => {
SomethingLong();
});
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function f() {
return (
@ -257,6 +268,16 @@ Something
.getInstance(this.props.dao)
.getters();
// Warm-up first
measure().then(() => {
SomethingLong();
});
measure() // Warm-up first
.then(() => {
SomethingLong();
});
`;
exports[`first_long.js 1`] = `

View File

@ -22,3 +22,14 @@ Something
// $FlowFixMe(>=0.41.0)
.getInstance(this.props.dao)
.getters()
// Warm-up first
measure()
.then(() => {
SomethingLong();
});
measure() // Warm-up first
.then(() => {
SomethingLong();
});