Oxlint Integration
Supercharge your linting workflow by combining ESLint with Oxlint - a high-performance linter written in Rust that's significantly faster than ESLint for basic checks.
What is Oxlint?
Oxlint is a blazingly fast JavaScript/TypeScript linter that can run hundreds of times faster than ESLint. By using Oxlint for quick checks and ESLint for more complex analysis, you get the best of both worlds: speed and comprehensive linting.
Benefits
- ⚡ Faster Linting: Oxlint can be 50-100x faster than ESLint for supported rules
- 🔄 Complementary: Use Oxlint for quick feedback, ESLint for deep analysis
- 🎯 Targeted: Oxlint focuses on common errors and code quality issues
- 🚀 CI/CD Optimization: Run Oxlint first for fast feedback, then ESLint for thorough checks
Installation
1. Install Oxlint Plugin
Add the ESLint Oxlint plugin to your project:
pnpm add -D eslint-plugin-oxlintnpm install --save-dev eslint-plugin-oxlintyarn add -D eslint-plugin-oxlint2. Generate Oxlint Configuration
Create an .oxlintrc.json file by migrating your ESLint configuration:
pnpm oxlint:migratepnpx @oxlint/migrate eslint.config.js --with-nursery --mergeThis command:
- Analyzes your
eslint.config.js - Extracts rules that Oxlint supports
- Creates an
.oxlintrc.jsonconfiguration - Includes nursery rules (experimental but useful rules)
- Merges with any existing Oxlint configuration
3. Update ESLint Configuration
Import and integrate Oxlint with your ESLint config:
// eslint.config.ts
import oxlint from 'eslint-plugin-oxlint'
import wisemenConfig from '@wisemen/eslint-config-vue'
export default [
...(await wisemenConfig),
// Load Oxlint rules from .oxlintrc.json
...oxlint.buildFromOxlintConfigFile('./.oxlintrc.json'),
]This configuration:
- Disables ESLint rules that overlap with Oxlint
- Prevents duplicate linting of the same issues
- Ensures ESLint and Oxlint work harmoniously together
Usage
Recommended Scripts
Add these scripts to your package.json for an optimized linting workflow:
{
"scripts": {
"lint:oxlint": "oxlint . --fix",
"lint:eslint": "eslint . --fix --cache",
"lint": "pnpm lint:oxlint && pnpm lint:eslint",
"oxlint:migrate": "pnpx @oxlint/migrate eslint.config.js --with-nursery --merge"
}
}Running Linters
Fast Check with Oxlint
Run Oxlint for quick feedback during development:
pnpm lint:oxlintThis will:
- Check your code extremely quickly
- Auto-fix simple issues
- Catch common errors and anti-patterns
Comprehensive Check with ESLint
Run ESLint for thorough analysis:
pnpm lint:eslintThis will:
- Perform deep code analysis
- Check Vue.js specific patterns
- Validate TypeScript types
- Enforce project-specific rules
- Use cache for faster subsequent runs
Full Lint (Recommended)
Run both linters in sequence:
pnpm lintThis workflow:
- Runs Oxlint first for fast fixes
- Then runs ESLint for comprehensive checks
- Provides the best balance of speed and thoroughness
Configuration
Oxlint Configuration File
The .oxlintrc.json file controls Oxlint's behavior:
{
"rules": {
"no-console": "warn",
"no-debugger": "error"
},
"env": {
"browser": true,
"es2021": true
}
}Updating Oxlint Rules
When you update your ESLint configuration, regenerate the Oxlint config:
pnpm oxlint:migrateThis ensures Oxlint stays in sync with your ESLint rules.
IDE Integration
VS Code
- Install the Oxlint extension
- Configure in
.vscode/settings.json: