@@ -98,10 +98,24 @@ export default Task.extend({
9898 if ( current . fixes ) {
9999 total . fixes = ( total . fixes || [ ] ) . concat ( ...current . fixes ) ;
100100 }
101+
102+ if ( current . errorCount !== undefined ) {
103+ total . errorCount += current . errorCount ;
104+ } else {
105+ // Handle pre-warning/error bifurcation
106+ total . errorCount += failures . length ;
107+ }
108+
109+ if ( current . warningCount !== undefined ) {
110+ total . warningCount += current . warningCount ;
111+ }
112+
101113 return total ;
102114 } , {
103115 failures : [ ] ,
104- fixes : undefined
116+ fixes : undefined ,
117+ errorCount : 0 ,
118+ warningCount : 0 ,
105119 } ) ;
106120
107121 if ( ! options . silent ) {
@@ -119,21 +133,22 @@ export default Task.extend({
119133
120134 // print formatter output directly for non human-readable formats
121135 if ( [ 'prose' , 'verbose' , 'stylish' ] . indexOf ( options . format ) == - 1 ) {
122- return ( result . failures . length == 0 || options . force )
123- ? Promise . resolve ( 0 ) : Promise . resolve ( 2 ) ;
136+ options . silent = true ;
124137 }
125138
126- if ( result . failures . length > 0 ) {
127- if ( ! options . silent ) {
128- ui . writeLine ( chalk . red ( 'Lint errors found in the listed files.' ) ) ;
129- }
130- return options . force ? Promise . resolve ( 0 ) : Promise . resolve ( 2 ) ;
139+ if ( result . warningCount > 0 && ! options . silent ) {
140+ ui . writeLine ( chalk . yellow ( 'Lint warnings found in the listed files.' ) ) ;
131141 }
132142
133- if ( ! options . silent ) {
143+ if ( result . errorCount > 0 && ! options . silent ) {
144+ ui . writeLine ( chalk . red ( 'Lint errors found in the listed files.' ) ) ;
145+ }
146+
147+ if ( result . warningCount === 0 && result . errorCount === 0 && ! options . silent ) {
134148 ui . writeLine ( chalk . green ( 'All files pass linting.' ) ) ;
135149 }
136- return Promise . resolve ( 0 ) ;
150+
151+ return options . force || result . errorCount === 0 ? Promise . resolve ( 0 ) : Promise . resolve ( 2 ) ;
137152 }
138153} ) ;
139154
0 commit comments