With ESLint 10, what does the --quiet flag change, and how does it interact with --max-warnings?
answer
- output filter and a run filter
- changed in ESLint 9.0.0
- warn rules skipped entirely
- a threshold brings them back
- hidden but still counted
basics
~20 sWith ESLint 10, --quiet reports only errors and, since ESLint 9.0.0, does not even run rules set to warn. Add --max-warnings and the warn rules run again: their warnings stay hidden but still count toward the threshold.
solid answer
~40 s`--quiet` reports errors only. Since ESLint 9.0.0 it also stops rules set to `"warn"` from running at all, which can speed up a config with many warn-level rules; ESLint 8 ran them and just hid the output. The exception is `--max-warnings`: when both flags are set, warn rules run so their warnings can be counted, but they are still left out of the report. That produces a confusing CI log: `eslint --quiet --max-warnings 0 .` can print no problems and still exit with `1`, with only `ESLint found too many warnings (maximum: 0).` to explain it. `--quiet` never changes the exit code by itself, because warnings never fail a run without a threshold. Combined with `--fix`, it applies only the fixes of error-level problems.
go deeper
Remember that --quiet shows errors only, and that it never changes whether a warnings-only run passes, because such a run already exits with 0.
Explain the two filters, output and run, and the ESLint 9.0.0 change that made warn rules stop running under --quiet unless --max-warnings is set.
Diagnose the red build with an empty report: --quiet --max-warnings 0 counted hidden warnings. Know the side-effect case where skipping a warn rule changes what an error rule reports.
Decide what a CI log must show to be actionable: a gate that fails without printing its reason costs every developer a local rerun, so pair thresholds with visible warnings.
## Two jobs in one flag The ESLint CLI groups `--quiet` and `--max-warnings` under **Handle Warnings**. They look like opposites, one hiding warnings and one failing on them, but in ESLint 10 `--quiet` actually does two different things: - **An output filter.** Only error-level problems reach the formatter, so the console or the `-o` report file shows errors and nothing else. - **A run filter.** Rules configured as `"warn"` are not executed at all; only rules set to `"error"` run. The second job is the one people miss. It arrived in **ESLint 9.0.0**: before that release, `--quiet` ran every rule set to `"error"` or `"warn"` and then dropped the warning results. The migration guide gives the reason for the change as performance for configurations with many warn-level rules. ## How `--max-warnings` changes `--quiet` `--max-warnings n` makes ESLint exit with `1` when the warning count is greater than `n`. A warning that never ran cannot be counted, so ESLint resolves the conflict this way: | Flags | Warn rules run? | Warnings printed? | Warnings counted for the exit code? | |---|---|---|---| | none | yes | yes | no threshold | | `--quiet` | no | no | no threshold | | `--max-warnings 0` | yes | yes | yes | | `--quiet --max-warnings 0` | yes | no | yes | The last row is the trap. The exit code is computed from the full results, before the output filter, so a run can print an empty report and still return `1`. The only clue is the line `ESLint found too many warnings (maximum: 0).` printed after the report. When a developer asks why CI is red with "no problems", check for this flag pair. The counted warnings are not only rule warnings. If a file you name explicitly on the command line is ignored, ESLint adds a `File ignored ...` warning for it, and that warning is counted too, even under `--quiet`. ## A worked example Suppose a config sets `no-unused-vars` to `"error"` and `no-console` to `"warn"`, and one file has an unused variable and a `console.log` call: ```bash npx eslint . # 1 error, 1 warning shown; exit 1 npx eslint --quiet . # 1 error shown; no-console never ran; exit 1 npx eslint --quiet --max-warnings 0 . # 1 error shown; no-console ran, hidden; exit 1 ``` Remove the unused variable and the three commands return `0`, `0` and `1`: only the last one still counts the hidden `no-console` warning. ## What `--quiet` does not do 1. It does not change the exit code on its own. A run with only warnings already returns `0`, and a run with an error still returns `1`. 2. It does not hide errors. Error-level problems are printed exactly as without the flag. 3. It does not change any rule's severity. The config is untouched; the flag only filters what runs and what is printed. With `--fix`, `--quiet` limits the fixes ESLint writes to error-level problems, so a fixable warning is left in place. ## When the 9.0.0 change bites Skipping warn-level rules is invisible for almost every config. The migration guide names one case where it is not: a rule set to `"warn"` that changes data other rules read, for example by marking a variable as used. Under `--quiet` that rule no longer runs, so a rule set to `"error"` that depends on its side effect can start reporting problems that the same command without `--quiet` does not. The documented fixes are to set the helper rule to `"error"` or to stop using `--quiet`. ## Choosing between them in CI - Use `--quiet` when a job only cares about errors and you want both shorter logs and less work, for example a fast pre-merge check while warn-level rules are still being cleaned up. - Use `--max-warnings` when warnings must fail the job; leave `--quiet` off so the warnings that caused the failure are printed. - Avoid `--quiet --max-warnings 0` in CI unless the log also says why it failed: it buys no speed, because the warn rules run anyway, and it hides the evidence. The VS Code ESLint extension has its own `eslint.quiet` setting, off by default, which ignores warnings in the editor; it is an editor display choice and does not affect the CLI.
- Why would `--quiet` make an error-level rule report a problem it does not report without the flag?Because since ESLint 9.0.0 `--quiet` skips warn-level rules entirely. If a rule set to `"warn"` has a side effect another rule relies on, such as marking a variable as used, that side effect disappears under `--quiet`. ESLint's migration guide says to set that rule to `"error"` or stop using `--quiet`.
- Does `eslint --quiet --max-warnings 0` run faster than `eslint --max-warnings 0`?Not meaningfully. With `--max-warnings` set, ESLint still runs the warn-level rules so it can count their warnings; `--quiet` only removes them from the printed report. The work is the same and the log loses the evidence for a failure.
- --quiet makes a run with warnings pass that would otherwise fail.
- In ESLint 10, --quiet still runs warn-level rules and only hides the output.
- With --quiet set, warnings no longer count toward --max-warnings.
- --quiet hides errors as well as warnings to keep CI logs short.
- --quiet downgrades warn rules to off in the configuration.
Assumes ESLint 10; since ESLint 9.0.0 --quiet skips running warn-level rules unless --max-warnings is set, whereas ESLint 8 ran them and only hid their output.