diff --git a/devTools/scripts/sanityCheck.js b/devTools/scripts/sanityCheck.js index 314fa0c1a9932cfce27e355ace81645cdc775c81..2b117ff3dcb6f4afca16ae367fa588b0ad26a506 100644 --- a/devTools/scripts/sanityCheck.js +++ b/devTools/scripts/sanityCheck.js @@ -73,6 +73,7 @@ let customProblems = []; let spellingProblems = []; /** @type {Array<object>} */ let eslintProblems = []; +let eslintProblemCount = 0; /** @type {Array<string>} */ let typescriptProblems = []; @@ -111,6 +112,9 @@ if (settings.checksEnableSpelling === true) { if (settings.checksEnableESLint === true) { // @ts-ignore eslintProblems = await eslintChecks(settings.checksOnlyChangedESLint, stagedFiles, parser); + eslintProblems.forEach(problem => { + eslintProblemCount += problem.messages.length; + }); } if (settings.checksEnableTypescript === true) { // @ts-ignore @@ -164,8 +168,8 @@ if (spellingProblems.length > 0) { skippedChecks += 1; } -if (eslintProblems.length > 0) { - log(c.bold.red(`ESLint found ${eslintProblems.length} linting issues.`)); +if (eslintProblemCount > 0) { + log(c.bold.red(`ESLint found ${eslintProblemCount} linting issues.`)); } else if (settings.checksEnableESLint === true) { log(c.green(`ESLint found no linting issues.`)); } else { @@ -182,7 +186,7 @@ if (typescriptProblems.length > 0) { skippedChecks += 1; } -const issueCount = customProblems.length + spellingProblems.length + eslintProblems.length + typescriptProblems.length; +const issueCount = customProblems.length + spellingProblems.length + eslintProblemCount + typescriptProblems.length; log(""); let finalMessage = ""; @@ -202,7 +206,7 @@ log("=".repeat(60)); // exclude eslint and typescript problems from making git pre-commit hook fail // we may change this in the future -if ((issueCount - (eslintProblems.length + typescriptProblems.length)) > 0) { +if ((issueCount - (eslintProblemCount + typescriptProblems.length)) > 0) { if (args.staged === true) { log(`You can temporarily disable the pre-commit hook by changing 'Edit Sanity Check Settings' -> 'Running sanity checks before commiting' in "setup.${process.platform === "win32" ? "bat": "sh"}" to 'Sanity checks are temporarily disabled...'`); }