diff --git a/.changeset/cyan-cats-destroy.md b/.changeset/cyan-cats-destroy.md new file mode 100644 index 0000000000..c896ee6dfc --- /dev/null +++ b/.changeset/cyan-cats-destroy.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: tally output of `string` formatter colorized diff --git a/lib/formatters/stringFormatter.js b/lib/formatters/stringFormatter.js index ca2c479d57..b7c32c8743 100644 --- a/lib/formatters/stringFormatter.js +++ b/lib/formatters/stringFormatter.js @@ -301,10 +301,9 @@ module.exports = function stringFormatter(results, returnValue) { const total = errorCount + warningCount; if (total > 0) { - const tally = - `${total} ${pluralize('problem', total)}` + - ` (${errorCount} ${pluralize('error', errorCount)}` + - `, ${warningCount} ${pluralize('warning', warningCount)})`; + const error = red(`${errorCount} ${pluralize('error', errorCount)}`); + const warning = yellow(`${warningCount} ${pluralize('warning', warningCount)}`); + const tally = `${total} ${pluralize('problem', total)} (${error}, ${warning})`; output += `${tally}\n\n`; }