feat: add hooks.biome.settings.flags for extra CLI flags#716
Open
lew wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
flagsoption to the biome hook so users can pass arbitrary CLI flags tobiome check, mirroring the existinghooks.black.settings.flagspattern.Motivation
The biome hook currently exposes only
binPath,write, andconfigPath. There's no escape hatch for CLI flags that have nobiome.jsonequivalent.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 touchingpackage.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.entryvialib.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:options.settings.flagson the biome submodule (defaults to empty string).cmdArgslist builder so the flags are appended to the entry when set.The pattern is a direct copy of the
hooks.black.settings.flagsoption that lives a few lines below in the same file.Usage
Test plan
nix flake check --no-buildpasses (validates all module evaluations including the biome submodule's new option).(flags != "")correctly gates inclusion inmkCmdArgs, matching the convention used by the siblingconfigPathpredicate.flags(empty string → no extra arg appended).