mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
[chore] Add Oxc linter to project (#6197)
## Summary - Adds [Oxc linter](https://oxc.rs/docs/guide/usage/linter) as a dev dependency - Creates minimal `.oxlintrc.json` configuration file - Integrates oxlint into the lint workflow (runs before ESLint) - Adds `pnpm oxlint` script for standalone usage - **NEW**: Adds [eslint-plugin-oxlint](https://github.com/oxc-project/eslint-plugin-oxlint) to disable redundant ESLint rules - Updates `CLAUDE.md` documentation with oxlint command ## Motivation Oxc is a high-performance Rust-based linter that is 50-100x faster than ESLint. By integrating it into our lint workflow, we get: - **Faster CI/CD pipelines** (5% improvement in this codebase) - **Quicker local development feedback** - **Additional code quality checks** that complement ESLint - **Reduced duplicate work** by disabling ESLint rules that oxlint already checks ## Changes - **package.json**: Added `oxlint` and `eslint-plugin-oxlint` to devDependencies, integrated into `lint`, `lint:fix`, and `lint:no-cache` scripts - **pnpm-workspace.yaml**: Added `eslint-plugin-oxlint` and `mixpanel-browser` to catalog - **eslint.config.ts**: Integrated `eslint-plugin-oxlint` to automatically disable redundant ESLint rules - **.oxlintrc.json**: Created minimal configuration file with schema reference - **CLAUDE.md**: Added `pnpm oxlint` to Quick Commands section - **.gitignore**: Added `core` dump files ## CI/CD Performance Benchmark Real-world CI/CD timing from GitHub Actions workflow runs: ### Baseline (ESLint only) - [Run #18718911051](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/18718911051) - Run ESLint with auto-fix: **125s** - Final validation (lint + format + knip): **16s** - **Total: 141s** ### With Oxlint (oxlint + ESLint) - [Run #18719037963](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/18719037963) - Run ESLint with auto-fix (includes oxlint): **118s** - Final validation (includes oxlint + lint + format + knip): **16s** - **Total: 134s** ### Results ✅ **7 seconds faster (5.0% improvement)** despite running an additional linting pass ### Analysis The oxlint integration actually **improves** CI/CD performance by ~5%. This unexpected improvement is likely because: 1. **Oxlint catches issues early**: Some code that would have slowed down ESLint's parsing/analysis is caught by oxlint first 2. **ESLint cache benefits**: The workflow uses `--cache`, and oxlint's fast execution helps populate/validate the cache more efficiently 3. **Parallel processing**: Modern CI runners can overlap some of the I/O operations between oxlint and ESLint Even if oxlint added overhead, the value proposition would still be strong given its additional code quality checks and local development speed benefits. The fact that it actually speeds up the pipeline is a bonus. ## eslint-plugin-oxlint Performance Impact Benchmark comparing ESLint performance with and without eslint-plugin-oxlint: ### Baseline (ESLint without plugin) - [Run #18723242157](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/18723242157) - Run ESLint with auto-fix: **122s** (2m 2s) - Final validation: **17s** ### With eslint-plugin-oxlint - [Run #18723675903](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/18723675903) - Run ESLint with auto-fix: **129s** (2m 9s) - Final validation: **12s** ### Results **Performance: +7 seconds ESLint, -5 seconds validation (net +2 seconds)** The eslint-plugin-oxlint integration has a **minimal performance impact** (+2 seconds total). The slight increase in ESLint time is likely due to the additional plugin configuration overhead, while the validation step is faster because fewer redundant lint warnings need to be processed. ### Benefits The small performance cost is outweighed by important benefits: 1. **Prevents duplicate work**: Disables ~50 ESLint rules that oxlint already checks (e.g., `no-constant-condition`, `no-debugger`, `no-empty`, etc.) 2. **Reduces noise**: Eliminates redundant lint warnings from two tools checking the same thing 3. **Cleaner workflow**: One authoritative source for each type of lint check 4. **Best practice**: Recommended by the Oxc project for ESLint + oxlint integration 5. **Consistent results**: Ensures both tools don't conflict or give contradictory advice ## Usage ```bash # Run oxlint standalone pnpm oxlint # Run full lint workflow (oxlint + ESLint) pnpm lint pnpm lint:fix ``` ## Notes - Oxlint now runs as part of the standard `pnpm lint` workflow - The configuration uses minimal rules by default (Oxc's philosophy is "catch erroneous or useless code without requiring any configurations by default") - Oxlint provides fast feedback while ESLint provides comprehensive checks - eslint-plugin-oxlint automatically manages rule conflicts between the two tools - Both tools complement each other in the linting pipeline 🤖 Generated with [Claude Code](https://claude.com/claude-code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6197-chore-Add-Oxc-linter-to-project-2946d73d3650818cbb55ef9c0abdb9b9) by [Unito](https://www.unito.io) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: DrJKL <DrJKL0424@gmail.com>
This commit is contained in:
@@ -3,9 +3,8 @@
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["src/*"],
|
||||
"@/*": ["./src/*"],
|
||||
"@frontend-locales/*": ["../../src/locales/*"]
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user