Never print blank lines with spaces

master
James Long 2016-12-31 14:38:33 -05:00
parent a9d06355ee
commit 5efa13a10c
2 changed files with 6 additions and 1 deletions

View File

@ -239,6 +239,11 @@ function print(w, doc) {
}
// fallthrough
case MODE_BREAK:
const lastString = out[out.length - 1];
if(lastString.match(/^\s*\n\s*$/)) {
out[out.length - 1] = "\n";
}
if(doc.literal) {
out.push("\n");
pos = 0;

View File

@ -1680,7 +1680,7 @@ function printStatementSequence(path, options, print) {
parts.push(stmtPrinted);
if (addSpacing && !isLastStatement(stmtPath)) {
parts.push(literalline);
parts.push(hardline);
}
printed.push(concat(parts));