diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa6c47a..399df91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: cache: pnpm - name: Install - run: pnpm install + run: pnpm install --no-frozen-lockfile - name: Build run: pnpm build diff --git a/.prettierignore b/.oxfmtignore similarity index 100% rename from .prettierignore rename to .oxfmtignore diff --git a/.prettierrc.mjs b/.prettierrc.mjs deleted file mode 100644 index b3715bd..0000000 --- a/.prettierrc.mjs +++ /dev/null @@ -1,6 +0,0 @@ -export default { - printWidth: 120, - singleQuote: true, - jsxSingleQuote: true, - plugins: ['prettier-plugin-tailwindcss'], -}; diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b859c9a..e7128af 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,9 +1,8 @@ { "recommendations": [ - "dbaeumer.vscode-eslint", + "oxc.oxc-vscode", "editorconfig.editorconfig", "bradlc.vscode-tailwindcss", - "esbenp.prettier-vscode", "vitest.explorer" ] } diff --git a/.vscode/settings.example.json b/.vscode/settings.example.json index 06b4d75..3fe3c95 100644 --- a/.vscode/settings.example.json +++ b/.vscode/settings.example.json @@ -1,8 +1,8 @@ { - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "oxc.oxc-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" + "source.fixAll.oxc": "always" }, - "eslint.validate": ["javascript", "typescript", "javascriptreact", "typescriptreact"] + "oxc.typeAware": true } diff --git a/README.md b/README.md index 6d7fd63..f1c115b 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,28 @@ It is a copy of [Vitesse](https://github.com/antfu/vitesse), but it uses React. ## Features -- ⚡️ [React](https://reactjs.org/) + [Vite](https://vitejs.dev/) + [pnpm](https://pnpm.io/) +- ⚡️ [React](https://reactjs.org/) + [Vite 8](https://vitejs.dev/) + [pnpm](https://pnpm.io/) +- 🦀 [Rolldown](https://rollup.rollupjs.org/) - Rust-powered bundler (10-30x faster) +- 🔧 [Oxc](https://oxc.rs/) - Rust-powered JavaScript toolchain + - [Oxlint](https://oxc.rs/) - ESLint alternative (50-100x faster) + - [Oxfmt](https://oxc.rs/) - Prettier alternative (30x faster) - 🗂 [React Router](https://reactrouter.com/en/main) - 😃 [React Use](https://streamich.github.io/react-use/) - 🎨 [TailwindCSS](https://tailwindcss.com/) + [Iconify](https://iconify.design/docs/usage/css/tailwind/) -- 🦾 [ESLint](https://eslint.org/) + [Prettier](https://prettier.io/) + [CommitLint](https://commitlint.js.org/) + [Husky](https://typicode.github.io/husky/) +- 🦾 [CommitLint](https://commitlint.js.org/) + [Husky](https://typicode.github.io/husky/) - ✅ [Vitest](https://vitest.dev/) - ☁️ [Netlify](https://www.netlify.com/) +## Tech Stack + +This project uses Anthony Fu's latest **ox + rust** tech stack: + +| Old (JS) | New (Rust) | Speed | +|----------|------------|-------| +| ESLint | Oxlint | 50-100x faster | +| Prettier | Oxfmt | 30x faster | +| esbuild + Rollup | Rolldown | 10-30x faster | + ## Try it now! ### GitHub Template diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 8901efb..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import js from '@eslint/js'; -import tseslint from 'typescript-eslint'; -import reactPlugin from 'eslint-plugin-react'; -import reactHooksPlugin from 'eslint-plugin-react-hooks'; -import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'; -import reactCompilerPlugin from 'eslint-plugin-react-compiler'; -import reactRefreshPlugin from 'eslint-plugin-react-refresh'; - -export default [ - js.configs.recommended, - ...tseslint.configs.recommended, - { - files: ['**/*.{jsx,tsx}'], - ...reactPlugin.configs.flat.recommended, - }, - { - files: ['**/*.{jsx,tsx}'], - ...reactPlugin.configs.flat['jsx-runtime'], - }, - { - files: ['**/*.{jsx,tsx}'], - plugins: { - 'react-hooks': reactHooksPlugin, - 'jsx-a11y': jsxA11yPlugin, - 'react-compiler': reactCompilerPlugin, - 'react-refresh': reactRefreshPlugin, - }, - rules: { - ...reactHooksPlugin.configs.flat.recommended.rules, - ...jsxA11yPlugin.configs.recommended.rules, - ...reactCompilerPlugin.configs.recommended.rules, - 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], - }, - settings: { - react: { - version: 'detect', - }, - }, - }, - { - ignores: ['dist/', 'node_modules/', 'eslint.config.mjs'], - }, -]; diff --git a/lint-staged.config.mjs b/lint-staged.config.mjs index dc8f9df..f44407d 100644 --- a/lint-staged.config.mjs +++ b/lint-staged.config.mjs @@ -1,3 +1,3 @@ export default { - '**/*.{js,jsx,tsx,ts}': ['eslint --fix', 'prettier --write'], + '**/*.{js,jsx,tsx,ts}': ['oxlint', 'oxfmt --write'], }; diff --git a/oxlintrc.json b/oxlintrc.json new file mode 100644 index 0000000..957e170 --- /dev/null +++ b/oxlintrc.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://json.schemastore.org/oxlintrc.json", + "options": { + "typeAware": true + }, + "rules": { + "no-console": "warn", + "no-debugger": "warn" + } +} diff --git a/package.json b/package.json index 5f1ab99..0dc3d55 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "lint": "eslint --cache --fix --quiet .", - "format": "prettier --write ./src", + "lint": "oxlint", + "format": "oxfmt --write ./src", "prepare": "husky", "test": "vitest", "typecheck": "tsc" @@ -24,12 +24,11 @@ }, "packageManager": "pnpm@10.33.2", "pnpm": { - "onlyBuiltDependencies": ["esbuild"] + "onlyBuiltDependencies": [] }, "devDependencies": { "@commitlint/cli": "^20.5.0", "@commitlint/config-conventional": "^20.5.0", - "@eslint/js": "^9.39.4", "@iconify-json/carbon": "^1.2.20", "@iconify/tailwind4": "^1.2.3", "@tailwindcss/postcss": "^4.2.4", @@ -42,25 +41,18 @@ "autoprefixer": "^10.5.0", "babel-plugin-react-compiler": "^1.0.0", "commitlint": "^20.5.0", - "esbuild": "^0.28.0", - "eslint": "^9.39.4", - "eslint-plugin-jsx-a11y": "^6.10.2", - "eslint-plugin-react": "^7.37.5", - "eslint-plugin-react-compiler": "19.1.0-rc.2", - "eslint-plugin-react-hooks": "^7.1.1", - "eslint-plugin-react-refresh": "^0.5.2", "happy-dom": "^20.9.0", "husky": "^9.1.7", "lint-staged": "^16.4.0", + "oxlint": "^0.14.0", + "oxfmt": "^0.14.0", "postcss": "^8.5.10", - "prettier": "^3.8.3", - "prettier-plugin-tailwindcss": "^0.7.3", "rollup-plugin-visualizer": "^7.0.1", "tailwindcss": "^4.2.4", "terser": "^5.46.2", "typescript": "^6.0.3", - "typescript-eslint": "^8.59.0", "vite": "8.0.10", - "vitest": "4.1.5" + "vitest": "4.1.5", + "oxlint-tsgolint": "^0.14.0" } -} +} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 5760b85..fe76c87 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -33,7 +33,7 @@ export default defineConfig(({ mode }) => { ...(mode === 'production' ? { build: { - minify: 'esbuild', + // Vite 8 默认使用 Rolldown (Rust),无需配置 minify cssTarget: 'chrome61', modulePreload: { polyfill: true,