Merge pull request #180 from nezhahq/fix/typescript-7-lint-tooling

fix: restore CI compatibility with TypeScript 7

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
naiba
2026-07-21 18:32:15 +08:00
committed by GitHub
co-authored by naiba/CloudCode
7 changed files with 505 additions and 1315 deletions
+27 -24
View File
@@ -1,34 +1,37 @@
name: Frontend CI
on:
pull_request:
branches:
- main
push:
branches:
- main
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 15
build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v7
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Install dependencies
run: npm ci
- name: Build frontend
run: npm run build
- name: Run lint
run: npm run lint
- name: Run unit tests
run: npm run test
- name: Build frontend
run: npm run build
- name: Run unit tests
run: npm run test
+86
View File
@@ -0,0 +1,86 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "error"
},
"env": {
"browser": true
},
"ignorePatterns": ["dist"],
"plugins": ["eslint", "typescript", "react"],
"rules": {
"no-case-declarations": "error",
"no-empty": "error",
"no-fallthrough": "error",
"no-prototype-builtins": "error",
"no-regex-spaces": "error",
"no-unexpected-multiline": "error",
"no-useless-assignment": "error",
"preserve-caught-error": "error",
"no-array-constructor": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"typescript/ban-ts-comment": "error",
"typescript/no-empty-object-type": "error",
"typescript/no-namespace": "error",
"typescript/no-require-imports": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-function-type": "error",
"react/rules-of-hooks": "error",
"react/exhaustive-deps": "warn",
"typescript/no-explicit-any": "off",
"react/only-export-components": "off",
// React Compiler lint stays opt-in until the compiler is adopted.
"react/react-compiler": "off"
},
"overrides": [
{
"files": [
"vite.config.ts",
"vitest.config.ts",
"playwright.config.ts",
"postcss.config.js",
"tailwind.config.js"
],
"env": {
"browser": false,
"node": true
}
},
{
"files": ["src/test/**/*.{ts,tsx}"],
"env": {
"browser": true,
"node": true,
"vitest": true
}
},
{
"files": ["tests/e2e/**/*.ts"],
"env": {
"browser": false,
"node": true
}
},
{
"files": [
"src/components/server-config.tsx",
"src/components/server-config-batch.tsx",
"src/routes/server.tsx"
],
"rules": {
// Existing migration debt remains visible without blocking lint.
"no-useless-assignment": "warn"
}
},
{
"files": ["tests/e2e/fixtures.ts"],
"rules": {
// Playwright fixture callbacks are not React hooks.
"react/rules-of-hooks": "off"
}
}
]
}
-27
View File
@@ -1,27 +0,0 @@
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"
export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"@typescript-eslint/no-explicit-any": "off",
"react-refresh/only-export-components": "off",
indent: ["error", 4],
},
},
)
+387 -1254
View File
File diff suppressed because it is too large Load Diff
+3 -8
View File
@@ -7,8 +7,8 @@
"dev": "vite",
"build": "tsc -b && vite build",
"build-ignore-error": "vite build",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"lint": "oxlint .",
"lint:fix": "oxlint --fix .",
"format": "prettier --write .",
"test": "vitest run",
"preview": "vite preview",
@@ -68,7 +68,6 @@
"zustand": "^5.0.14"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.61.1",
"@testing-library/dom": "^10.4.1",
"@testing-library/react": "^16.3.2",
@@ -77,16 +76,12 @@
"@types/react-dom": "^19.2.1",
"@vitejs/plugin-react": "^6.0.3",
"autoprefixer": "^10.5.4",
"eslint": "^10.7.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.3",
"globals": "^17.7.0",
"jsdom": "^29.1.1",
"oxlint": "1.74.0",
"postcss": "8.5.19",
"swagger-typescript-api": "^13.12.6",
"tailwindcss": "4.3.3",
"typescript": "~7.0.2",
"typescript-eslint": "^8.64.0",
"vite": "^8.1.5",
"vitest": "^4.1.10"
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"ignoreDeprecations": "6.0",
"baseUrl": ".",
// TypeScript 7 resolves paths relative to this config; baseUrl was removed.
"paths": {
"@/*": ["./src/*"]
},
+1 -1
View File
@@ -10,7 +10,7 @@
],
"compilerOptions": {
"ignoreDeprecations": "6.0",
"baseUrl": ".",
// TypeScript 7 resolves paths relative to this config; baseUrl was removed.
"paths": {
"@/*": ["./src/*"]
}