Overview
- Oxlint - Fast linter written in Rust
- Oxfmt - Fast formatter written in Rust (based on Prettier)
- Lefthook - Fast git hooks manager written in Go
- lint-staged - Run linters on staged files only
- Commitlint - Validate commit messages
- TypeScript - Type checking
Oxfmt (Formatter)
Oxfmt is a high-performance code formatter that’s 10-100x faster than Prettier while maintaining compatibility with Prettier’s output.Configuration
Configuration is defined in.oxfmtrc.jsonc:
- No semicolons - Cleaner code style
- Auto-sort imports - Keeps imports organized alphabetically
- Sort Tailwind classes - Consistent class ordering
- Ignores lock files -
package-lock.json,bun.lockb, etc.
Usage
Format all files
Check formatting
0- All files are formatted correctly1- Some files need formatting
Format specific files
Supported File Types
Oxfmt formats:- JavaScript (
.js,.mjs,.cjs) - TypeScript (
.ts,.tsx,.mts,.cts) - JSON (
.json,.jsonc) - JSX/TSX
- Markdown (
.md,.mdx)
Oxlint (Linter)
Oxlint is a fast linter written in Rust that catches common errors and enforces best practices.Configuration
Oxlint uses sensible defaults without requiring configuration. No.oxlintrc.json file is needed.
Default rules:
- ESLint recommended rules
- TypeScript recommended rules
- React recommended rules
- Security rules
- Performance rules
Usage
Lint all files
Lint specific files
Auto-fix issues
Oxlint vs ESLint
Why Oxlint?- 50-100x faster than ESLint
- Written in Rust for maximum performance
- Drop-in replacement for most ESLint rules
- No configuration needed
- Integrates seamlessly with existing tools
- Fewer total rules than ESLint (focuses on most important ones)
- Some ESLint plugins not yet supported
- Newer tool with smaller ecosystem
Lefthook (Git Hooks)
Lefthook manages git hooks with better performance than Husky. It runs linters and checks before commits.Configuration
Configuration is defined inlefthook.yml:
Pre-commit Hooks
Run automatically before every commit:1. Security Audit (canary branch only)
- Checks for high-severity security vulnerabilities in dependencies
- Only runs on the
canarybranch - Prevents commits if vulnerabilities are found
2. Lint Staged Files
- Runs linters only on staged files (fast!)
- Auto-stages fixed files
- Configured in
.lintstagedrc.json
3. Build Check
- Runs a full production build
- Ensures code compiles successfully
- Catches TypeScript errors and build issues
- Interactive mode shows full output
Commit Message Validation
Runs automatically when writing commit messages:- Validates commit messages follow Conventional Commits
- Configured in
package.jsonundercommitlint
Installation
Lefthook hooks are installed automatically afterbun install via the prepare script:
Skipping Hooks
Skip all hooks
Skip specific hooks
lint-staged
lint-staged runs linters only on files staged for commit, making pre-commit hooks much faster.Configuration
Configuration is defined in.lintstagedrc.json:
Rules
All files
- Oxfmt - Auto-formats the file
- Oxlint - Checks for issues
--no-error-on-unmatched-pattern- Don’t fail if Oxfmt can’t format certain files (e.g., images, lock files)
package.json files
- Scans all workspace
package.jsonfiles - Auto-moves dependencies to the root catalog if versions match
- Sorts catalog entries
- Reports unused or conflicting dependencies
How It Works
- You stage files:
git add . - You commit:
git commit -m "message" - lint-staged runs:
- Formats staged files with Oxfmt
- Lints staged files with Oxlint
- Runs deps-manager if
package.jsonwas modified
- If linters find issues:
- Auto-fixable issues are fixed and staged
- Manual fixes required: commit is aborted
- Commit proceeds if all checks pass
Benefits
- Fast - Only processes staged files, not entire codebase
- Automatic fixes - Auto-formats and auto-fixes when possible
- Catches issues early - Before they reach CI/CD
- Consistent code - Everyone commits properly formatted code
Commitlint
Commitlint validates commit messages follow the Conventional Commits specification.Configuration
Configuration is defined inpackage.json:
Commit Message Format
Types
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, missing semicolons, etc.)refactor- Code refactoring (no feature changes or bug fixes)perf- Performance improvementstest- Adding or updating testsbuild- Build system changes (dependencies, scripts, etc.)ci- CI/CD changeschore- Other changes that don’t modify src or test filesrevert- Revert a previous commit
Rules
- Type is required - Must be one of the allowed types
- Subject is required - Brief description of the change
- Subject is lowercase - No capital letters at the start
- No period at end - Subject should not end with
. - Blank line before body - If body is present
- Max line length - 100 characters for header, 72 for body
Examples
Good commits
Bad commits
Type Checking
TypeScript provides static type checking across the monorepo.Run type checking
tsc --noEmit across all workspaces to check for type errors without generating output files.
Workspace-specific type checking
Benefits
- Catches type errors at build time
- Enables IDE autocomplete and IntelliSense
- Safer refactoring
- Self-documenting code
CI/CD Integration
Run these commands in your CI/CD pipeline:Editor Integration
VS Code
Install recommended extensions:- Oxfmt - Format on save
- Oxlint - Inline linting errors
- TypeScript and JavaScript Language Features - Built-in type checking
Cursor / Other IDEs
Most modern IDEs support Oxfmt and Oxlint through their extension marketplaces. Search for “Oxc” or “Oxlint”.Troubleshooting
”Lefthook: command not found”
Reinstall hooks:Pre-commit hooks not running
- Check hooks are installed:
ls .git/hooks/ - Reinstall:
bunx lefthook install - Verify Lefthook config:
cat lefthook.yml
Commitlint failing on valid messages
- Check message format matches conventional commits
- Ensure subject is lowercase
- Remove period at end of subject
- Verify type is valid
Oxlint/Oxfmt errors
- Update to latest version:
bun update oxlint oxfmt - Clear cache:
rm -rf .turbo node_modules/.cache - Check file syntax is valid TypeScript/JavaScript