CLI Usage
Oxc provides two command-line tools:oxlint for linting JavaScript and TypeScript code, and oxfmt for formatting.
oxlint CLI
The oxlint CLI provides fast, parallel linting with configurable rules, plugins, and output formats.Basic Usage
Core Options
Path to configuration file. Supports
.json, .jsonc, and experimental .ts/.js files (requires Node.js runtime).TypeScript configuration file for path aliases and project references (used by import plugin).
Initialize a new
.oxlintrc.json configuration file with default values.Rule Configuration
- Command Line
- Flags
Control which rules are enabled using command-line flags:Available Categories:
correctness- Code that is outright wrong or useless (default)suspicious- Code that is most likely wrong or uselesspedantic- Strict lints with occasional false positivesperf- Code that could be more performantstyle- Code that should be more idiomaticrestriction- Lints preventing specific language featuresnursery- New lints under developmentall- All categories except nursery
Plugin Options
oxlint includes multiple plugin systems. Some plugins are enabled by default.oxc- Oxc-specific rulestypescript- TypeScript rulesunicorn- Unicorn plugin rules
--react-plugin- React rules--import-plugin- Import/export validation (requires--tsconfig)--jsdoc-plugin- JSDoc comment validation--jest-plugin- Jest testing rules--vitest-plugin- Vitest testing rules (auto-enables jest)--jsx-a11y-plugin- JSX accessibility rules--nextjs-plugin- Next.js specific rules--react-perf-plugin- React performance rules--promise-plugin- Promise usage rules--node-plugin- Node.js rules--vue-plugin- Vue.js rules
Fix Options
Automatically fix safe issues. Only unfixed issues are reported.
Apply auto-fixable suggestions. May change program behavior.
Apply dangerous fixes and suggestions. Use with caution.
Ignore Options
Specify the ignore file to use.
Specify patterns to ignore (can be used multiple times).
Disable all ignore patterns and files.
Warning Options
Disable reporting warnings, only show errors.
Treat warnings as errors (non-zero exit code).
Exit with error if warnings exceed threshold.
Output Options
Output format for diagnostics.Available formats:
default- Human-readable formatstylish- Stylish formatjson- JSON outputunix- Unix-style formatcheckstyle- Checkstyle XML formatgithub- GitHub Actions formatgitlab- GitLab CI formatjunit- JUnit XML format
Advanced Options
Enable rules that require type information.
Enable experimental TypeScript compiler diagnostics.
Disable automatic loading of nested configuration files.
Report directive comments like
// oxlint-disable-line when no errors would have been reported.Same as above but specify severity:
warn, error, or off.Miscellaneous Options
Number of threads to use. Set to 1 for single-threaded execution.
Do not display any diagnostics.
Output the resolved configuration. No linting is performed.
List all available rules.
Start the Language Server Protocol server.
oxfmt CLI
The oxfmt CLI provides fast code formatting with Prettier-compatible options.Basic Usage
Mode Options
- Write (Default)
- Check
- List Different
- Stdin
Format and write files in place:
Configuration Options
Path to configuration file (
.oxfmtrc.json or .oxfmtrc.jsonc).Ignore Options
Path to ignore file(s). Can be specified multiple times. Defaults to
.gitignore and .prettierignore.Format code in
node_modules directory (skipped by default).Runtime Options
Number of threads to use. Set to 1 for single-threaded execution.
Do not exit with error when a pattern has no matches.
Special Modes
Initialize
.oxfmtrc.json with default values.Migrate configuration from another formatter. Sources:
prettier, biome.Start the Language Server Protocol server.
Path Specifications
Single file, path, or list of paths. Glob patterns and exclude patterns (with
! prefix) are supported.Examples
Terminal Output
- Write Mode
- Check Mode
- List Different
Integration Examples
CI/CD Pipeline
Package.json Scripts
package.json
See Also
- Configuration Guide - Detailed configuration options
- Node.js Integration - Using Oxc in Node.js
- Rust Integration - Using Oxc in Rust projects