Fix first argument left behind when line breaks (#3079)
* fixing issue #2984 * removed typescript from test #2984 * prettier * removed obsolete test copied from another * added verification parsers * added new linemaster
parent
4043ea655e
commit
54bdd30595
|
@ -3011,11 +3011,20 @@ function printArgumentsList(path, options, print) {
|
|||
i++;
|
||||
}, "arguments");
|
||||
|
||||
const somePrintedArgumentsWillBreak = printedArguments.some(willBreak);
|
||||
|
||||
return concat([
|
||||
printedArguments.some(willBreak) ? breakParent : "",
|
||||
somePrintedArgumentsWillBreak ? breakParent : "",
|
||||
conditionalGroup(
|
||||
[
|
||||
concat(["(", concat(printedExpanded), ")"]),
|
||||
concat([
|
||||
ifBreak(
|
||||
indent(concat(["(", softline, concat(printedExpanded)])),
|
||||
concat(["(", concat(printedExpanded)])
|
||||
),
|
||||
somePrintedArgumentsWillBreak ? softline : "",
|
||||
")"
|
||||
]),
|
||||
shouldGroupFirst
|
||||
? concat([
|
||||
"(",
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`function_expression.js 1`] = `
|
||||
//https://github.com/prettier/prettier/issues/3002
|
||||
beep.boop().baz("foo",
|
||||
{
|
||||
some: {
|
||||
thing: {
|
||||
nested: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{ another: { thing: true } },
|
||||
() => {});
|
||||
|
||||
|
||||
//https://github.com/prettier/prettier/issues/2984
|
||||
db.collection('indexOptionDefault').createIndex({ a: 1 }, {
|
||||
indexOptionDefaults: true,
|
||||
w: 2,
|
||||
wtimeout: 1000
|
||||
}, function(err) {
|
||||
test.equal(null, err);
|
||||
test.deepEqual({ w: 2, wtimeout: 1000 }, commandResult.writeConcern);
|
||||
|
||||
client.close();
|
||||
done();
|
||||
});~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//https://github.com/prettier/prettier/issues/3002
|
||||
beep.boop().baz(
|
||||
"foo",
|
||||
{
|
||||
some: {
|
||||
thing: {
|
||||
nested: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{ another: { thing: true } },
|
||||
() => {}
|
||||
);
|
||||
|
||||
//https://github.com/prettier/prettier/issues/2984
|
||||
db.collection("indexOptionDefault").createIndex(
|
||||
{ a: 1 },
|
||||
{
|
||||
indexOptionDefaults: true,
|
||||
w: 2,
|
||||
wtimeout: 1000
|
||||
},
|
||||
function(err) {
|
||||
test.equal(null, err);
|
||||
test.deepEqual({ w: 2, wtimeout: 1000 }, commandResult.writeConcern);
|
||||
|
||||
client.close();
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
`;
|
|
@ -0,0 +1,25 @@
|
|||
//https://github.com/prettier/prettier/issues/3002
|
||||
beep.boop().baz("foo",
|
||||
{
|
||||
some: {
|
||||
thing: {
|
||||
nested: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{ another: { thing: true } },
|
||||
() => {});
|
||||
|
||||
|
||||
//https://github.com/prettier/prettier/issues/2984
|
||||
db.collection('indexOptionDefault').createIndex({ a: 1 }, {
|
||||
indexOptionDefaults: true,
|
||||
w: 2,
|
||||
wtimeout: 1000
|
||||
}, function(err) {
|
||||
test.equal(null, err);
|
||||
test.deepEqual({ w: 2, wtimeout: 1000 }, commandResult.writeConcern);
|
||||
|
||||
client.close();
|
||||
done();
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, null, ["babylon", "typescript"]);
|
Loading…
Reference in New Issue