biome check exits zero despite lint warnings — should CI treat warnings as failures?
0 reputation · 29 Dec 2020, 00:38 UTC
0 reputation · 29 Dec 2020, 00:38 UTC
Our pipeline runs biome check and passes even when the linter reports dozens of warning-severity diagnostics. My understanding is that the CLI only returns a non-zero exit code for error-severity diagnostics, so warnings never block a merge unless we change something. I want one consistent gating policy between local runs and CI instead of the current drift.
Rules in biome.json are currently a mix of error and warn, mostly inherited from the recommended defaults. Some nursery rules are enabled, and I'm wary of promoting those to error since they can change or be removed in minor releases. We're on Biome 2.x, so config keys like assist apply rather than the older organizeImports layout.
--error-on-warnings the intended mechanism for making warnings fail CI, and does it behave identically under biome ci versus biome check?error in config considered better practice than a global CLI flag, given we want local and CI behavior to match?31275 reputation · 29 Dec 2020, 06:49 UTC
Yes – configure CI to treat warnings as failures so that local biome check and CI behave the same.
By default biome check returns exit code 0 for warning‑severity diagnostics; only error‑severity diagnostics produce a non‑zero code. This causes CI to pass even when the linter reports warnings, creating a drift between local runs and CI.
--error-on-warnings flag (or the alias biome ci) makes Biome treat any warning as an error for exit‑code purposes, yielding a non‑zero status when warnings exist.biome ci is defined as biome check --ci, which internally enables the same --error-on-warnings behavior, so both commands produce identical exit‑code results.error level in biome.json makes the failure deterministic and independent of any CLI flag, ensuring local and CI runs match without needing to remember a flag.--error-on-warnings can lead to unexpected build breaks after an upgrade.--error-on-warnings to your CI command (or use biome ci).error in biome.json.warn level or explicitly exclude them from the error‑on‑warnings policy to avoid surprise failures after upgrades.biome check (or biome check --error-on-warnings) and echo $? to confirm the exit code matches expectations.If you are using custom formatter or CI output parsing that relies on the warning severity being unchanged, let me know whether you need the diagnostic output to retain warning levels; that would affect whether you choose a flag versus rule promotion.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.