From a1cc1509ce8c792409e7d2f5910b0cc7bf589912 Mon Sep 17 00:00:00 2001 From: lutinglt Date: Tue, 5 Aug 2025 12:59:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20react?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/release.md | 2 +- eslint.config.js | 11 +---------- package.json | 16 ++-------------- src/core/vite.ts | 2 +- styles/components/{actions.tsx => actions.ts} | 0 styles/components/{clone.tsx => clone.ts} | 0 styles/components/{commit.tsx => commit.ts} | 0 .../components/{dashboard.tsx => dashboard.ts} | 0 styles/components/{diff.tsx => diff.ts} | 0 styles/components/{filelist.tsx => filelist.ts} | 0 styles/components/{heatmap.tsx => heatmap.ts} | 0 styles/components/{index.tsx => index.ts} | 0 styles/components/{issue.tsx => issue.ts} | 0 styles/components/{newrepo.tsx => newrepo.ts} | 0 styles/components/{release.tsx => release.ts} | 0 styles/components/{repo.tsx => repo.ts} | 0 styles/components/{setting.tsx => setting.ts} | 0 styles/{index.tsx => index.ts} | 0 styles/public/{button.tsx => button.ts} | 0 styles/public/{chroma.tsx => chroma.ts} | 0 styles/public/{dropdown.tsx => dropdown.ts} | 4 ++-- styles/public/{index.tsx => index.ts} | 0 styles/public/{input.tsx => input.ts} | 0 styles/public/{label.tsx => label.ts} | 0 styles/public/{menu.tsx => menu.ts} | 0 styles/public/{modal.tsx => modal.ts} | 0 styles/public/{navbar.tsx => navbar.ts} | 0 styles/public/{radius.tsx => radius.ts} | 0 styles/public/{text.tsx => text.ts} | 0 styles/public/{tippy.tsx => tippy.ts} | 0 styles/public/{transition.tsx => transition.ts} | 0 themes/{dark.css.tsx => dark.css.ts} | 0 tsconfig.json | 1 - vite.config.ts | 6 ++---- 34 files changed, 9 insertions(+), 33 deletions(-) rename styles/components/{actions.tsx => actions.ts} (100%) rename styles/components/{clone.tsx => clone.ts} (100%) rename styles/components/{commit.tsx => commit.ts} (100%) rename styles/components/{dashboard.tsx => dashboard.ts} (100%) rename styles/components/{diff.tsx => diff.ts} (100%) rename styles/components/{filelist.tsx => filelist.ts} (100%) rename styles/components/{heatmap.tsx => heatmap.ts} (100%) rename styles/components/{index.tsx => index.ts} (100%) rename styles/components/{issue.tsx => issue.ts} (100%) rename styles/components/{newrepo.tsx => newrepo.ts} (100%) rename styles/components/{release.tsx => release.ts} (100%) rename styles/components/{repo.tsx => repo.ts} (100%) rename styles/components/{setting.tsx => setting.ts} (100%) rename styles/{index.tsx => index.ts} (100%) rename styles/public/{button.tsx => button.ts} (100%) rename styles/public/{chroma.tsx => chroma.ts} (100%) rename styles/public/{dropdown.tsx => dropdown.ts} (97%) rename styles/public/{index.tsx => index.ts} (100%) rename styles/public/{input.tsx => input.ts} (100%) rename styles/public/{label.tsx => label.ts} (100%) rename styles/public/{menu.tsx => menu.ts} (100%) rename styles/public/{modal.tsx => modal.ts} (100%) rename styles/public/{navbar.tsx => navbar.ts} (100%) rename styles/public/{radius.tsx => radius.ts} (100%) rename styles/public/{text.tsx => text.ts} (100%) rename styles/public/{tippy.tsx => tippy.ts} (100%) rename styles/public/{transition.tsx => transition.ts} (100%) rename themes/{dark.css.tsx => dark.css.ts} (100%) diff --git a/.github/release.md b/.github/release.md index bf7e2bb..8faa057 100644 --- a/.github/release.md +++ b/.github/release.md @@ -18,4 +18,4 @@ ## 🐞 Fix - 修复一些圆角问题 -- 修复工单下依赖工单选择框的高度对齐 \ No newline at end of file +- 修复工单下依赖工单选择框的高度对齐 diff --git a/eslint.config.js b/eslint.config.js index 44cacaa..11d3e3c 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,6 +1,4 @@ import js from "@eslint/js"; -import reactHooks from "eslint-plugin-react-hooks"; -import reactRefresh from "eslint-plugin-react-refresh"; import globals from "globals"; import tseslint from "typescript-eslint"; @@ -8,17 +6,10 @@ export default tseslint.config( { ignores: ["dist"] }, { extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ["**/*.{ts,tsx}"], + files: ["**/*.{ts}"], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, - plugins: { - "react-hooks": reactHooks, - "react-refresh": reactRefresh, - }, - rules: { - ...reactHooks.configs.recommended.rules, - }, } ); diff --git a/package.json b/package.json index f663d5a..287143d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitea-github-theme", - "version": "1.24.2", + "version": "1.24.4", "description": "A theme to make Gitea look and feel like GitHub", "type": "module", "scripts": { @@ -12,35 +12,26 @@ "version": "node scripts/version.cjs" }, "devDependencies": { - "@babel/preset-react": "^7.27.1", "@babel/preset-typescript": "^7.27.1", "@eslint/js": "^9.29.0", "@linaria/core": "^6.3.0", - "@linaria/react": "^6.3.0", "@types/node": "^24.0.3", - "@types/react": "^19.1.8", - "@types/react-dom": "^19.1.6", "@vanilla-extract/css": "^1.17.4", "@vanilla-extract/vite-plugin": "^5.0.6", - "@vitejs/plugin-react": "^4.5.2", - "@vitejs/plugin-react-swc": "^3.10.2", "@wyw-in-js/babel-preset": "^0.7.0", "@wyw-in-js/vite": "^0.7.0", "dotenv": "^17.0.0", "eslint": "^9.29.0", - "eslint-plugin-react-hooks": "^5.2.0", - "eslint-plugin-react-refresh": "^0.4.20", "globals": "^16.2.0", "lightningcss": "^1.30.1", "polished": "^4.3.1", "prettier": "3.5.3", "prettier-plugin-organize-imports": "^4.1.0", - "react": "^19.1.0", - "react-dom": "^19.1.0", "sass-embedded": "^1.89.2", "typescript": "^5.8.3", "typescript-eslint": "^8.34.1", "typescript-plugin-css-modules": "^5.1.0", + "typescript-styled-plugin": "^0.18.3", "vite": "^6.3.5" }, "prettier": { @@ -62,8 +53,5 @@ "prettier-plugin-organize-imports" ], "organizeImportsSkipDestructiveCodeActions": false - }, - "dependencies": { - "typescript-styled-plugin": "^0.18.3" } } diff --git a/src/core/vite.ts b/src/core/vite.ts index c95d520..3834831 100644 --- a/src/core/vite.ts +++ b/src/core/vite.ts @@ -4,7 +4,7 @@ import fs from "node:fs"; import path from "node:path"; import type { Plugin } from "vite"; -const suffix = ".css.tsx"; +const suffix = ".css.ts"; /** * 生成主题输入 diff --git a/styles/components/actions.tsx b/styles/components/actions.ts similarity index 100% rename from styles/components/actions.tsx rename to styles/components/actions.ts diff --git a/styles/components/clone.tsx b/styles/components/clone.ts similarity index 100% rename from styles/components/clone.tsx rename to styles/components/clone.ts diff --git a/styles/components/commit.tsx b/styles/components/commit.ts similarity index 100% rename from styles/components/commit.tsx rename to styles/components/commit.ts diff --git a/styles/components/dashboard.tsx b/styles/components/dashboard.ts similarity index 100% rename from styles/components/dashboard.tsx rename to styles/components/dashboard.ts diff --git a/styles/components/diff.tsx b/styles/components/diff.ts similarity index 100% rename from styles/components/diff.tsx rename to styles/components/diff.ts diff --git a/styles/components/filelist.tsx b/styles/components/filelist.ts similarity index 100% rename from styles/components/filelist.tsx rename to styles/components/filelist.ts diff --git a/styles/components/heatmap.tsx b/styles/components/heatmap.ts similarity index 100% rename from styles/components/heatmap.tsx rename to styles/components/heatmap.ts diff --git a/styles/components/index.tsx b/styles/components/index.ts similarity index 100% rename from styles/components/index.tsx rename to styles/components/index.ts diff --git a/styles/components/issue.tsx b/styles/components/issue.ts similarity index 100% rename from styles/components/issue.tsx rename to styles/components/issue.ts diff --git a/styles/components/newrepo.tsx b/styles/components/newrepo.ts similarity index 100% rename from styles/components/newrepo.tsx rename to styles/components/newrepo.ts diff --git a/styles/components/release.tsx b/styles/components/release.ts similarity index 100% rename from styles/components/release.tsx rename to styles/components/release.ts diff --git a/styles/components/repo.tsx b/styles/components/repo.ts similarity index 100% rename from styles/components/repo.tsx rename to styles/components/repo.ts diff --git a/styles/components/setting.tsx b/styles/components/setting.ts similarity index 100% rename from styles/components/setting.tsx rename to styles/components/setting.ts diff --git a/styles/index.tsx b/styles/index.ts similarity index 100% rename from styles/index.tsx rename to styles/index.ts diff --git a/styles/public/button.tsx b/styles/public/button.ts similarity index 100% rename from styles/public/button.tsx rename to styles/public/button.ts diff --git a/styles/public/chroma.tsx b/styles/public/chroma.ts similarity index 100% rename from styles/public/chroma.tsx rename to styles/public/chroma.ts diff --git a/styles/public/dropdown.tsx b/styles/public/dropdown.ts similarity index 97% rename from styles/public/dropdown.tsx rename to styles/public/dropdown.ts index b8b3d5e..f6a61a5 100644 --- a/styles/public/dropdown.tsx +++ b/styles/public/dropdown.ts @@ -162,8 +162,8 @@ export const selectionDropdown = css` // 修复选择框的下拉菜单向上显示时的样式问题 .ui.upward.selection.dropdown.visible:not(.small), .ui.active.upward.selection.dropdown:not(.small) { - border-top-left-radius: ${otherThemeVars.border.radius}!important; - border-top-right-radius: ${otherThemeVars.border.radius}!important; + border-top-left-radius: ${otherThemeVars.border.radius} !important; + border-top-right-radius: ${otherThemeVars.border.radius} !important; } `; diff --git a/styles/public/index.tsx b/styles/public/index.ts similarity index 100% rename from styles/public/index.tsx rename to styles/public/index.ts diff --git a/styles/public/input.tsx b/styles/public/input.ts similarity index 100% rename from styles/public/input.tsx rename to styles/public/input.ts diff --git a/styles/public/label.tsx b/styles/public/label.ts similarity index 100% rename from styles/public/label.tsx rename to styles/public/label.ts diff --git a/styles/public/menu.tsx b/styles/public/menu.ts similarity index 100% rename from styles/public/menu.tsx rename to styles/public/menu.ts diff --git a/styles/public/modal.tsx b/styles/public/modal.ts similarity index 100% rename from styles/public/modal.tsx rename to styles/public/modal.ts diff --git a/styles/public/navbar.tsx b/styles/public/navbar.ts similarity index 100% rename from styles/public/navbar.tsx rename to styles/public/navbar.ts diff --git a/styles/public/radius.tsx b/styles/public/radius.ts similarity index 100% rename from styles/public/radius.tsx rename to styles/public/radius.ts diff --git a/styles/public/text.tsx b/styles/public/text.ts similarity index 100% rename from styles/public/text.tsx rename to styles/public/text.ts diff --git a/styles/public/tippy.tsx b/styles/public/tippy.ts similarity index 100% rename from styles/public/tippy.tsx rename to styles/public/tippy.ts diff --git a/styles/public/transition.tsx b/styles/public/transition.ts similarity index 100% rename from styles/public/transition.tsx rename to styles/public/transition.ts diff --git a/themes/dark.css.tsx b/themes/dark.css.ts similarity index 100% rename from themes/dark.css.tsx rename to themes/dark.css.ts diff --git a/tsconfig.json b/tsconfig.json index 50ed980..a6157b7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,7 +23,6 @@ "verbatimModuleSyntax": true, "moduleDetection": "force", "noEmit": true, - "jsx": "react-jsx", /* Linting */ "strict": true, "noUnusedLocals": true, diff --git a/vite.config.ts b/vite.config.ts index 8a606df..1cb8ede 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,4 @@ import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin"; -import react from "@vitejs/plugin-react"; import linaria from "@wyw-in-js/vite"; import * as dotenv from "dotenv"; import { Features } from "lightningcss"; @@ -24,7 +23,7 @@ export default defineConfig(({ mode }) => { styles: path.resolve(__dirname, "styles"), themes: path.resolve(__dirname, "themes"), }, - extensions: [".js", ".jsx", ".ts", ".tsx", ".css.tsx"], + extensions: [".js", ".ts", ".css.ts"], }, css: { transformer: "lightningcss", @@ -37,14 +36,13 @@ export default defineConfig(({ mode }) => { linaria({ include: ["**/*.{ts,tsx}"], babelOptions: { - presets: ["@babel/preset-typescript", "@babel/preset-react"], + presets: ["@babel/preset-typescript"], }, preprocessor: (_selector, cssText) => sass.compileString(cssText).css, // 默认为全局样式并使用 sass-embedded 预处理 css tagResolver: (source, tag) => // 识别从 src 导出的 css 标签,使用 @linaria/core/processors/css 处理 source === "src/types/vars" && tag === "css" ? require.resolve("@linaria/core/processors/css") : null, }), - react(), vanillaExtractPlugin(), themePlugin(), ],