Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--quiet mode prevents 0 exit code #417

Open
steveszc opened this issue Nov 17, 2022 · 0 comments
Open

--quiet mode prevents 0 exit code #417

steveszc opened this issue Nov 17, 2022 · 0 comments

Comments

@steveszc
Copy link

steveszc commented Nov 17, 2022

Noting this mostly for visibility for future travelers. Not clear if there is even a fix (other than a patch-package).
Another note: This is related to #394, but is not fixable by pinning to [email protected].

eslint --quiet mode prevents eslint from producing a 0 exit code when eslint-formatter-todo is used and all lint errors are marked as todos.

This is due to an issue in eslint itself, originally noted here #394 (comment)

When the --quiet flag is present eslint filters out non-error results before passing the results into the formater, which means eslint-formatter-todo never even sees the errors to mutate them into todos, but when eslint later calculates the error code it does so based on the original unfiltered results.

https://github.com/eslint/eslint/blob/740b20826fadc5322ea5547c1ba41793944e571d/lib/cli.js#L427-L443

Since this is an issue in eslint itself, and changing this in eslint is probably not feasible, I am noting a potential fix via patch-package here:

// patches/eslint+8.24.0.patch

diff --git a/node_modules/eslint/lib/cli.js b/node_modules/eslint/lib/cli.js
index 2fca65c..1cfcd2b 100644
--- a/node_modules/eslint/lib/cli.js
+++ b/node_modules/eslint/lib/cli.js
@@ -407,7 +407,7 @@ const cli = {
             resultsToPrint = ActiveESLint.getErrorResults(resultsToPrint);
         }
 
-        if (await printResults(engine, resultsToPrint, options.format, options.outputFile)) {
+        if (await printResults(engine, results, options.format, options.outputFile)) {
 
             // Errors and warnings from the original unfiltered results should determine the exit code
             const { errorCount, fatalErrorCount, warningCount } = countErrors(results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant