diff --git a/src/printer.js b/src/printer.js index d286ca5c..f1da58fc 100644 --- a/src/printer.js +++ b/src/printer.js @@ -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" && diff --git a/tests/rest/jsfmt.spec.js b/tests/rest/jsfmt.spec.js index a4f98d3f..1f7d49d1 100644 --- a/tests/rest/jsfmt.spec.js +++ b/tests/rest/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, { trailingComma: "all" }); +run_spec(__dirname, { trailingComma: "all" }, ["babylon"]);