Skip to content
Latchkey

ESLint "too many warnings (maximum: 0)" with Flat Config - Fix in CI

A CI lint step run with --max-warnings 0 fails if any rule reports a warning. After migrating to flat config, the set or severity of warnings can shift - newly-enabled recommended rules, a different plugin config spread in - so warnings that did not exist before now trip the zero-warning gate.

What this error means

ESLint exits non-zero with ESLint found too many problems ... (maximum: 0) or <N> warnings after a flat-config migration, even though there are no errors. The same code passed under the previous eslintrc setup.

eslint output
/app/src/api.ts
  12:7  warning  'data' is assigned a value but never used  @typescript-eslint/no-unused-vars

✖ 1 problem (0 errors, 1 warning)
ESLint found too many warnings (maximum: 0).

Common causes

Flat config surfaces new/re-leveled warnings

A spread-in recommended flat config enables rules (or sets them to warn) that the old eslintrc did not, so --max-warnings 0 now fails on warnings that previously did not exist.

Zero-warning gate with warn-level rules

Running --max-warnings 0 while keeping rules at warn is contradictory - any warn becomes a hard failure, so the gate and the rule levels disagree.

How to fix it

Fix the warnings or autofix them

Resolve the reported warnings (many are autofixable) so the zero-warning gate passes legitimately.

Terminal
npx eslint . --fix
# then re-run the gate
npx eslint . --max-warnings 0

Make rule levels match the gate

  1. Decide intent: if a rule must block CI, set it to error, not warn.
  2. If warnings are advisory, raise --max-warnings to a deliberate threshold instead of 0.
  3. Keep flat-config severities consistent with the CI gate so the two do not contradict.

How to prevent it

  • Align rule severities (error vs warn) with the --max-warnings gate.
  • Run eslint --fix to clear autofixable warnings before gating.
  • Re-audit warnings after a flat-config migration that spreads in recommended configs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →