Don't add end of line to empty CSS (#3723)

Fixes #3440.
master
Aleks Hudochenkov 2018-01-12 00:05:57 +03:00 committed by Jed Fox
parent bef646d4a4
commit b67fd8e155
8 changed files with 31 additions and 1 deletions

View File

@ -30,7 +30,13 @@ function genericPrint(path, options, print) {
switch (n.type) {
case "css-root": {
return concat([printNodeSequence(path, options, print), hardline]);
const nodes = printNodeSequence(path, options, print);
if (nodes.parts.length) {
return concat([nodes, hardline]);
}
return nodes;
}
case "css-comment": {
if (n.raws.content) {

View File

@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`empty-file.css 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`single-space.css 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;

View File

View File

@ -0,0 +1 @@
run_spec(__dirname, ["css"]);

View File

@ -0,0 +1 @@

View File

@ -6,3 +6,13 @@ exports[`empty.js 1`] = `
`;
exports[`empty-file.js 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`single-space.js 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;

View File

View File

@ -0,0 +1 @@