diff --git a/src/linter.js b/src/linter.js index 8247fd8..ba54883 100644 --- a/src/linter.js +++ b/src/linter.js @@ -187,30 +187,26 @@ function parseResults(options, results) { const warnings = []; results.forEach((file) => { - if (fileHasErrors(file)) { - const messages = file.warnings.filter( - (message) => options.emitError && message.severity === 'error' - ); - - if (messages.length > 0) { - errors.push({ - ...file, - warnings: messages, - }); - } + const fileErrors = file.warnings.filter( + (message) => options.emitError && message.severity === 'error' + ); + + if (fileErrors.length > 0) { + errors.push({ + ...file, + warnings: fileErrors, + }); } - if (fileHasWarnings(file)) { - const messages = file.warnings.filter( - (message) => options.emitWarning && message.severity === 'warning' - ); + const fileWarnings = file.warnings.filter( + (message) => options.emitWarning && message.severity === 'warning' + ); - if (messages.length > 0) { - warnings.push({ - ...file, - warnings: messages, - }); - } + if (fileWarnings.length > 0) { + warnings.push({ + ...file, + warnings: fileWarnings, + }); } }); @@ -220,22 +216,6 @@ function parseResults(options, results) { }; } -/** - * @param {LintResult} file - * @returns {boolean} - */ -function fileHasErrors(file) { - return !!file.errored; -} - -/** - * @param {LintResult} file - * @returns {boolean} - */ -function fileHasWarnings(file) { - return file.warnings && file.warnings.length > 0; -} - /** * @param {Stylelint} stylelint * @param {FormatterType=} formatter