From 66b50a760374826dc940d61c343468664ec8cfe9 Mon Sep 17 00:00:00 2001 From: Tamas Boncz Date: Tue, 26 May 2026 00:33:10 +0200 Subject: [PATCH] fix: enforce error handling for promises and improve command execution --- eslint.config.mjs | 20 ++++++++++---------- src/core/parser-shared.test.ts | 3 +-- src/extension.ts | 6 +++--- src/webview/page-burndown.ts | 4 ++-- src/webview/panel-request-service.ts | 2 +- src/webview/panel-sidebar.ts | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 4275bc46..b6d1c0c4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -33,17 +33,17 @@ export default tseslint.config( varsIgnorePattern: "^_", }, ], - "@typescript-eslint/no-floating-promises": "warn", - "@typescript-eslint/no-misused-promises": "warn", - "@typescript-eslint/no-unsafe-argument": "warn", - "@typescript-eslint/no-unsafe-assignment": "warn", - "@typescript-eslint/no-unsafe-member-access": "warn", - "@typescript-eslint/no-unsafe-call": "warn", - "@typescript-eslint/no-unsafe-return": "warn", - "@typescript-eslint/no-base-to-string": "warn", + "@typescript-eslint/no-floating-promises": "error", + "@typescript-eslint/no-misused-promises": "error", + "@typescript-eslint/no-unsafe-argument": "error", + "@typescript-eslint/no-unsafe-assignment": "error", + "@typescript-eslint/no-unsafe-member-access": "error", + "@typescript-eslint/no-unsafe-call": "error", + "@typescript-eslint/no-unsafe-return": "error", + "@typescript-eslint/no-base-to-string": "error", "@typescript-eslint/prefer-promise-reject-errors": "warn", "@typescript-eslint/no-unnecessary-type-assertion": "warn", - "@typescript-eslint/restrict-template-expressions": "warn", + "@typescript-eslint/restrict-template-expressions": "error", "@typescript-eslint/no-redundant-type-constituents": "warn", "@typescript-eslint/require-await": "warn", "complexity": ["warn", { max: 20 }], @@ -59,7 +59,7 @@ export default tseslint.config( "warn", { groups: ["builtin", "external", "internal", "parent", "sibling"] }, ], - "import-x/no-duplicates": "warn", + "import-x/no-duplicates": "error", // unicorn (modern JS best practices) "unicorn/no-array-for-each": "warn", diff --git a/src/core/parser-shared.test.ts b/src/core/parser-shared.test.ts index 6de381dc..d4926f02 100644 --- a/src/core/parser-shared.test.ts +++ b/src/core/parser-shared.test.ts @@ -4,8 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { describe, it, expect } from 'vitest'; -import { detectDevcontainerFromRequests } from './parser-shared'; -import { createRequest, createSession } from './parser-shared'; +import { detectDevcontainerFromRequests, createRequest, createSession } from './parser-shared'; import { SessionRequest } from './types'; function makeReq(overrides: Partial = {}): SessionRequest { diff --git a/src/extension.ts b/src/extension.ts index 4409c876..84d41ad8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -34,7 +34,7 @@ function loadPanelModule(): Promise { async function exportSummaryFromLogs(): Promise { const dirs = findLogsDirs(); if (dirs.length === 0) { - vscode.window.showErrorMessage('No AI coding session log directories found.'); + void vscode.window.showErrorMessage('No AI coding session log directories found.'); return; } @@ -89,7 +89,7 @@ async function reviewPendingTrust(context: vscode.ExtensionContext): PromiseLoading models\u2026`, target); - fetchHistoricalBudgets().then(peak => { + void fetchHistoricalBudgets().then(peak => { discoveredModels = peak; modelsLoaded = true; // Seed modelBudgets with discovered models (keep existing budgets) diff --git a/src/webview/panel-request-service.ts b/src/webview/panel-request-service.ts index 1ce2d31e..a5a09260 100644 --- a/src/webview/panel-request-service.ts +++ b/src/webview/panel-request-service.ts @@ -292,7 +292,7 @@ Generate 3 ${context.difficulty} interview-style questions tailored to this deve const prompt = isString(params.prompt) ? params.prompt : ''; if (!prompt) return; - vscode.commands.executeCommand('workbench.action.chat.open', { + void vscode.commands.executeCommand('workbench.action.chat.open', { query: prompt, }).then( () => postResponse(this.webview, msg.id, { ok: true }), diff --git a/src/webview/panel-sidebar.ts b/src/webview/panel-sidebar.ts index a0059a44..6f0b59c9 100644 --- a/src/webview/panel-sidebar.ts +++ b/src/webview/panel-sidebar.ts @@ -28,7 +28,7 @@ export class DashboardSidebarProvider implements vscode.WebviewViewProvider { webviewView.webview.html = this.renderHtml(webviewView.webview); webviewView.webview.onDidReceiveMessage((msg: { command: string }) => { - vscode.commands.executeCommand(msg.command); + void vscode.commands.executeCommand(msg.command); }); }