Skip to content

Commit 92d665f

Browse files
CopilotBoshen
andauthored
Replace ESLint with oxlint for significantly faster linting performance (#18)
* Initial plan * Replace ESLint with oxlint for faster linting performance Co-authored-by: Boshen <[email protected]> * Move oxlint config to package root and centralize dependencies Co-authored-by: Boshen <[email protected]> * Move lint command to package root as workspace command Co-authored-by: Boshen <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Boshen <[email protected]>
1 parent e188a52 commit 92d665f

File tree

7 files changed

+187
-1103
lines changed

7 files changed

+187
-1103
lines changed

.oxlintrc.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"plugins": [
3+
"unicorn",
4+
"typescript",
5+
"oxc",
6+
"react"
7+
],
8+
"categories": {
9+
"correctness": "warn",
10+
"suspicious": "warn"
11+
},
12+
"rules": {
13+
"react/react-in-jsx-scope": "off"
14+
},
15+
"settings": {
16+
"jsx-a11y": {
17+
"polymorphicPropName": null,
18+
"components": {},
19+
"attributes": {}
20+
},
21+
"react": {
22+
"formComponents": [],
23+
"linkComponents": []
24+
},
25+
"jsdoc": {
26+
"ignorePrivate": false,
27+
"ignoreInternal": false,
28+
"ignoreReplacesDocs": true,
29+
"overrideReplacesDocs": true,
30+
"augmentsExtendsReplacesDocs": false,
31+
"implementsReplacesDocs": false,
32+
"exemptDestructuredRootsFromChecks": false,
33+
"tagNamePreference": {}
34+
}
35+
},
36+
"env": {
37+
"builtin": true
38+
},
39+
"globals": {},
40+
"ignorePatterns": ["dist"]
41+
}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ A modern frontend dashboard for displaying different metrics using bar charts.
2222

2323
## ⚡ Performance
2424

25-
The dashboard uses **rolldown-vite** for significantly faster build times:
26-
- **Build Performance**: ~13.8x faster builds (309ms vs 4.28s)
25+
The dashboard uses **rolldown-vite** for significantly faster build times and **oxlint** for ultra-fast linting:
26+
- **Build Performance**: ~13.8x faster builds (309ms vs 4.28s) with Rolldown
27+
- **Linting Performance**: Extremely fast linting (~2ms) with oxlint
2728
- **Development**: Fast startup (306ms) with Rolldown's Rust-based bundler
2829
- **Hot Module Replacement**: Instant updates during development
2930

apps/dashboard/README.md

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,29 @@
11
# React + TypeScript + Vite
22

3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3+
# React + TypeScript + Vite
4+
5+
This template provides a minimal setup to get React working in Vite with HMR and fast linting using oxlint.
46

57
Currently, two official plugins are available:
68

79
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
810
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
911

10-
## Expanding the ESLint configuration
12+
## Oxlint Configuration
1113

12-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
14+
This project uses [oxlint](https://oxc.rs) for linting, which provides significantly faster performance than ESLint while maintaining compatibility with most ESLint rules.
1315

14-
```js
15-
export default tseslint.config([
16-
globalIgnores(['dist']),
17-
{
18-
files: ['**/*.{ts,tsx}'],
19-
extends: [
20-
// Other configs...
16+
The configuration is in `.oxlintrc.json` and includes:
17+
- TypeScript plugin for TypeScript-specific rules
18+
- React plugin for React best practices
19+
- Unicorn plugin for additional code quality rules
20+
- OXC plugin for unique optimization rules
2121

22-
// Remove tseslint.configs.recommended and replace with this
23-
...tseslint.configs.recommendedTypeChecked,
24-
// Alternatively, use this for stricter rules
25-
...tseslint.configs.strictTypeChecked,
26-
// Optionally, add this for stylistic rules
27-
...tseslint.configs.stylisticTypeChecked,
28-
29-
// Other configs...
30-
],
31-
languageOptions: {
32-
parserOptions: {
33-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
34-
tsconfigRootDir: import.meta.dirname,
35-
},
36-
// other options...
37-
},
38-
},
39-
])
22+
To run linting:
23+
```bash
24+
pnpm lint
4025
```
4126

42-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
27+
To customize the configuration, edit `.oxlintrc.json`. Oxlint supports most ESLint configuration options.
4328

44-
```js
45-
// eslint.config.js
46-
import reactX from 'eslint-plugin-react-x'
47-
import reactDom from 'eslint-plugin-react-dom'
4829

49-
export default tseslint.config([
50-
globalIgnores(['dist']),
51-
{
52-
files: ['**/*.{ts,tsx}'],
53-
extends: [
54-
// Other configs...
55-
// Enable lint rules for React
56-
reactX.configs['recommended-typescript'],
57-
// Enable lint rules for React DOM
58-
reactDom.configs.recommended,
59-
],
60-
languageOptions: {
61-
parserOptions: {
62-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
63-
tsconfigRootDir: import.meta.dirname,
64-
},
65-
// other options...
66-
},
67-
},
68-
])
69-
```

apps/dashboard/eslint.config.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

apps/dashboard/package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
9-
"lint": "eslint .",
109
"preview": "vite preview",
1110
"clean": "rm -rf dist"
1211
},
@@ -17,15 +16,9 @@
1716
"lucide-react": "^0.414.0"
1817
},
1918
"devDependencies": {
20-
"@eslint/js": "^9.33.0",
2119
"@types/react": "^19.1.10",
2220
"@types/react-dom": "^19.1.7",
23-
"eslint": "^9.33.0",
24-
"eslint-plugin-react-hooks": "^5.2.0",
25-
"eslint-plugin-react-refresh": "^0.4.20",
26-
"globals": "^16.3.0",
2721
"typescript": "~5.8.3",
28-
"typescript-eslint": "^8.39.1",
2922
"rolldown-vite": "^7.1.3"
3023
}
3124
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "pnpm --filter dashboard dev",
88
"build": "pnpm -r build",
9-
"lint": "pnpm -r lint",
9+
"lint": "oxlint .",
1010
"test": "pnpm -r test",
1111
"clean": "pnpm -r clean",
1212
"build-deploy": "pnpm lint && pnpm build"
@@ -16,6 +16,7 @@
1616
"license": "MIT",
1717
"devDependencies": {
1818
"@types/node": "^20.0.0",
19+
"oxlint": "^1.12.0",
1920
"typescript": "^5.0.0"
2021
},
2122
"packageManager": "[email protected]"

0 commit comments

Comments
 (0)