force push newline for line comments when in compact mode - fixes #2006
This commit is contained in:
parent
1abaf66ac2
commit
d661e15ce2
@ -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";
|
||||
}
|
||||
|
||||
|
||||
3
packages/babel/test/fixtures/generation/compact/options.json
vendored
Normal file
3
packages/babel/test/fixtures/generation/compact/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"compact": true
|
||||
}
|
||||
2
packages/babel/test/fixtures/generation/compact/single-line-comment/actual.js
vendored
Normal file
2
packages/babel/test/fixtures/generation/compact/single-line-comment/actual.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// foo
|
||||
bar();
|
||||
2
packages/babel/test/fixtures/generation/compact/single-line-comment/expected.js
vendored
Normal file
2
packages/babel/test/fixtures/generation/compact/single-line-comment/expected.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// foo
|
||||
bar();
|
||||
Loading…
x
Reference in New Issue
Block a user