lib/formatters/codeframe.js
function formatSummary(errors, warnings, fixableErrors, fixableWarnings) {
    const summaryColor = errors > 0 ? "red" : "yellow";
    const summary = [];
    const fixablesSummary = [];

    if (errors > 0) {
        summary.push(`${errors} ${pluralize("error", errors)}`);
    }

    if (warnings > 0) {
        summary.push(`${warnings} ${pluralize("warning", warnings)}`);
    }

    if (fixableErrors > 0) {
        fixablesSummary.push(`${fixableErrors} ${pluralize("error", fixableErrors)}`);
    }

    if (fixableWarnings > 0) {
        fixablesSummary.push(`${fixableWarnings} ${pluralize("warning", fixableWarnings)}`);
    }

    let output = chalk[summaryColor].bold(`${summary.join(" and ")} found.`);

    if (fixableErrors || fixableWarnings) {
        output += chalk[summaryColor].bold(`\n${fixablesSummary.join(" and ")} potentially fixable with the \`--fix\` option.`);
    }

    return output;
}
function formatSummary(errors, warnings, fixableErrors, fixableWarnings) {
    const summaryColor = errors > 0 ? "red" : "yellow";
    const summary = [];
    const fixablesSummary = [];

    if (errors > 0) {
        summary.push(`${errors} ${pluralize("error", errors)}`);
    }

    if (warnings > 0) {
        summary.push(`${warnings} ${pluralize("warning", warnings)}`);
    }

    if (fixableErrors > 0) {
        fixablesSummary.push(`${fixableErrors} ${pluralize("error", fixableErrors)}`);
    }

    if (fixableWarnings > 0) {
        fixablesSummary.push(`${fixableWarnings} ${pluralize("warning", fixableWarnings)}`);
    }

    let output = chalk[summaryColor].bold(`${summary.join(" and ")} found.`);

    if (fixableErrors || fixableWarnings) {
        output += chalk[summaryColor].bold(`\n${fixablesSummary.join(" and ")} potentially fixable with the \`--fix\` option.`);
    }

    return output;
}
function formatSummary ( errors , warnings , fixableErrors , fixableWarnings ) { const summaryColor = errors > 0 ? "red" : "yellow" ; const summary = [ ] ; const fixablesSummary = [ ] ; if ( errors > 0 ) { summary . push ( ` ${ errors } ${ pluralize ( "error" , errors ) } ` ) ; } if ( warnings > 0 ) { summary . push ( ` ${ warnings } ${ pluralize ( "warning" , warnings ) } ` ) ; } if ( fixableErrors > 0 ) { fixablesSummary . push ( ` ${ fixableErrors } ${ pluralize ( "error" , fixableErrors ) } ` ) ; } if ( fixableWarnings > 0 ) { fixablesSummary . push ( ` ${ fixableWarnings } ${ pluralize ( "warning" , fixableWarnings ) } ` ) ; } let output = chalk [ summaryColor ] . bold ( ` ${ summary . join ( " and " ) } ` ) ; if ( fixableErrors || fixableWarnings ) { output += chalk [ summaryColor ] . bold ( ` \n ${ fixablesSummary . join ( " and " ) } \` \` ` ) ; } return output ; }
Gets the formatted output summary for a given number of errors and warnings.
@param   {number} errors   The number of errors.
@param   {number} warnings The number of warnings.
@param   {number} fixableErrors The number of fixable errors.
@param   {number} fixableWarnings The number of fixable warnings.
@returns {string}          The formatted output summary.
Gets the formatted output summary for a given number of errors and warnings .