Skip to content

feat: add hooks.biome.settings.flags for extra CLI flags#716

Open
lew wants to merge 1 commit into
cachix:masterfrom
lew:feat-biome-flags
Open

feat: add hooks.biome.settings.flags for extra CLI flags#716
lew wants to merge 1 commit into
cachix:masterfrom
lew:feat-biome-flags

Conversation

@lew
Copy link
Copy Markdown

@lew lew commented May 26, 2026

Summary

Adds a flags option to the biome hook so users can pass arbitrary CLI flags to biome check, mirroring the existing hooks.black.settings.flags pattern.

Motivation

The biome hook currently exposes only binPath, write, and configPath. There's no escape hatch for CLI flags that have no biome.json equivalent.

The most common need is --no-errors-on-unmatched: biome exits with code 1 whenever zero files are processed, which happens on commits that touch only files biome excludes (e.g. dep-only commits touching package.json + bun.lock, or generated-file-only commits). The official biome git-hooks recipe recommends this flag specifically. Same friction also blocks #633.

Today users have to override hooks.biome.entry via lib.mkForce, which is fragile (it duplicates the entire entry string and goes stale when upstream updates the wiring).

Change

Two additions in modules/hooks.nix:

  1. options.settings.flags on the biome submodule (defaults to empty string).
  2. A predicate entry in the cmdArgs list builder so the flags are appended to the entry when set.

The pattern is a direct copy of the hooks.black.settings.flags option that lives a few lines below in the same file.

Usage

git-hooks.hooks.biome = {
  enable = true;
  settings.flags = "--no-errors-on-unmatched";
};

Test plan

  • nix flake check --no-build passes (validates all module evaluations including the biome submodule's new option).
  • Manual review: the predicate (flags != "") correctly gates inclusion in mkCmdArgs, matching the convention used by the sibling configPath predicate.
  • Default behavior is unchanged for users not setting flags (empty string → no extra arg appended).

Mirrors the existing 'black' hook pattern so users can pass arbitrary
CLI flags such as --no-errors-on-unmatched (commonly needed when staged
files are all excluded by biome's own config, e.g. dep-only or generated-
file-only commits).

Unblocks workarounds that override hooks.biome.entry via lib.mkForce.
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

Successfully merging this pull request may close these issues.

1 participant