Do not put trailing commas for function declaration in es5 mode (#791)

Fixes #789
master
Christopher Chedeau 2017-02-23 09:01:19 -08:00 committed by GitHub
parent 543e62cd31
commit ee0e839cb8
3 changed files with 136 additions and 3 deletions

View File

@ -1981,7 +1981,7 @@ function printFunctionParams(path, print, options) {
options.tabWidth,
concat([softline, join(concat([",", line]), printed)])
),
ifBreak(canHaveTrailingComma && shouldPrintComma(options) ? "," : ""),
ifBreak(canHaveTrailingComma && shouldPrintComma(options, "all") ? "," : ""),
softline,
")"
]);

View File

@ -1,5 +1,122 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`es5.js 1`] = `
"function send_single_email(
app,
email_id,
email_address,
subject,
html,
reply_to
) {
send_single_email_implementation( app,
email_id,
email_address,
subject,
html,
reply_to);
return \\"nothing\\";
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function send_single_email(
app,
email_id,
email_address,
subject,
html,
reply_to
) {
send_single_email_implementation(
app,
email_id,
email_address,
subject,
html,
reply_to
);
return \\"nothing\\";
}
"
`;
exports[`es5.js 2`] = `
"function send_single_email(
app,
email_id,
email_address,
subject,
html,
reply_to
) {
send_single_email_implementation( app,
email_id,
email_address,
subject,
html,
reply_to);
return \\"nothing\\";
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function send_single_email(
app,
email_id,
email_address,
subject,
html,
reply_to,
) {
send_single_email_implementation(
app,
email_id,
email_address,
subject,
html,
reply_to,
);
return \\"nothing\\";
}
"
`;
exports[`es5.js 3`] = `
"function send_single_email(
app,
email_id,
email_address,
subject,
html,
reply_to
) {
send_single_email_implementation( app,
email_id,
email_address,
subject,
html,
reply_to);
return \\"nothing\\";
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function send_single_email(
app,
email_id,
email_address,
subject,
html,
reply_to
) {
send_single_email_implementation(
app,
email_id,
email_address,
subject,
html,
reply_to
);
return \\"nothing\\";
}
"
`;
exports[`function-calls.js 1`] = `
"const a = (param1, param2, param3) => {}
@ -447,14 +564,14 @@ o = {
function supersupersupersuperLongF(
supersupersupersuperLongA,
supersupersupersuperLongB,
supersupersupersuperLongB
) // Comment
{
a;
}
function supersupersupersuperLongF(
supersupersupersuperLongA,
supersupersupersuperLongB,
supersupersupersuperLongB
) // Comment
{
a;

View File

@ -0,0 +1,16 @@
function send_single_email(
app,
email_id,
email_address,
subject,
html,
reply_to
) {
send_single_email_implementation( app,
email_id,
email_address,
subject,
html,
reply_to);
return "nothing";
}