force push newline for line comments when in compact mode - fixes #2006

This commit is contained in:
Sebastian McKenzie 2015-07-15 20:23:24 +01:00
parent 1abaf66ac2
commit d661e15ce2
4 changed files with 8 additions and 1 deletions

View File

@ -456,7 +456,7 @@ class CodeGenerator {
// force a newline for line comments when retainLines is set in case the next printed node
// doesn't catch up
if (this.format.retainLines && comment.type === "CommentLine") {
if ((this.format.compact || this.format.retainLines) && comment.type === "CommentLine") {
val += "\n";
}

View File

@ -0,0 +1,3 @@
{
"compact": true
}

View File

@ -0,0 +1,2 @@
// foo
bar();

View File

@ -0,0 +1,2 @@
// foo
bar();