Skip to content

Commit b9c31a5

Browse files
committed
Do not print empty built-in reports
- This avoid irregular breaks in the console logs for successful but empty report formats (like text and compact). XML reports would print as XML syntax requires root tags
1 parent d1532ec commit b9c31a5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ cssLintPlugin.reporter = function(customReporter) {
9696
}
9797

9898
if (builtInReporter) {
99-
output = reporter.startFormat();
99+
output = [reporter.startFormat()];
100100
}
101101

102102
return through.obj(
103103
function(file, enc, cb) {
104104
// Only report if CSSLint was ran and errors were found
105105
if (file.csslint && !file.csslint.success) {
106106
if (builtInReporter) {
107-
output += reporter.formatResults(file.csslint.originalReport, file.path);
107+
output.push(reporter.formatResults(file.csslint.originalReport, file.path));
108108
}
109109
else {
110110
reporter(file);
@@ -114,10 +114,14 @@ cssLintPlugin.reporter = function(customReporter) {
114114
return cb(null, file);
115115
},
116116
function(cb) {
117+
var report;
118+
117119
if (builtInReporter) {
118-
output += reporter.endFormat();
120+
output.push(reporter.endFormat());
121+
report = output.join('');
119122

120-
gutil.log(output);
123+
// Only print report if the report is not empty
124+
report && gutil.log(report);
121125
}
122126

123127
return cb();

0 commit comments

Comments
 (0)