Fix trailing comma for rest element in Babylon (#1230)
parent
4dfe92a76b
commit
4d9edec4e1
|
@ -706,8 +706,11 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
});
|
||||
|
||||
const lastElem = util.getLast(n[propertiesField]);
|
||||
const canHaveTrailingComma = !(lastElem &&
|
||||
lastElem.type === "RestProperty");
|
||||
|
||||
const canHaveTrailingComma = !(
|
||||
lastElem &&
|
||||
(lastElem.type === "RestProperty" || lastElem.type === "RestElement")
|
||||
);
|
||||
|
||||
const shouldBreak =
|
||||
n.type !== "ObjectPattern" &&
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, { trailingComma: "all" });
|
||||
run_spec(__dirname, { trailingComma: "all" }, ["babylon"]);
|
||||
|
|
Loading…
Reference in New Issue