Skip to content

Commit 55a94fc

Browse files
authored
Merge pull request #8 from LykosAI/fix-response-panel-hooks
Fix ResponsePanel state reset on stream end, add ESLint hooks gate
2 parents ab946c2 + 7b8cb10 commit 55a94fc

20 files changed

Lines changed: 992 additions & 40 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
- name: Install dependencies
3030
run: pnpm install --frozen-lockfile
3131

32+
- name: Lint
33+
run: pnpm lint
34+
3235
- name: Run tests
3336
run: pnpm test:run
3437

eslint.config.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
7+
export default tseslint.config(
8+
{
9+
ignores: [
10+
'dist',
11+
'coverage',
12+
'docs/.vitepress/cache',
13+
'docs/.vitepress/dist',
14+
'src-tauri/target',
15+
],
16+
},
17+
{
18+
files: ['src/**/*.{ts,tsx}'],
19+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
20+
languageOptions: {
21+
ecmaVersion: 2020,
22+
globals: globals.browser,
23+
},
24+
plugins: {
25+
'react-hooks': reactHooks,
26+
'react-refresh': reactRefresh,
27+
},
28+
rules: {
29+
// The gate this config exists for: an early return above a hook silently
30+
// reset ResponsePanel's state (see the comment in ResponsePanel.tsx).
31+
'react-hooks/rules-of-hooks': 'error',
32+
'react-hooks/exhaustive-deps': 'warn',
33+
34+
'react-refresh/only-export-components': [
35+
'warn',
36+
{ allowConstantExport: true },
37+
],
38+
39+
// tsc already enforces noUnusedLocals/noUnusedParameters, and it
40+
// understands the `_`-prefix convention better than the lint rule.
41+
'@typescript-eslint/no-unused-vars': 'off',
42+
43+
// Pre-existing `any`s in the script runner and persistence layers are
44+
// deliberate (user scripts, JSON round-trips). Flagged, but not a gate.
45+
'@typescript-eslint/no-explicit-any': 'warn',
46+
},
47+
},
48+
{
49+
files: ['src/test/**/*.{ts,tsx}', '**/*.test.{ts,tsx}'],
50+
languageOptions: {
51+
globals: { ...globals.browser, ...globals.node },
52+
},
53+
rules: {
54+
'@typescript-eslint/no-explicit-any': 'off',
55+
},
56+
},
57+
)

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"build": "tsc && vite build",
99
"browserslist:update": "npx update-browserslist-db@latest",
1010
"preview": "vite preview",
11+
"lint": "eslint .",
12+
"lint:fix": "eslint . --fix",
1113
"tauri": "tauri",
1214
"test": "vitest",
1315
"test:run": "vitest run",
@@ -60,6 +62,7 @@
6062
"zustand": "^5.0.3"
6163
},
6264
"devDependencies": {
65+
"@eslint/js": "^10.0.1",
6366
"@shadcn/ui": "^0.0.4",
6467
"@tauri-apps/cli": "^2.2.5",
6568
"@testing-library/jest-dom": "^6.6.3",
@@ -71,13 +74,18 @@
7174
"@vitejs/plugin-react": "^4.3.4",
7275
"@vitest/coverage-v8": "^3.0.4",
7376
"autoprefixer": "^10.4.20",
77+
"eslint": "^10.8.0",
78+
"eslint-plugin-react-hooks": "^7.1.1",
79+
"eslint-plugin-react-refresh": "^0.5.3",
80+
"globals": "^17.7.0",
7481
"jsdom": "^26.0.0",
7582
"monaco-editor": "^0.55.1",
7683
"postcss": "^8.5.1",
7784
"tailwind-scrollbar": "^3.1.0",
7885
"tailwindcss": "^3.4.17",
7986
"tailwindcss-animate": "^1.0.7",
8087
"typescript": "~5.6.2",
88+
"typescript-eslint": "^8.65.0",
8189
"vite": "^6.0.3",
8290
"vitepress": "^1.6.4",
8391
"vitest": "^3.0.4"

0 commit comments

Comments
 (0)