ADR-002: oxlint and oxfmt
Date: 2024-01-01 Status: Accepted
Context
Code quality tooling requires choosing:
- A linter for finding code issues
- A formatter for consistent code style
Traditional choices were:
- ESLint + Prettier
- ESLint + Prettier with additional plugins
- Rust-based tools (oxlint + oxfmt)
Decision
We chose oxlint for linting and oxfmt for formatting instead of ESLint/Prettier.
Rationale
- Performance: Rust-based tools are 10-20x faster than Node.js alternatives
- Simplicity: Single tool replaces both ESLint and Prettier, reducing configuration complexity
- Modern: Built with modern understanding of JavaScript/TypeScript linting
- Configuration: Cleaner configuration files without extensive plugin setup
- Zero-Config: Works well with minimal configuration
- Active Development: Regular updates and improvements
Performance Comparison
ESLint: ~2-3 seconds for moderate codebase
oxlint: ~100-300ms for same codebase
Consequences
Positive
- Significantly faster linting and formatting
- Faster CI/CD pipeline execution
- Better developer experience (quicker feedback)
- Simpler configuration
- Single tool to maintain
Negative
- Less ecosystem maturity than ESLint (though rapidly improving)
- Fewer plugins/extensions compared to ESLint
- Smaller community (but growing)
- Some edge cases may require workarounds
Alternatives Considered
- ESLint + Prettier: Proven, large ecosystem, slower, requires more config
- Rome/Biome: Similar Rust-based approach, more opinionated, larger scope
- Cargo-based tools: Less integrated with JavaScript ecosystem
Migration Path
To switch back to ESLint/Prettier if needed:
- Create
.eslintrc.jsonand.prettierrc.jsonwith equivalent rules - Install ESLint and Prettier packages
- Update
package.jsonscripts - Update
.github/workflows/ci.yml - Remove oxlint/oxfmt configs