All files / libs/tools/plugin/src/executors/lint-max-warnings-updater eslint-formatter.js

0% Statements 0/22
0% Branches 0/1
0% Functions 0/1
0% Lines 0/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                                             
// Adapted from https://eslint.org/docs/latest/extend/custom-formatters

/**
 * @param {import('eslint').ESLint.LintResult[]} results
 * @returns {string}
 */
module.exports = (results) => {
  // accumulate the errors and warnings
  const summary = results.reduce(
    (seq, current) => {
      seq.errors += current.errorCount;
      seq.warnings += current.warningCount;
      return seq;
    },
    {
      errors: 0,
      warnings: 0,
    },
  );

  return summary.errors > 0 || summary.warnings > 0 ? `Errors: ${summary.errors}, Warnings: ${summary.warnings}\n` : '';
};