Configuration
Oxc tools use JSON-based configuration files for customizing behavior. This guide covers both oxlint and oxfmt configuration formats.oxlint Configuration
Configuration File
oxlint reads configuration from.oxlintrc.json or .oxlintrc.jsonc (JSON with comments).
Configuration Schema
URI to JSON schema for editor autocomplete and validation.
Array of plugin names to enable. Setting this field overrides the default plugins.Available plugins:
typescript(default)unicorn(default)oxc(default)reactimportjsdocjestvitestjsx-a11ynextjsreact-perfpromisenodevue
Enable or disable collections of global variables.Available environments:
browser- Browser globals (window, document, etc.)node- Node.js globals (process, Buffer, etc.)es2015,es2017,es2020,es2021, etc. - ECMAScript version globalsbuiltin- Built-in JavaScript globals (default: true)
Define custom global variables.Values:
"readonly"or"readable"- Read-only global"writable"or"writeable"- Writable global"off"- Disable the global
Set severity levels for entire rule categories.Categories:
correctness- Outright wrong or useless codesuspicious- Most likely wrong codepedantic- Strict rules with occasional false positivesperf- Performance improvementsstyle- Idiomatic style improvementsrestriction- Language feature restrictionsnursery- New rules under development
Configure individual rules with severity and options.Severity levels:
"off"or0- Disable rule"warn"or1- Warning"error"or2- Error
- Simple:
"rule-name": "error" - With options:
"rule-name": ["error", { "option": value }]
Plugin-specific settings shared across rules.
Glob patterns for files to ignore. Resolved from configuration file location.
Inherit configuration from other files. Files are merged in order, with later files overriding earlier ones.
Override rules for specific files or patterns.
Enable ESLint plugins written in JavaScript (experimental).
Real-World Examples
- React + TypeScript
- Node.js Project
- Monorepo
.oxlintrc.json
oxfmt Configuration
Configuration File
oxfmt reads configuration from.oxfmtrc.json or .oxfmtrc.jsonc.
.oxfmtrc.jsonc
Formatting Options
Maximum line width before wrapping.
Number of spaces per indentation level.
Use tabs instead of spaces for indentation.
Print semicolons at the end of statements.
Use single quotes instead of double quotes.
When to quote object properties.Options:
"as-needed", "consistent", "preserve"Use single quotes in JSX.
Print trailing commas where valid in ES5.Options:
"none", "es5", "all"Print spaces between brackets in object literals.
true:{ foo: bar }false:{foo: bar}
Put the
> of multi-line elements at the end of the last line.Include parentheses around sole arrow function parameter.Options:
"always", "avoid""always":(x) => x"avoid":x => x
How to wrap prose (markdown, etc.).Options:
"always", "never", "preserve"Whitespace sensitivity for HTML, Vue, Angular.Options:
"css", "strict", "ignore"Line ending style.Options:
"lf", "crlf", "cr"Insert a final newline at the end of files.
Format embedded code (CSS-in-JS, etc.).Options:
"auto", "off"Glob patterns for files to ignore.
Advanced Options
How to wrap object literals.Options:
"preserve", "always", "never"EditorConfig Support
oxfmt respects.editorconfig settings. Configuration file options override EditorConfig values.
Supported EditorConfig properties:
indent_style→useTabsindent_size→tabWidthmax_line_length→printWidthend_of_line→endOfLineinsert_final_newline→insertFinalNewline
Prettier Compatibility
oxfmt aims for Prettier compatibility with most options. Some differences:- No
"auto"value forendOfLine embeddedLanguageFormattingsupport is incomplete for some languages- Custom
objectWrapoption (Oxfmt extension)
Migration from Prettier
.prettierrc, .prettierrc.json, or prettier.config.js and generates .oxfmtrc.json.
Configuration Discovery
Both tools search for configuration files in the following order:- Command-line specified config (
-cor--config) - Configuration file in current directory
- Configuration file in parent directories (up to root)
.oxlintrc.json → .oxlintrc.jsonc → oxlint.config.ts → oxlint.config.js
oxfmt: .oxfmtrc.json → .oxfmtrc.jsonc
See Also
- CLI Usage - Command-line options and flags
- Rules Documentation - Complete rule reference
- Prettier Options - Prettier configuration reference