@@ -187,30 +187,26 @@ function parseResults(options, results) {
187187 const warnings = [ ] ;
188188
189189 results . forEach ( ( file ) => {
190- if ( fileHasErrors ( file ) ) {
191- const messages = file . warnings . filter (
192- ( message ) => options . emitError && message . severity === 'error'
193- ) ;
194-
195- if ( messages . length > 0 ) {
196- errors . push ( {
197- ...file ,
198- warnings : messages ,
199- } ) ;
200- }
190+ const fileErrors = file . warnings . filter (
191+ ( message ) => options . emitError && message . severity === 'error'
192+ ) ;
193+
194+ if ( fileErrors . length > 0 ) {
195+ errors . push ( {
196+ ...file ,
197+ warnings : fileErrors ,
198+ } ) ;
201199 }
202200
203- if ( fileHasWarnings ( file ) ) {
204- const messages = file . warnings . filter (
205- ( message ) => options . emitWarning && message . severity === 'warning'
206- ) ;
201+ const fileWarnings = file . warnings . filter (
202+ ( message ) => options . emitWarning && message . severity === 'warning'
203+ ) ;
207204
208- if ( messages . length > 0 ) {
209- warnings . push ( {
210- ...file ,
211- warnings : messages ,
212- } ) ;
213- }
205+ if ( fileWarnings . length > 0 ) {
206+ warnings . push ( {
207+ ...file ,
208+ warnings : fileWarnings ,
209+ } ) ;
214210 }
215211 } ) ;
216212
@@ -220,22 +216,6 @@ function parseResults(options, results) {
220216 } ;
221217}
222218
223- /**
224- * @param {LintResult } file
225- * @returns {boolean }
226- */
227- function fileHasErrors ( file ) {
228- return ! ! file . errored ;
229- }
230-
231- /**
232- * @param {LintResult } file
233- * @returns {boolean }
234- */
235- function fileHasWarnings ( file ) {
236- return file . warnings && file . warnings . length > 0 ;
237- }
238-
239219/**
240220 * @param {Stylelint } stylelint
241221 * @param {FormatterType= } formatter
0 commit comments