From 5d91f34b2fe80e4d25b25349033153925e2c0c59 Mon Sep 17 00:00:00 2001 From: Pedram Amini Date: Mon, 22 Dec 2025 19:31:27 -0600 Subject: [PATCH] tests pass --- .gitignore | 3 +++ CONTRIBUTING.md | 3 ++- eslint.config.mjs | 4 +++- src/__tests__/main/agent-detector.test.ts | 4 ++++ src/main/debug-package/__tests__/packager.test.ts | 1 - tsconfig.cli.json | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4f144bd0..01765745 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,9 @@ Thumbs.db *.swp *.swo +# ESLint +.eslintcache + # Electron out/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7ca15e91..8b613253 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -163,6 +163,7 @@ Run TypeScript type checking and ESLint to catch errors before building: ```bash npm run lint # TypeScript type checking (all configs: renderer, main, cli) npm run lint:eslint # ESLint code quality checks (React hooks, unused vars, etc.) +npm run lint:eslint -- --fix # Auto-fix ESLint issues where possible ``` ### TypeScript Linting @@ -176,7 +177,7 @@ The TypeScript linter checks all three build configurations: ESLint is configured with TypeScript and React plugins (`eslint.config.mjs`): - `react-hooks/rules-of-hooks` - Enforces React hooks rules -- `react-hooks/exhaustive-deps` - Warns about missing hook dependencies +- `react-hooks/exhaustive-deps` - Enforces correct hook dependencies - `@typescript-eslint/no-unused-vars` - Warns about unused variables - `prefer-const` - Suggests const for never-reassigned variables diff --git a/eslint.config.mjs b/eslint.config.mjs index 716793d2..1db58b3f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -55,7 +55,8 @@ export default tseslint.config( argsIgnorePattern: '^_', varsIgnorePattern: '^_', }], - '@typescript-eslint/no-explicit-any': 'off', // Too many existing uses + // TODO: Change to 'warn' after reducing ~304 existing uses + '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-empty-object-type': 'off', '@typescript-eslint/no-require-imports': 'off', // Used in main process @@ -67,6 +68,7 @@ export default tseslint.config( // React Hooks rules 'react-hooks/rules-of-hooks': 'error', + // TODO: Change to 'error' after fixing ~74 existing violations 'react-hooks/exhaustive-deps': 'warn', // General rules diff --git a/src/__tests__/main/agent-detector.test.ts b/src/__tests__/main/agent-detector.test.ts index 3b7b2a7b..877db55f 100644 --- a/src/__tests__/main/agent-detector.test.ts +++ b/src/__tests__/main/agent-detector.test.ts @@ -24,6 +24,7 @@ import * as os from 'os'; describe('agent-detector', () => { let detector: AgentDetector; const mockExecFileNoThrow = vi.mocked(execFileNoThrow); + const originalPlatform = process.platform; beforeEach(() => { vi.clearAllMocks(); @@ -34,6 +35,9 @@ describe('agent-detector', () => { afterEach(() => { vi.restoreAllMocks(); + // Ensure process.platform is always restored to the original value + // This is critical because some tests modify it to test Windows/Unix behavior + Object.defineProperty(process, 'platform', { value: originalPlatform, configurable: true }); }); describe('Type exports', () => { diff --git a/src/main/debug-package/__tests__/packager.test.ts b/src/main/debug-package/__tests__/packager.test.ts index 198d4bee..0d055e69 100644 --- a/src/main/debug-package/__tests__/packager.test.ts +++ b/src/main/debug-package/__tests__/packager.test.ts @@ -211,7 +211,6 @@ describe('Debug Package Packager', () => { 'storage-info.json': { paths: {} }, 'group-chats.json': [], 'batch-state.json': { activeSessions: [] }, - 'windows-diagnostics.json': { platform: 'win32' }, 'collection-errors.json': [], }; diff --git a/tsconfig.cli.json b/tsconfig.cli.json index 22395fb5..2380a2ad 100644 --- a/tsconfig.cli.json +++ b/tsconfig.cli.json @@ -16,6 +16,7 @@ "declaration": false, "sourceMap": true }, + // CLI uses shared types, prompts for auto-run synopsis, and types for module declarations "include": ["src/cli/**/*", "src/shared/**/*", "src/prompts/**/*", "src/types/**/*"], "exclude": ["node_modules", "dist", "release"] }