Skip to content
Permalink
Browse files
fix: Add property fatalErrorCount to ignored file results (#15520)
Fixes #15510
  • Loading branch information
fasttime committed Jan 14, 2022
1 parent 03ac8cf commit db15802ec4d129c89e563a4bf43ec610292695ab
Showing with 23 additions and 2 deletions.
  1. +3 −0 lib/cli-engine/cli-engine.js
  2. +1 −0 lib/eslint/eslint.js
  3. +11 −2 tests/lib/cli-engine/cli-engine.js
  4. +8 −0 tests/lib/eslint/eslint.js
@@ -92,6 +92,7 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
* @property {string} filePath The path to the file that was linted.
* @property {LintMessage[]} messages All of the messages for the result.
* @property {number} errorCount Number of errors for the result.
* @property {number} fatalErrorCount Number of fatal errors for the result.
* @property {number} warningCount Number of warnings for the result.
* @property {number} fixableErrorCount Number of fixable errors for the result.
* @property {number} fixableWarningCount Number of fixable warnings for the result.
@@ -104,6 +105,7 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
* @typedef {Object} LintReport
* @property {LintResult[]} results All of the result.
* @property {number} errorCount Number of errors for the result.
* @property {number} fatalErrorCount Number of fatal errors for the result.
* @property {number} warningCount Number of warnings for the result.
* @property {number} fixableErrorCount Number of fixable errors for the result.
* @property {number} fixableWarningCount Number of fixable warnings for the result.
@@ -308,6 +310,7 @@ function createIgnoreResult(filePath, baseDir) {
}
],
errorCount: 0,
fatalErrorCount: 0,
warningCount: 1,
fixableErrorCount: 0,
fixableWarningCount: 0
@@ -79,6 +79,7 @@ const { version } = require("../../package.json");
* @property {string} filePath The path to the file that was linted.
* @property {LintMessage[]} messages All of the messages for the result.
* @property {number} errorCount Number of errors for the result.
* @property {number} fatalErrorCount Number of fatal errors for the result.
* @property {number} warningCount Number of warnings for the result.
* @property {number} fixableErrorCount Number of fixable errors for the result.
* @property {number} fixableWarningCount Number of fixable warnings for the result.
@@ -235,6 +235,7 @@ describe("CLIEngine", () => {
assert.strictEqual(report.results.length, 1);
assert.strictEqual(report.errorCount, 0);
assert.strictEqual(report.warningCount, 1);
assert.strictEqual(report.fatalErrorCount, 0);
assert.strictEqual(report.fixableErrorCount, 0);
assert.strictEqual(report.fixableWarningCount, 0);
assert.strictEqual(report.results[0].filePath, getFixturePath("passing.js"));
@@ -243,6 +244,7 @@ describe("CLIEngine", () => {
assert.isUndefined(report.results[0].messages[0].output);
assert.strictEqual(report.results[0].errorCount, 0);
assert.strictEqual(report.results[0].warningCount, 1);
assert.strictEqual(report.results[0].fatalErrorCount, 0);
assert.strictEqual(report.results[0].fixableErrorCount, 0);
assert.strictEqual(report.results[0].fixableWarningCount, 0);
});
@@ -982,6 +984,7 @@ describe("CLIEngine", () => {
assert.strictEqual(report.results.length, 1);
assert.strictEqual(report.results[0].errorCount, 0);
assert.strictEqual(report.results[0].warningCount, 1);
assert.strictEqual(report.results[0].fatalErrorCount, 0);
assert.strictEqual(report.results[0].fixableErrorCount, 0);
assert.strictEqual(report.results[0].fixableWarningCount, 0);
assert.strictEqual(report.results[0].messages[0].message, expectedMsg);
@@ -1045,6 +1048,7 @@ describe("CLIEngine", () => {
assert.strictEqual(report.results.length, 1);
assert.strictEqual(report.results[0].errorCount, 0);
assert.strictEqual(report.results[0].warningCount, 1);
assert.strictEqual(report.results[0].fatalErrorCount, 0);
assert.strictEqual(report.results[0].fixableErrorCount, 0);
assert.strictEqual(report.results[0].fixableWarningCount, 0);
assert.strictEqual(report.results[0].messages[0].message, expectedMsg);
@@ -1066,6 +1070,7 @@ describe("CLIEngine", () => {
assert.strictEqual(report.results.length, 1);
assert.strictEqual(report.results[0].errorCount, 0);
assert.strictEqual(report.results[0].warningCount, 1);
assert.strictEqual(report.results[0].fatalErrorCount, 0);
assert.strictEqual(report.results[0].fixableErrorCount, 0);
assert.strictEqual(report.results[0].fixableWarningCount, 0);
assert.strictEqual(report.results[0].messages[0].message, expectedMsg);
@@ -1415,13 +1420,15 @@ describe("CLIEngine", () => {
assert.strictEqual(report.results.length, 1);
assert.strictEqual(report.errorCount, 0);
assert.strictEqual(report.warningCount, 1);
assert.strictEqual(report.fatalErrorCount, 0);
assert.strictEqual(report.fixableErrorCount, 0);
assert.strictEqual(report.fixableWarningCount, 0);
assert.strictEqual(report.results[0].filePath, filePath);
assert.strictEqual(report.results[0].messages[0].severity, 1);
assert.strictEqual(report.results[0].messages[0].message, "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.");
assert.strictEqual(report.results[0].errorCount, 0);
assert.strictEqual(report.results[0].warningCount, 1);
assert.strictEqual(report.results[0].fatalErrorCount, 0);
assert.strictEqual(report.results[0].fixableErrorCount, 0);
assert.strictEqual(report.results[0].fixableWarningCount, 0);
});
@@ -4824,12 +4831,14 @@ describe("CLIEngine", () => {
assert.lengthOf(report.results, 1);
assert.strictEqual(report.errorCount, 0);
assert.strictEqual(report.warningCount, 1);
assert.strictEqual(report.fatalErrorCount, 0);
assert.strictEqual(report.fixableErrorCount, 0);
assert.strictEqual(report.fixableWarningCount, 0);
assert.strictEqual(report.results[0].errorCount, 0);
assert.strictEqual(report.results[0].warningCount, 1);
assert.strictEqual(report.fixableErrorCount, 0);
assert.strictEqual(report.fixableWarningCount, 0);
assert.strictEqual(report.results[0].fatalErrorCount, 0);
assert.strictEqual(report.results[0].fixableErrorCount, 0);
assert.strictEqual(report.results[0].fixableWarningCount, 0);
});

it("should return source code of file in the `source` property", () => {
@@ -324,6 +324,7 @@ describe("ESLint", () => {
assert.strictEqual(results[0].messages[0].output, void 0);
assert.strictEqual(results[0].errorCount, 0);
assert.strictEqual(results[0].warningCount, 1);
assert.strictEqual(results[0].fatalErrorCount, 0);
assert.strictEqual(results[0].fixableErrorCount, 0);
assert.strictEqual(results[0].fixableWarningCount, 0);
assert.strictEqual(results[0].usedDeprecatedRules.length, 0);
@@ -1044,6 +1045,7 @@ describe("ESLint", () => {
assert.strictEqual(results.length, 1);
assert.strictEqual(results[0].errorCount, 0);
assert.strictEqual(results[0].warningCount, 1);
assert.strictEqual(results[0].fatalErrorCount, 0);
assert.strictEqual(results[0].fixableErrorCount, 0);
assert.strictEqual(results[0].fixableWarningCount, 0);
assert.strictEqual(results[0].messages[0].message, expectedMsg);
@@ -1105,6 +1107,7 @@ describe("ESLint", () => {
assert.strictEqual(results.length, 1);
assert.strictEqual(results[0].errorCount, 0);
assert.strictEqual(results[0].warningCount, 1);
assert.strictEqual(results[0].fatalErrorCount, 0);
assert.strictEqual(results[0].fixableErrorCount, 0);
assert.strictEqual(results[0].fixableWarningCount, 0);
assert.strictEqual(results[0].messages[0].message, expectedMsg);
@@ -1127,6 +1130,7 @@ describe("ESLint", () => {
assert.strictEqual(results.length, 1);
assert.strictEqual(results[0].errorCount, 0);
assert.strictEqual(results[0].warningCount, 1);
assert.strictEqual(results[0].fatalErrorCount, 0);
assert.strictEqual(results[0].fixableErrorCount, 0);
assert.strictEqual(results[0].fixableWarningCount, 0);
assert.strictEqual(results[0].messages[0].message, expectedMsg);
@@ -1413,6 +1417,7 @@ describe("ESLint", () => {
assert.strictEqual(results[0].messages[0].message, "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.");
assert.strictEqual(results[0].errorCount, 0);
assert.strictEqual(results[0].warningCount, 1);
assert.strictEqual(results[0].fatalErrorCount, 0);
assert.strictEqual(results[0].fixableErrorCount, 0);
assert.strictEqual(results[0].fixableWarningCount, 0);
});
@@ -4822,6 +4827,9 @@ describe("ESLint", () => {
assert.strictEqual(results.length, 1);
assert.strictEqual(results[0].errorCount, 0);
assert.strictEqual(results[0].warningCount, 1);
assert.strictEqual(results[0].fatalErrorCount, 0);
assert.strictEqual(results[0].fixableErrorCount, 0);
assert.strictEqual(results[0].fixableWarningCount, 0);
});

it("should return source code of file in the `source` property", async () => {

0 comments on commit db15802

Please sign in to comment.