From a2df5f4eb46557ee9e596d3a9d59f6823dee9cf2 Mon Sep 17 00:00:00 2001 From: dongmucat <1127093059@qq.com> Date: Wed, 29 Apr 2026 15:43:32 +0800 Subject: [PATCH] fix(cli): remove explicit any type to pass ESLint checks Replace 'any' type annotation with proper type guard in inventory-store.ts and add optional chaining in test to satisfy TypeScript strict checks. All three platforms (Ubuntu, macOS, Windows) CI checks now pass. --- cli/src/stores/inventory-store.ts | 4 ++-- cli/test/unit/stores/inventory-store.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/src/stores/inventory-store.ts b/cli/src/stores/inventory-store.ts index 447c6e32..bb3af84a 100644 --- a/cli/src/stores/inventory-store.ts +++ b/cli/src/stores/inventory-store.ts @@ -74,8 +74,8 @@ export class InventoryStore { const lockData = JSON.stringify({ pid: process.pid, timestamp: Date.now() }) await writeFile(lockPath, lockData) return lockHandle - } catch (err: any) { - if (err.code !== 'EEXIST') throw err + } catch (err) { + if (err instanceof Error && 'code' in err && err.code !== 'EEXIST') throw err // Lock exists, check if it's stale (older than 30 seconds) // 30s threshold chosen to balance between: diff --git a/cli/test/unit/stores/inventory-store.test.ts b/cli/test/unit/stores/inventory-store.test.ts index 02c3f33d..9a4ca3e5 100644 --- a/cli/test/unit/stores/inventory-store.test.ts +++ b/cli/test/unit/stores/inventory-store.test.ts @@ -62,7 +62,7 @@ describe('InventoryStore', () => { const inventory = await store.read() expect(inventory.items).toHaveLength(1) - expect(inventory.items[0].slug).toBe('test-skill') + expect(inventory.items[0]?.slug).toBe('test-skill') }) test('removeTarget returns false when item not found', async () => {