Add TypeScript ESLint configs and lint scripts

Add a repository .editorconfig and a root eslint.config.ts to standardize formatting and linting. Migrate packages/webui ESLint config to TypeScript (eslint.config.ts) with project-specific rules and tsconfigRootDir handling, and remove the old JS config. Update package.json to run ESLint directly (add lint and lint:fix) and add required ESLint/dev dependencies; also add jiti to packages/webui/package.json. Include a small formatting tweak to tsconfig.base.json.
This commit is contained in:
手瓜一十雪 committed 2026-05-20 19:08:45 +08:00
1 parent f21740a5d3
commit aea2676c31
30 files changed
+173 -1057

No files matched your search

-23
View File
@@ -1,23 +0,0 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])
+32
View File
@@ -0,0 +1,32 @@
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import { defineConfig, globalIgnores } from 'eslint/config';
const tsconfigRootDir = decodeURIComponent(new URL('.', import.meta.url).pathname).replace(/^\/(.:\/)/, '$1');
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
tsconfigRootDir,
},
},
rules: {
'react-refresh/only-export-components': 'off',
'react-hooks/set-state-in-effect': 'off',
},
},
]);
+1
View File
@@ -39,6 +39,7 @@
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.5.2",
"globals": "^17.5.0",
"jiti": "^2.6.1",
"tailwindcss": "^4.2.2",
"typescript": "catalog:",
"typescript-eslint": "^8.58.2",
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { Eye, Loader2, User, UserX } from 'lucide-react';
import { Button } from '@/components/ui/button';
import {
@@ -37,7 +37,7 @@ export function ProcessProbeDialog({ pid, processName, open, onOpenChange }: Pro
const [info, setInfo] = useState<QqPortLoginInfo | null>(null);
const [error, setError] = useState<string | null>(null);
const probe = async () => {
const probe = useCallback(async () => {
setLoading(true);
setError(null);
setInfo(null);
@@ -52,7 +52,7 @@ export function ProcessProbeDialog({ pid, processName, open, onOpenChange }: Pro
} finally {
setLoading(false);
}
};
}, [api.processes, pid]);
useEffect(() => {
if (open) {
@@ -61,7 +61,7 @@ export function ProcessProbeDialog({ pid, processName, open, onOpenChange }: Pro
setInfo(null);
setError(null);
}
}, [open]);
}, [open, probe]);
return (
<Dialog open={open} onOpenChange={onOpenChange}>