biome check --write: Apply Fixes and Formatting
biome check --write runs the formatter, linter safe fixes, and import sorting and saves all the changes.
This is the modern replacement for v1 check --apply. It is the one command to clean a file: format it, apply safe lint fixes, and sort imports.
What it does
biome check --write runs format, linter safe fixes, and import organization together and writes the results. Adding --unsafe also applies fixes that Biome marks unsafe because they may change behavior or need review.
Common usage
npx @biomejs/biome check --write ./src
# include unsafe fixes (review the diff afterward)
npx @biomejs/biome check --write --unsafe ./srcOptions
| Flag | What it does |
|---|---|
| --write | Apply safe fixes and formatting and save |
| --unsafe | Also apply unsafe fixes (with --write) |
| --staged | Limit to git-staged files |
| --changed | Limit to files changed against the base |
| --formatter-enabled=false | Apply only fixes, skip formatting |
In CI
Do not use --write in a verification job; run plain check or ci so the build fails instead of silently fixing. Use --write in local pre-commit hooks or in a dedicated bot that opens a fix-up PR. --unsafe should never run unattended without a human reviewing the diff.
Common errors in CI
In v1 this was check --apply / --apply-unsafe; on v2 those names are gone and "unexpected argument --apply found" means you are on v2 syntax with v1 flags. If --write leaves files dirty in CI, the job will still pass since check exits 0 after a successful write; that is why CI should omit --write.