@@ -98,10 +98,24 @@ export default Task.extend({
98
98
if ( current . fixes ) {
99
99
total . fixes = ( total . fixes || [ ] ) . concat ( ...current . fixes ) ;
100
100
}
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
+
101
113
return total ;
102
114
} , {
103
115
failures : [ ] ,
104
- fixes : undefined
116
+ fixes : undefined ,
117
+ errorCount : 0 ,
118
+ warningCount : 0 ,
105
119
} ) ;
106
120
107
121
if ( ! options . silent ) {
@@ -119,21 +133,22 @@ export default Task.extend({
119
133
120
134
// print formatter output directly for non human-readable formats
121
135
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 ;
124
137
}
125
138
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.' ) ) ;
131
141
}
132
142
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 ) {
134
148
ui . writeLine ( chalk . green ( 'All files pass linting.' ) ) ;
135
149
}
136
- return Promise . resolve ( 0 ) ;
150
+
151
+ return options . force || result . errorCount === 0 ? Promise . resolve ( 0 ) : Promise . resolve ( 2 ) ;
137
152
}
138
153
} ) ;
139
154
0 commit comments