diff --git a/package.json b/package.json index 0ba8964..c8d9fb6 100644 --- a/package.json +++ b/package.json @@ -53,9 +53,9 @@ "webpack": "^4.47.0" }, "dependencies": { - "chalk": "^2.4.2", "consola": "^3.2.3", "error-stack-parser": "^2.1.4", + "picocolors": "^1.1.0", "string-width": "^4.2.3" }, "jest": { diff --git a/src/formatters/eslintError.js b/src/formatters/eslintError.js index 1799b5c..8ae8375 100644 --- a/src/formatters/eslintError.js +++ b/src/formatters/eslintError.js @@ -1,12 +1,12 @@ 'use strict' const concat = require('../utils').concat -const chalk = require('chalk') +const pc = require('picocolors') const infos = [ 'You may use special comments to disable some warnings.', - 'Use ' + chalk.yellow('// eslint-disable-next-line') + ' to ignore the next line.', - 'Use ' + chalk.yellow('/* eslint-disable */') + ' to ignore all warnings in a file.' + 'Use ' + pc.yellow('// eslint-disable-next-line') + ' to ignore the next line.', + 'Use ' + pc.yellow('/* eslint-disable */') + ' to ignore all warnings in a file.' ] function displayError (error) { diff --git a/src/reporters/base.js b/src/reporters/base.js index a907662..89f35f7 100644 --- a/src/reporters/base.js +++ b/src/reporters/base.js @@ -1,7 +1,7 @@ 'use strict' const { colors, formatTitle, formatText, clearConsole } = require('../utils/log') -const chalk = require('chalk') +const pc = require('picocolors') const stringWidth = require('string-width') class BaseReporter { @@ -45,7 +45,7 @@ class BaseReporter { appendTimestamp (title, message) { // Make timestamp appear at the end of the line const line = `${title} ${message}` - const dateString = chalk.grey(new Date().toLocaleTimeString()) + const dateString = pc.gray(new Date().toLocaleTimeString()) let logSpace = process.stdout.columns - stringWidth(line) - stringWidth(dateString) if (logSpace <= 0) { logSpace = 10 diff --git a/src/utils/log.js b/src/utils/log.js index 3c58858..8c0aaeb 100644 --- a/src/utils/log.js +++ b/src/utils/log.js @@ -1,6 +1,6 @@ 'use strict' -const chalk = require('chalk') +const pc = require('picocolors') const colors = { success: 'green', @@ -32,11 +32,11 @@ function capitalizeFirstLetter (string) { } function formatTitle (severity, title) { - return chalk[bgColor(severity)].black('', title, '') + return pc[bgColor(severity)](pc.black(` ${title} `)) } function formatText (severity, message) { - return chalk[textColor(severity)](message) + return pc[textColor(severity)](message) } function clearConsole () { diff --git a/yarn.lock b/yarn.lock index 700742c..d7f5c6f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5489,6 +5489,11 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59" + integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"