From 4c5b80d02a09dac57b77001f4737f99bba13451e Mon Sep 17 00:00:00 2001 From: 0xMink <260166390+0xMink@users.noreply.github.com> Date: Fri, 22 May 2026 08:00:39 +0000 Subject: [PATCH] chore: enforce no-floating-promises in activate/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First slice of a ratchet that re-enables @typescript-eslint/no-floating-promises directory by directory. The rule and type-aware linting are scoped to activate/** via a files-block in eslint.config.mjs, so pnpm lint (eslint --max-warnings=0) stays green; later PRs widen the scope. registerCommands.ts had 7 un-awaited postMessageToWebview calls: the 5 in synchronous command handlers are marked void (intentional fire-and-forget); the 2 in async handlers are awaited — one sits inside a try/catch, so awaiting routes a rejected post into the existing error handling. --- src/activate/registerCommands.ts | 14 +++++++------- src/eslint.config.mjs | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/activate/registerCommands.ts b/src/activate/registerCommands.ts index 0fb2c9d040..0c652f1fc9 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -103,9 +103,9 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt TelemetryService.instance.captureTitleButtonClicked("settings") - visibleProvider.postMessageToWebview({ type: "action", action: "settingsButtonClicked" }) + void visibleProvider.postMessageToWebview({ type: "action", action: "settingsButtonClicked" }) // Also explicitly post the visibility message to trigger scroll reliably - visibleProvider.postMessageToWebview({ type: "action", action: "didBecomeVisible" }) + void visibleProvider.postMessageToWebview({ type: "action", action: "didBecomeVisible" }) }, historyButtonClicked: () => { const visibleProvider = getVisibleProviderOrLog(outputChannel) @@ -116,12 +116,12 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt TelemetryService.instance.captureTitleButtonClicked("history") - visibleProvider.postMessageToWebview({ type: "action", action: "historyButtonClicked" }) + void visibleProvider.postMessageToWebview({ type: "action", action: "historyButtonClicked" }) }, marketplaceButtonClicked: () => { const visibleProvider = getVisibleProviderOrLog(outputChannel) if (!visibleProvider) return - visibleProvider.postMessageToWebview({ type: "action", action: "marketplaceButtonClicked" }) + void visibleProvider.postMessageToWebview({ type: "action", action: "marketplaceButtonClicked" }) }, newTask: handleNewTask, setCustomStoragePath: async () => { @@ -150,7 +150,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt // Send focus input message only for sidebar panels if (sidebarPanel && getPanel() === sidebarPanel) { - provider.postMessageToWebview({ type: "action", action: "focusInput" }) + await provider.postMessageToWebview({ type: "action", action: "focusInput" }) } } catch (error) { outputChannel.appendLine(`Error focusing input: ${error}`) @@ -170,7 +170,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt return } - visibleProvider.postMessageToWebview({ type: "acceptInput" }) + void visibleProvider.postMessageToWebview({ type: "acceptInput" }) }, toggleAutoApprove: async () => { const visibleProvider = getVisibleProviderOrLog(outputChannel) @@ -179,7 +179,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt return } - visibleProvider.postMessageToWebview({ + await visibleProvider.postMessageToWebview({ type: "action", action: "toggleAutoApprove", }) diff --git a/src/eslint.config.mjs b/src/eslint.config.mjs index d0813406d9..6441a0cfd9 100644 --- a/src/eslint.config.mjs +++ b/src/eslint.config.mjs @@ -29,6 +29,20 @@ export default [ "no-undef": "off", }, }, + { + // Ratchet: enforce no-floating-promises directory by directory. Each + // directory is added here once its floating promises are resolved. + files: ["activate/**/*.ts"], + languageOptions: { + parserOptions: { + project: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + "@typescript-eslint/no-floating-promises": "error", + }, + }, { ignores: ["webview-ui", "out"], },