From 3fde6a658c4694cb364a6e11e362ba49f4e021f8 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Wed, 2 Nov 2022 12:13:19 +0900 Subject: [PATCH] Colorize tally output of `string` formatter --- .changeset/cyan-cats-destroy.md | 5 +++++ lib/formatters/stringFormatter.js | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changeset/cyan-cats-destroy.md 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`; }