diff --git a/lib/printer.ts b/lib/printer.ts index 008e7e93..aa98244e 100644 --- a/lib/printer.ts +++ b/lib/printer.ts @@ -712,7 +712,6 @@ function genericPrintNoParens(path: any, options: any, print: any) { ? ";" : ","; const fields = []; - let allowBreak = false; if (isTypeAnnotation) { fields.push("indexers", "callProperties"); @@ -743,19 +742,9 @@ function genericPrintNoParens(path: any, options: any, print: any) { lines = lines.indent(options.tabWidth); } - const multiLine = !isTypeAnnotation && lines.length > 1; - if (multiLine && allowBreak) { - // Similar to the logic for BlockStatement. - parts.push("\n"); - } - parts.push(lines); - if (i < len - 1) { - // Add an extra line break if the previous object property - // had a multi-line value. - parts.push(separator + (multiLine ? "\n\n" : "\n")); - allowBreak = !multiLine; + parts.push(separator + "\n"); } else if (len !== 1 && isTypeAnnotation) { parts.push(separator); } else if ( diff --git a/test/babel.ts b/test/babel.ts index 2b7f29e1..642f5b46 100644 --- a/test/babel.ts +++ b/test/babel.ts @@ -120,19 +120,15 @@ describe("Babel", function () { " async *a() {", // ObjectMethod " b;", " },", - "", " get a() {", " return 1;", " },", - "", " set a(b) {", " return 1;", " },", - "", " async *[d](c) {", " return 1;", " },", - "", " a: 3,", " [a]: 3,", " 1: 3,", diff --git a/test/comments.ts b/test/comments.ts index 4029c036..e967366a 100644 --- a/test/comments.ts +++ b/test/comments.ts @@ -117,20 +117,16 @@ function runTestsForParser(parserId: any) { " // Important for instanceof", " // to work in all browsers.", " constructor: Foo,", - "", " // Just in case we need it.", ' bar: "baz",', - "", " // There was an object literal...", " // ... and here I am continuing this comment.", " qux: {", " // Here is an object literal.", " // Put more properties here when you think of them.", " zxcv: 42,", - "", " asdf: 43", " },", - "", ' extra: "property"', "};", ]; diff --git a/test/printer.ts b/test/printer.ts index a0fc12f9..5f4aff5c 100644 --- a/test/printer.ts +++ b/test/printer.ts @@ -2493,7 +2493,6 @@ describe("printer", function () { " a: #{", " b: 1234", " },", - "", " c: #{", ' d: "dee"', " }",