Core commands for formatting, linting, and checking code quality with Biome.
Runs formatter, linter, and import sorting on files. This is the primary command for comprehensive code health checks.
biome check [OPTIONS] [PATHS]...Arguments:
[PATHS]... - Files, directories, or glob patterns to check. If omitted, checks current directory.Key Options:
# Apply safe fixes, formatting, and import sorting
--write
# Apply unsafe fixes (requires --write)
--unsafe
# Enable/disable individual tools
--formatter-enabled <true|false>
--linter-enabled <true|false>
--assist-enabled <true|false>
# Control assist enforcement
--enforce-assist <true|false> # Default: true
# Allow formatting files with syntax errors
--format-with-errors <true|false>
# Process stdin with specified file path
--stdin-file-path <PATH>
# VCS integration
--staged # Only check staged files
--changed # Only check changed files vs default branch
--since <REF> # Specify base ref for --changedUsage Examples:
# Check all files and apply safe fixes
biome check --write
# Check specific directory
biome check --write ./src
# Check with unsafe fixes
biome check --write --unsafe
# Check only staged files
biome check --staged
# Check changed files since main branch
biome check --changed
# Process stdin
echo "const x = 1" | biome check --stdin-file-path=file.js
# Disable linter, only run formatter
biome check --write --linter-enabled=falseExit Codes:
0 - No errors found1 - Errors found or fixes neededRuns the formatter on files to ensure consistent code style.
biome format [OPTIONS] [PATHS]...Arguments:
[PATHS]... - Files, directories, or glob patterns to format. If omitted, formats current directory.Key Options:
# Write formatted output to files
--write
# Process stdin with specified file path
--stdin-file-path <PATH>
# VCS integration
--staged # Only format staged files
--changed # Only format changed files
--since <REF> # Specify base ref for --changedUsage Examples:
# Format all files
biome format --write
# Format specific files
biome format --write src/index.ts src/utils.ts
# Format and output to stdout (without --write)
biome format src/index.ts
# Format staged files
biome format --write --staged
# Format changed files
biome format --write --changed
# Process stdin
echo "const x=1" | biome format --stdin-file-path=file.jsFormatting Behavior:
--write: Outputs formatted code to stdout and exits with code 1 if formatting would change the file--write: Writes formatted code back to filesbiome.jsonExit Codes:
0 - All files already formatted correctly (with --write) or formatted successfully1 - Formatting changes needed (without --write) or errors occurredRuns the linter on files to detect and fix code quality issues.
biome lint [OPTIONS] [PATHS]...Arguments:
[PATHS]... - Files, directories, or glob patterns to lint. If omitted, lints current directory.Key Options:
# Write safe fixes
--write
# Apply unsafe fixes (requires --write)
--unsafe
# Add comment suppressions instead of fixes
--suppress
# Explanation for suppressions
--reason <STRING>
# Run only specific rules, groups, or domains
--only <GROUP|RULE|DOMAIN> # Can be repeated
# Skip specific rules, groups, or domains
--skip <GROUP|RULE|DOMAIN> # Can be repeated
# Process stdin with specified file path
--stdin-file-path <PATH>
# VCS integration
--staged # Only lint staged files
--changed # Only lint changed files
--since <REF> # Specify base ref for --changedUsage Examples:
# Lint all files and apply safe fixes
biome lint --write
# Lint without fixing (report only)
biome lint
# Apply safe and unsafe fixes
biome lint --write --unsafe
# Suppress violations with comments
biome lint --suppress --reason "Legacy code"
# Run only specific rules
biome lint --only=correctness/noUnusedVariables
biome lint --only=correctness --only=suspicious
# Skip specific rules
biome lint --skip=style/useConst --skip=suspicious/noExplicitAny
# Lint staged files
biome lint --write --staged
# Process stdin
echo "var x = 1" | biome lint --stdin-file-path=file.jsRule Filtering:
--only runs specified rules, groups, or domains exclusively--skip excludes specified rules, groups, or domains (takes precedence over --only)correctness/noUnusedVariablescorrectness, suspicious, style, etc.Fix Modes:
--write): Fixes that are guaranteed not to change behavior--unsafe): Fixes that might change behavior but are likely correct--suppress): Adds comment directives to suppress violationsExit Codes:
0 - No violations found1 - Violations foundRuns formatter, linter, and import sorting in read-only mode for CI environments. Does not modify files.
biome ci [OPTIONS] [PATHS]...Arguments:
[PATHS]... - Files, directories, or glob patterns to check. If omitted, checks current directory.Key Options:
# Enable/disable individual tools
--formatter-enabled <true|false>
--linter-enabled <true|false>
--assist-enabled <true|false>
# Control assist enforcement
--enforce-assist <true|false> # Default: true
# Allow checking files with syntax errors
--format-with-errors <true|false>
# Only check changed files
--changed
--since <REF> # Specify base ref for --changed
# Thread control for resource-limited environments
--threads <NUMBER>Usage Examples:
# Run all checks in CI mode
biome ci
# Check specific directory
biome ci ./src
# Check only changed files
biome ci --changed
# Limit threads in resource-constrained CI
biome ci --threads=2
# Disable formatter, only lint
biome ci --formatter-enabled=false
# Output diagnostics in GitHub Actions format
biome ci --reporter=github
# Output in JUnit XML format
biome ci --reporter=junitCI Mode Behavior:
--colors off specified)Exit Codes:
0 - All checks passed1 - One or more checks failedShows the Biome version information and exits.
biome versionUsage Examples:
biome versionOutput: Displays version information for the Biome CLI and exits immediately.
Exit Codes:
0 - Always succeedsAll core commands support processing code from stdin when --stdin-file-path is provided:
--stdin-file-path <PATH>Behavior:
.js, .mjs, .cjs → JavaScript.ts, .mts, .cts → TypeScript.jsx, .tsx → JSX/TSX.json, .jsonc → JSON.css → CSSExamples:
# Format code from stdin
echo "const x=1" | biome format --stdin-file-path=file.js
# Lint code from stdin
cat src/file.ts | biome lint --stdin-file-path=file.ts
# Check code from stdin
echo "var x = 1" | biome check --stdin-file-path=file.jsCore commands integrate with version control systems to selectively process files:
Process only files staged with git add:
--stagedUsage:
biome check --write --staged
biome format --write --staged
biome lint --write --stagedNotes:
--changedProcess only files changed compared to a base branch:
--changed
--since <REF>Usage:
# Check changed files vs default branch
biome check --changed
# Check changed files vs specific ref
biome check --changed --since=origin/main
# Format changed files
biome format --write --changed
# CI: only check changed files
biome ci --changed --since=mainNotes:
--stagedvcs.defaultBranch in biome.json--since overrides default branch settingAll core commands accept file paths, directories, or glob patterns:
# Single file
biome check --write src/index.ts
# Multiple files
biome check --write src/index.ts src/utils.ts
# Directory
biome check --write src/
# Glob patterns (use quotes to prevent shell expansion)
biome check --write "src/**/*.ts"
biome check --write "src/**/*.{ts,tsx,js,jsx}"
# Current directory (default)
biome check --writeFile Discovery:
files.includes and files.ignores in biome.json.gitignore when VCS integration enabled.biomeignore filesfiles.maxSizefiles.ignoreUnknown is false)All core commands support global CLI options. See Global Options for details:
--colors)--config-path)--verbose, --max-diagnostics, --diagnostic-level)--skip-parse-errors, --error-on-warnings)--reporter)--log-file, --log-level, --log-kind)--use-server)