@@ -33,7 +33,7 @@ var formatOutput = function(report, file, options) {
3333} ;
3434
3535var cssLintPlugin = function ( options ) {
36- if ( ! options ) options = { } ;
36+ options = options || { } ;
3737
3838 var ruleset = { } ;
3939
@@ -76,12 +76,15 @@ var cssLintPlugin = function(options) {
7676} ;
7777
7878cssLintPlugin . reporter = function ( customReporter ) {
79- var reporter = csslint . getFormatter ( 'text' ) , builtInReporter = true , output ;
79+ var reporter = csslint . getFormatter ( 'text' ) ;
80+ var builtInReporter = true ;
81+ var output ;
8082
8183 if ( typeof customReporter === 'function' ) {
8284 reporter = customReporter ;
8385 builtInReporter = false ;
84- } else if ( typeof customReporter === 'string' ) {
86+ }
87+ else if ( typeof customReporter === 'string' ) {
8588 if ( customReporter === 'fail' ) {
8689 return cssLintPlugin . failReporter ( ) ;
8790 }
@@ -97,26 +100,30 @@ cssLintPlugin.reporter = function(customReporter) {
97100 output = reporter . startFormat ( ) ;
98101 }
99102
100- return through . obj ( function ( file , enc , cb ) {
101- // Only report if CSSLint was ran and errors were found
102- if ( file . csslint && ! file . csslint . success ) {
103- if ( builtInReporter ) {
104- output += reporter . formatResults ( file . csslint . originalReport , file . path ) ;
105- } else {
106- reporter ( file ) ;
103+ return through . obj (
104+ function ( file , enc , cb ) {
105+ // Only report if CSSLint was ran and errors were found
106+ if ( file . csslint && ! file . csslint . success ) {
107+ if ( builtInReporter ) {
108+ output += reporter . formatResults ( file . csslint . originalReport , file . path ) ;
109+ }
110+ else {
111+ reporter ( file ) ;
112+ }
107113 }
108- }
109114
110- return cb ( null , file ) ;
111- } , function ( cb ) {
112- if ( builtInReporter ) {
113- output += reporter . endFormat ( ) ;
115+ return cb ( null , file ) ;
116+ } ,
117+ function ( cb ) {
118+ if ( builtInReporter ) {
119+ output += reporter . endFormat ( ) ;
114120
115- gutil . log ( output ) ;
116- }
121+ gutil . log ( output ) ;
122+ }
117123
118- return cb ( ) ;
119- } ) ;
124+ return cb ( ) ;
125+ }
126+ ) ;
120127} ;
121128
122129cssLintPlugin . addRule = function ( rule ) {
0 commit comments