lpm fmt
Format source files with managed Biome, or check formatting in CI without changing files.
lpm fmt runs Biome in the current directory or selected workspace members.
lpm fmt [OPTIONS] [ARGS]...Quickstart
lpm fmt
lpm fmt src/
lpm fmt --checkThe default mode writes formatting changes. --check reports formatting errors without changing source files. Watch mode reports errors after each change.
LPM CLI downloads and checks the managed Biome binary on first use. Later runs reuse that installation.
To run a package.json script named fmt, use lpm run fmt.
Configuration
Put formatting rules in biome.json or biome.jsonc. Biome discovers configuration from the working directory.
{
"formatter": {
"indentStyle": "space",
"indentWidth": 2
}
}Pin the managed binary in lpm.json:
{
"tools": {
"biome": "2.6.2"
}
}Runs from a subdirectory still use the project pin. A member inherits the workspace root pin unless its own lpm.json overrides it.
Without a pin, LPM CLI selects its bundled version or a newer version previously installed by lpm plugin update biome. Normal formatting runs do not check for newer releases.
Plugin updates do not change project pins. Edit or remove tools.biome to change that selection. There is no command-line version override.
Invalid lpm.json stops a single-package run. Invalid root lpm.json stops a workspace run. Invalid member lpm.json fails that member while others continue.
The command does not use tasks.fmt or env.fmt from lpm.json.
Examples
Format selected files
lpm fmt src/ tests/
lpm fmt -- --indent-style=space src/
lpm fmt -- --config-path ./config/biome.json src/Without paths, Biome uses the current directory. Put LPM CLI flags before the forwarded arguments. Use -- to pass Biome options unchanged.
Check formatting in CI
lpm fmt --check
lpm fmt --check --filter web --fail-if-no-match
lpm fmt --check --all --jsonThese commands need no prompt. A missing managed binary still requires a network download.
--check rejects forwarded --write and --fix options before running Biome.
Watch formatting errors
lpm fmt -- --watch
lpm fmt --filter web -- --watchWatch mode checks formatting without writing changes. It requires exactly one selected member in workspace mode.
Watch mode rejects --json, --write, and --fix. Biome's --watch flag does not accept a value such as false.
Inspect Biome options
lpm fmt -- --helpWorkspaces
lpm fmt --all
lpm fmt --check --filter web --filter api
lpm fmt --check --filter './apps/*'
lpm fmt --check --filter-prod '...shared'
lpm fmt --check --affected --base origin/mainSelected dependencies run before their dependents. Independent members can run concurrently, up to the host CPU count. Each process uses its member directory.
LPM CLI prepares requested tool versions before starting member processes. Members with the same requested pin share a prepared binary.
--all conflicts with --filter, --filter-prod, and --affected. Filters and --affected combine their selections.
An empty selection succeeds without running Biome. Add --fail-if-no-match when a selected member must exist. Watch mode always rejects an empty selection.
See workspace filters for dependency closures, exclusions, path patterns, and Git references.
JSON and exit codes
lpm fmt --check --json
lpm fmt --check --all --jsonBoth modes emit one JSON object with member results, exit codes, and durations. Failed members include captured diagnostics. Successful members omit captured output.
A launch failure has exit_code: null and an error message. Errors before member execution can use the standard error object.
See the lpm lint JSON example for the envelope shape.
LPM CLI retains at most 10 MiB per output stream, with a truncation marker for longer diagnostics.
Single-package runs preserve Biome's exit code. Workspace runs exit 1 if any member fails. On Unix, interruption stops active tool descendants and exits 130 for SIGINT or 143 for SIGTERM.
Cache and recovery
Managed binaries normally live under ~/.lpm/plugins/biome/<version>/<platform>/. LPM_HOME changes the base directory.
If a cached binary fails its integrity check, LPM CLI downloads and checks it again. To force a fresh installation:
LPM_FORCE_TOOL_INSTALL=1 lpm fmt --checkIf configuration parsing fails, correct the reported configuration file before retrying. If files are unexpectedly excluded, inspect Biome's ignore and include rules.
Flags
| Flag | Effect |
|---|---|
--check | Check formatting without changing source files. |
--all | Run in every workspace member. Conflicts with filters and --affected. |
--filter <FILTER> | Select members with a repeatable workspace filter. |
--filter-prod <FILTER_PROD> | Select members with production-only dependency closures. |
--affected | Select changed members and their affected dependents. |
--base <BASE> | Git base for --affected. Default: main. |
--changed-files-ignore-pattern <PATTERN> | Ignore matching changed paths. Repeatable. |
--test-pattern <PATTERN> | Treat matching changes as tests when calculating dependent selection. Repeatable. |
--fail-if-no-match | Fail when the workspace selection is empty. |
[ARGS]... | Arguments forwarded to biome format. Use -- to separate them from LPM CLI flags. |
See global flags for --json and other shared options.
See also
lpm lint— find JavaScript and TypeScript code errors.lpm check— check TypeScript types.lpm plugin— inspect and update managed tools.- Built-in tools — tool selection and installation.