diff --git a/lib/formatters/table.js b/lib/formatters/table.js index ebc3314e7ad..a74cce0d516 100644 --- a/lib/formatters/table.js +++ b/lib/formatters/table.js @@ -9,13 +9,22 @@ //------------------------------------------------------------------------------ const chalk = require("chalk"), - table = require("table").table, - pluralize = require("pluralize"); + table = require("table").table; //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ +/** + * Given a word and a count, append an "s" if count is not one. + * @param {string} word A word. + * @param {number} count Quantity. + * @returns {string} The original word with an s on the end if count is not one. + */ +function pluralize(word, count) { + return (count === 1 ? word : `${word}s`); +} + /** * Draws text table. * @param {Array} messages Error messages relating to a specific file. @@ -129,10 +138,10 @@ module.exports = function(report) { result += `\n${table([ [ - chalk.red(pluralize("Error", errorCount, true)) + chalk.red(pluralize(`${errorCount} Error`, errorCount)) ], [ - chalk.yellow(pluralize("Warning", warningCount, true)) + chalk.yellow(pluralize(`${warningCount} Warning`, warningCount)) ] ], { columns: { diff --git a/package.json b/package.json index 373c51776b4..0ab92b6c3fc 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "natural-compare": "^1.4.0", "optionator": "^0.8.2", "path-is-inside": "^1.0.2", - "pluralize": "^7.0.0", "progress": "^2.0.0", "regexpp": "^2.0.1", "semver": "^5.5.1",