oxlint CLI Reference
oxlint is a high-performance JavaScript and TypeScript linter written in Rust. It’s designed to catch errors and enforce code quality without requiring a configuration file.Installation
Basic Usage
Commands
Default Command (Lint)
The default command runs the linter on specified paths.Special Commands
List all available linting rules with their categories and descriptions.
Initialize a new
.oxlintrc.json configuration file with default values.Start the Language Server Protocol (LSP) server for editor integration.
Configuration Options
Basic Configuration
Path to the oxlint configuration file.Supported formats:
.jsonand.jsoncfiles (all runtimes)- JavaScript/TypeScript config files (experimental, requires Node.js)
- Comments are supported in configuration files
- Compatible with ESLint v8’s format
.oxlintrc.json, .oxlintrc.jsonc, or oxlint.config.ts in the current directory.Path to TypeScript
tsconfig.json for reading path aliases and project references (used by the import plugin).If not provided, oxlint looks for tsconfig.json in the current working directory.Disable automatic loading of nested configuration files.By default, oxlint loads configuration files found in subdirectories. This flag disables that behavior.
Rule Configuration
oxlint uses a category-based rule system. Rules can be enabled or disabled using command-line flags.Rule Categories
correctness- Code that is outright wrong or useless (enabled by 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 written more idiomaticallyrestriction- Lints preventing use of language/library featuresnursery- New lints under developmentall- All categories except nursery (does not auto-enable plugins)
Allow (suppress) a rule or category.Can be specified multiple times. Rules are processed left-to-right.
Warn on a rule or category (emit a warning instead of error).
Deny (enable) a rule or category (emit an error).
Fix Options
Automatically fix as many issues as possible.Only safe fixes are applied. Unfixed issues are still reported.
Apply auto-fixable suggestions.Warning: May change program behavior.
Apply dangerous fixes and suggestions.Warning: May significantly change program behavior. Review changes carefully.
Plugin Options
Plugins extend oxlint with additional rules. Some plugins are enabled by default.Enabled by Default
oxc- Oxc-specific rulestypescript- TypeScript rulesunicorn- Unicorn plugin rules
Disable the oxc plugin (enabled by default).
Disable TypeScript plugin (enabled by default).
Disable unicorn plugin (enabled by default).
Optional Plugins
Enable import plugin to detect ESM problems.Use with
--tsconfig if your project uses a non-standard tsconfig name.Enable React plugin for React-specific rules.
Enable JSX accessibility plugin to detect accessibility issues.
Enable Next.js plugin for Next.js-specific rules.
Enable React performance plugin to detect rendering performance issues.
Enable JSDoc plugin to detect JSDoc problems.
Enable Jest plugin for Jest test rules.
Enable Vitest plugin for Vitest test rules.
Enable promise plugin to detect promise usage issues.
Enable Node.js plugin for Node.js-specific rules.
Enable Vue plugin for Vue.js-specific rules.
Type Checking
Enable rules that require type information.Requires a valid TypeScript configuration.
Enable experimental type checking (includes TypeScript compiler diagnostics).
Warning Options
Disable reporting warnings, only report errors.
Ensure warnings produce a non-zero exit code.Useful in CI/CD pipelines to fail builds on warnings.
Specify maximum number of warnings allowed.Exit with error status if warning count exceeds this threshold.
Output Options
Specify the output format.Available formats:
default- Human-readable format (auto-detects GitHub Actions)stylish- Stylized output formatjson- JSON format for programmatic parsingunix- Unix-style outputcheckstyle- Checkstyle XML formatgithub- GitHub Actions formatgitlab- GitLab formatjunit- JUnit XML format
github format.Do not display any diagnostics.
Ignore Options
Specify the file to use as your ignore file.
Specify patterns of files to ignore (in addition to those in ignore file).Can be specified multiple times. Uses same syntax as
.eslintignore and .gitignore.
Quote patterns to avoid shell interpretation.Disable excluding files from
.eslintignore files, --ignore-path, and --ignore-pattern flags.Inline Configuration Comments
Report directive comments like
// oxlint-disable-line when no errors would have been reported on that line.Helps keep codebase clean of unnecessary disable directives.Same as
--report-unused-disable-directives, but specify severity level.Options: allow, warn, deny, errorOnly one of these options can be used at a time.Performance Options
Number of threads to use for linting.Set to 1 to use only 1 CPU core. By default, uses all available CPU cores.
Miscellaneous
Output the configuration that would be used for linting.No linting is performed when this flag is present.
Exit Codes
oxlint uses the following exit codes:| Exit Code | Meaning |
|---|---|
| 0 | Success - no linting errors found |
| 1 | Failure - linting errors found, invalid configuration, or other errors |
-
0 (Success)
- No errors found
--rulesor--print-configexecuted successfully--initexecuted successfully- No files found (currently returns success)
-
1 (Failure)
- Linting errors found
- Configuration file invalid
- TypeScript configuration invalid
--max-warningsthreshold exceeded--deny-warningsused and warnings found- Invalid command-line options
- JavaScript plugin workspace setup failed
Configuration File
oxlint supports configuration files compatible with ESLint v8 format.Example .oxlintrc.json
Integration Examples
CI/CD Integration
GitHub Actions
GitLab CI
Pre-commit Hook
Using Husky
Using lint-staged
NPM Scripts
Performance Tips
- Use Multiple Threads: oxlint automatically uses all available CPU cores. For large projects, this provides significant speedup.
-
Disable Unused Plugins: Only enable plugins you need. Disabling unused default plugins can improve performance:
-
Ignore Patterns: Use
--ignore-patternto skip files that don’t need linting: -
Targeted Linting: In CI/CD, lint only changed files:
-
Type-Aware Rules: Only enable
--type-awarewhen necessary, as it requires TypeScript type checking which adds overhead.
Common Use Cases
Lint with Auto-fix
Strict Linting for CI
React Project
TypeScript Project with Type Checking
Generate JSON Report
Progressive Adoption
Inline Directives
Disable rules using comments in your code:Troubleshooting
No Files Found
If oxlint reports no files found:- Check ignore patterns:
oxlint --print-config - Verify paths are correct
- Use
--no-ignoreto temporarily disable ignore files
Performance Issues
- Check thread usage:
oxlint --threads 1to test single-threaded - Profile with
--print-configto see enabled rules - Disable type-aware rules if not needed
Configuration Not Loading
- Ensure config file is in correct location
- Check file syntax: JSON must be valid
- Use
--configto specify path explicitly - Use
--print-configto debug configuration