Biome configuration management including initialization, migration, and configuration file structure.
Bootstrap a new Biome project with a configuration file.
biome init [OPTIONS]Options:
# Create biome.jsonc instead of biome.json
--jsoncUsage Examples:
# Create biome.json with defaults
biome init
# Create biome.jsonc (JSON with comments)
biome init --jsoncBehavior:
biome.json (or biome.jsonc with --jsonc) in current directory.gitignore and enables VCS integration if founddist/ folder and adds to ignored pathsGenerated Configuration:
{
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignores": ["dist"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}Exit Codes:
0 - Configuration file created successfully1 - Error (e.g., file already exists, permission denied)Update configuration when there are breaking changes or migrate from other tools.
biome migrate [OPTIONS] [SUBCOMMAND]Options:
# Write the new configuration to disk
--writeUsage Examples:
# Migrate Prettier configuration (dry run)
biome migrate prettier
# Migrate Prettier and write to disk
biome migrate prettier --write
# Migrate ESLint configuration
biome migrate eslint --writeBehavior:
--write: Shows proposed changes without modifying files--write: Updates biome.json with migrated configurationMigrate Prettier configuration to Biome.
biome migrate prettier [OPTIONS]Detected Files:
.prettierrc.prettierrc.json.prettierrc.jsprettier.config.js.prettierignoreMigrated Settings:
Formatter options:
printWidth → formatter.lineWidthtabWidth → formatter.indentWidthuseTabs → formatter.indentStyle ("tab" or "space")semi → javascript.formatter.semicolonssingleQuote → javascript.formatter.quoteStylequoteProps → javascript.formatter.quotePropertiesjsxSingleQuote → javascript.formatter.jsxQuoteStyletrailingComma → javascript.formatter.trailingCommasbracketSpacing → javascript.formatter.bracketSpacingbracketSameLine → javascript.formatter.bracketSameLinearrowParens → javascript.formatter.arrowParenthesesendOfLine → formatter.lineEndingIgnore patterns:
.prettierignore → files.ignoresUsage Examples:
# Preview Prettier migration
biome migrate prettier
# Apply Prettier migration
biome migrate prettier --writeExit Codes:
0 - Migration successful1 - Error (e.g., no Prettier config found, invalid configuration)Migrate ESLint configuration to Biome.
biome migrate eslint [OPTIONS]Options:
# Include rules inspired by ESLint rules
--include-inspired
# Include nursery (experimental) rules
--include-nurseryDetected Files:
.eslintrc.eslintrc.json.eslintrc.jseslint.config.js.eslintignoreMigrated Rules:
Biome includes equivalents or inspired versions of many ESLint rules:
no-unused-vars, no-debugger, eqeqeq)@typescript-eslint/no-explicit-any)react/jsx-key, react-hooks/rules-of-hooks)jsx-a11y/alt-text)import/no-duplicates)Conversion:
"error" → Biome "error""warn" → Biome "warn""off" → Biome "off"0, 1, 2 → Biome "off", "warn", "error"Ignore patterns:
.eslintignore → files.ignoresUsage Examples:
# Preview ESLint migration
biome migrate eslint
# Apply ESLint migration
biome migrate eslint --write
# Include inspired rules
biome migrate eslint --write --include-inspired
# Include nursery rules
biome migrate eslint --write --include-nurseryExit Codes:
0 - Migration successful1 - Error (e.g., no ESLint config found, invalid configuration)Biome configuration is stored in biome.json or biome.jsonc (JSON with comments).
interface BiomeConfiguration {
// JSON schema URL for editor support
$schema?: string;
// Whether this is the root configuration
root?: boolean;
// Paths to other configuration files to extend
extends?: string[];
// File system configuration
files?: FilesConfiguration;
// Formatter configuration
formatter?: FormatterConfiguration;
// Linter configuration
linter?: LinterConfiguration;
// Assist configuration
assist?: AssistConfiguration;
// Language-specific configurations
javascript?: JavaScriptConfiguration;
json?: JsonConfiguration;
css?: CssConfiguration;
graphql?: GraphqlConfiguration;
html?: HtmlConfiguration;
grit?: GritConfiguration;
// Version control system configuration
vcs?: VcsConfiguration;
// Configuration overrides for specific file patterns
overrides?: OverrideConfiguration[];
// Plugins to load
plugins?: string[];
}Controls which files Biome processes and how.
interface FilesConfiguration {
// Glob patterns for files to include
includes?: string[];
// Glob patterns for files to ignore
ignores?: string[];
// Maximum file size to process (in bytes)
maxSize?: number;
// Ignore files with unknown extensions
ignoreUnknown?: boolean;
// Experimental scanner-level ignore patterns
experimentalScannerIgnores?: string[];
}Example:
{
"files": {
"includes": ["src/**/*.ts", "src/**/*.tsx"],
"ignores": [
"dist/**",
"build/**",
"node_modules/**",
"**/*.min.js"
],
"maxSize": 1048576,
"ignoreUnknown": true,
"experimentalScannerIgnores": [".cache/**", ".git/**"]
}
}Glob Pattern Syntax:
* - Matches any characters except /** - Matches any characters including /? - Matches single character[abc] - Matches one character from set{a,b} - Matches either a or bControls code formatting behavior.
interface FormatterConfiguration {
// Enable or disable formatter
enabled?: boolean;
// Allow formatting files with syntax errors
formatWithErrors?: boolean;
// Indent style: "tab" or "space"
indentStyle?: "tab" | "space";
// Number of spaces per indent level (if indentStyle is "space")
indentWidth?: number;
// Maximum line width before wrapping
lineWidth?: number;
// Line ending style
lineEnding?: "lf" | "crlf" | "cr";
// How to position attributes in HTML/JSX
attributePosition?: "auto" | "multiline";
// Add spaces inside object/array brackets
bracketSpacing?: boolean;
// Whether to place closing bracket on same line
bracketSameLine?: boolean;
// Control property expansion in objects/arrays
expand?: "auto" | "always" | "never";
// Read and apply .editorconfig settings
useEditorconfig?: boolean;
// File patterns to include in formatting
includes?: string[];
// File patterns to ignore in formatting
ignore?: string[];
}Example:
{
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"lineEnding": "lf",
"bracketSpacing": true,
"bracketSameLine": false,
"expand": "auto",
"useEditorconfig": true
}
}Defaults:
enabled: trueindentStyle: "space"indentWidth: 2lineWidth: 80lineEnding: "lf"bracketSpacing: truebracketSameLine: falseexpand: "auto"useEditorconfig: falseControls linting behavior and rule configuration.
interface LinterConfiguration {
// Enable or disable linter
enabled?: boolean;
// Rule configuration by category
rules?: RulesConfiguration;
// File patterns to include in linting
includes?: string[];
// File patterns to ignore in linting
ignore?: string[];
}
interface RulesConfiguration {
// Enable all recommended rules
recommended?: boolean;
// Rule group configurations
a11y?: RuleGroupConfiguration;
complexity?: RuleGroupConfiguration;
correctness?: RuleGroupConfiguration;
nursery?: RuleGroupConfiguration;
performance?: RuleGroupConfiguration;
security?: RuleGroupConfiguration;
style?: RuleGroupConfiguration;
suspicious?: RuleGroupConfiguration;
}
interface RuleGroupConfiguration {
// Enable all rules in this group
all?: boolean;
// Enable recommended rules in this group
recommended?: boolean;
// Individual rule configurations
[ruleName: string]: RuleConfiguration | boolean;
}
type RuleConfiguration =
| "off"
| "warn"
| "error"
| {
level: "off" | "warn" | "error";
options?: any;
};Example:
{
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error",
"noUnusedImports": "error"
},
"suspicious": {
"noExplicitAny": "warn",
"noDebugger": "error"
},
"style": {
"useConst": "error",
"useTemplate": "warn"
},
"nursery": {
"recommended": false
}
}
}
}Rule Groups:
a11y - Accessibility rules (e.g., noAccessKey, noAutofocus)complexity - Code complexity rules (e.g., noExcessiveCognitiveComplexity)correctness - Correctness rules (e.g., noUnusedVariables, noUnreachable)nursery - Experimental rules (disabled in recommended by default)performance - Performance rules (e.g., noAccumulatingSpread)security - Security rules (e.g., noDangerouslySetInnerHtml)style - Style rules (e.g., useConst, useTemplate)suspicious - Suspicious code patterns (e.g., noExplicitAny, noDebugger)Controls code assist features.
interface AssistConfiguration {
// Enable or disable assists
enabled?: boolean;
// Configure assist actions
actions?: AssistActionsConfiguration;
}
interface AssistActionsConfiguration {
// Enable recommended assists
recommended?: boolean;
// Source code action configuration
source?: SourceActionsConfiguration;
}
interface SourceActionsConfiguration {
// Organize imports action
organizeImports?: AssistAction;
}
type AssistAction =
| "on"
| "off"
| {
enabled: boolean;
options?: any;
};Example:
{
"assist": {
"enabled": true,
"actions": {
"recommended": true,
"source": {
"organizeImports": "on"
}
}
}
}interface JavaScriptConfiguration {
// Parser options
parser?: {
unsafeParameterDecoratorsEnabled?: boolean;
};
// Formatter overrides for JavaScript/TypeScript
formatter?: {
quoteStyle?: "single" | "double";
jsxQuoteStyle?: "single" | "double";
quoteProperties?: "asNeeded" | "preserve";
trailingCommas?: "all" | "es5" | "none";
semicolons?: "always" | "asNeeded";
arrowParentheses?: "always" | "asNeeded";
bracketSameLine?: boolean;
bracketSpacing?: boolean;
attributePosition?: "auto" | "multiline";
};
// Linter rule overrides for JavaScript/TypeScript
linter?: {
enabled?: boolean;
};
// Global variables
globals?: string[];
}Example:
{
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double",
"trailingCommas": "es5",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSameLine": false
},
"globals": ["window", "document", "$", "jQuery"]
}
}interface JsonConfiguration {
// Parser options
parser?: {
allowComments?: boolean;
allowTrailingCommas?: boolean;
};
// Formatter overrides for JSON
formatter?: {
trailingCommas?: "none" | "all";
};
// Linter rule overrides for JSON
linter?: {
enabled?: boolean;
};
}Example:
{
"json": {
"parser": {
"allowComments": true,
"allowTrailingCommas": false
},
"formatter": {
"trailingCommas": "none"
}
}
}interface CssConfiguration {
// Parser options
parser?: {
cssModules?: boolean;
};
// Formatter overrides for CSS
formatter?: {
enabled?: boolean;
indentStyle?: "tab" | "space";
indentWidth?: number;
lineWidth?: number;
};
// Linter rule overrides for CSS
linter?: {
enabled?: boolean;
};
}interface GraphqlConfiguration {
// Linter rule overrides for GraphQL
linter?: {
enabled?: boolean;
};
}interface HtmlConfiguration {
// Formatter overrides for HTML
formatter?: {
enabled?: boolean;
};
// Linter rule overrides for HTML
linter?: {
enabled?: boolean;
};
}Configuration for the experimental Grit pattern language search feature.
interface GritConfiguration {
// Currently empty - reserved for future Grit-specific options
}Note: Grit support is experimental. The configuration is reserved for future use when Grit-specific options become available.
Version control system integration.
interface VcsConfiguration {
// Enable VCS integration
enabled?: boolean;
// VCS client type
clientKind?: "git";
// Use VCS ignore file (.gitignore)
useIgnoreFile?: boolean;
// VCS root directory
root?: string;
// Default branch for --changed comparisons
defaultBranch?: string;
}Example:
{
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "main"
}
}Features:
.gitignore when useIgnoreFile is true--changed flag compares against defaultBranch--staged flag processes files in Git staging areaApply different configuration for specific file patterns.
interface OverrideConfiguration {
// Glob patterns to include
includes?: string[];
// Glob patterns to ignore
ignores?: string[];
// Override formatter configuration
formatter?: Partial<FormatterConfiguration>;
// Override linter configuration
linter?: Partial<LinterConfiguration>;
// Override language-specific configuration
javascript?: Partial<JavaScriptConfiguration>;
json?: Partial<JsonConfiguration>;
css?: Partial<CssConfiguration>;
graphql?: Partial<GraphqlConfiguration>;
html?: Partial<HtmlConfiguration>;
}Example:
{
"overrides": [
{
"includes": ["*.test.ts", "*.spec.ts"],
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "off"
}
}
}
},
{
"includes": ["*.config.js"],
"formatter": {
"lineWidth": 120
}
},
{
"includes": ["src/legacy/**"],
"linter": {
"enabled": false
}
}
]
}Behavior:
Extend configuration from other files.
interface BiomeConfiguration {
extends?: string[];
}Example:
{
"extends": [
"./base-config.json",
"./team-config.json"
],
"formatter": {
"lineWidth": 100
}
}Behavior:
Biome searches for configuration files in the following order:
--config-path CLI optionBIOME_CONFIG_PATH environment variablebiome.json or biome.jsonc in current directory"root": trueExample Directory Structure:
/project
biome.json (root: true)
/src
/components
biome.json (overrides for components)When running Biome in /project/src/components:
/project/src/components/biome.json/project/biome.json/project/biome.json because root: trueBiome configuration files support JSON schema for editor validation:
{
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json"
}Benefits:
Version-Specific Schemas:
https://biomejs.dev/schemas/{VERSION}/schema.jsonhttps://biomejs.dev/schemas/latest/schema.jsonpackages/@biomejs/biome/configuration_schema.json