From de3ff30398ea67bdc6631d3c9524d262a5174bd2 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 30 Aug 2021 21:16:55 -0700 Subject: [PATCH] Add no-floating-promises to admin-tool-ext-win and query-history (#16944) --- extensions/admin-tool-ext-win/.eslintrc.json | 13 +++++++++++++ extensions/admin-tool-ext-win/src/main.ts | 16 ++++++++-------- extensions/query-history/.eslintrc.json | 13 +++++++++++++ extensions/query-history/src/main.ts | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 extensions/admin-tool-ext-win/.eslintrc.json create mode 100644 extensions/query-history/.eslintrc.json diff --git a/extensions/admin-tool-ext-win/.eslintrc.json b/extensions/admin-tool-ext-win/.eslintrc.json new file mode 100644 index 0000000000..335698d7da --- /dev/null +++ b/extensions/admin-tool-ext-win/.eslintrc.json @@ -0,0 +1,13 @@ +{ + "parserOptions": { + "project": "./extensions/admin-tool-ext-win/tsconfig.json" + }, + "rules": { + "@typescript-eslint/no-floating-promises": [ + "error", + { + "ignoreVoid": true + } + ] + } +} diff --git a/extensions/admin-tool-ext-win/src/main.ts b/extensions/admin-tool-ext-win/src/main.ts index e9b436177d..2ce32226b0 100644 --- a/extensions/admin-tool-ext-win/src/main.ts +++ b/extensions/admin-tool-ext-win/src/main.ts @@ -52,7 +52,7 @@ function registerCommands(context: vscode.ExtensionContext): void { async function handleLaunchSsmsMinPropertiesDialogCommand(connectionContext?: azdata.ObjectExplorerContext): Promise { if (!connectionContext) { TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinProperties, 'NoConnectionContext'); - vscode.window.showErrorMessage(localize('adminToolExtWin.noConnectionContextForProp', "No ConnectionContext provided for handleLaunchSsmsMinPropertiesDialogCommand")); + void vscode.window.showErrorMessage(localize('adminToolExtWin.noConnectionContextForProp', "No ConnectionContext provided for handleLaunchSsmsMinPropertiesDialogCommand")); return; } @@ -64,11 +64,11 @@ async function handleLaunchSsmsMinPropertiesDialogCommand(connectionContext?: az nodeType = connectionContext.nodeInfo.nodeType; } else { TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinProperties, 'NoOENode'); - vscode.window.showErrorMessage(localize('adminToolExtWin.noOENode', "Could not determine Object Explorer node from connectionContext : {0}", JSON.stringify(connectionContext))); + void vscode.window.showErrorMessage(localize('adminToolExtWin.noOENode', "Could not determine Object Explorer node from connectionContext : {0}", JSON.stringify(connectionContext))); return; } - launchSsmsDialog( + return launchSsmsDialog( nodeTypeToUrnNameMapping[nodeType].action, connectionContext); } @@ -81,10 +81,10 @@ async function handleLaunchSsmsMinGswDialogCommand(connectionContext?: azdata.Ob const action = 'GenerateScripts'; if (!connectionContext) { TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinGsw, 'NoConnectionContext'); - vscode.window.showErrorMessage(localize('adminToolExtWin.noConnectionContextForGsw', "No ConnectionContext provided for handleLaunchSsmsMinPropertiesDialogCommand")); + void vscode.window.showErrorMessage(localize('adminToolExtWin.noConnectionContextForGsw', "No ConnectionContext provided for handleLaunchSsmsMinPropertiesDialogCommand")); } - launchSsmsDialog( + return launchSsmsDialog( action, connectionContext); } @@ -98,7 +98,7 @@ async function handleLaunchSsmsMinGswDialogCommand(connectionContext?: azdata.Ob async function launchSsmsDialog(action: string, connectionContext: azdata.ObjectExplorerContext): Promise { if (!connectionContext.connectionProfile) { TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinDialog, 'NoConnectionProfile'); - vscode.window.showErrorMessage(localize('adminToolExtWin.noConnectionProfile', "No connectionProfile provided from connectionContext : {0}", JSON.stringify(connectionContext))); + void vscode.window.showErrorMessage(localize('adminToolExtWin.noConnectionProfile', "No connectionProfile provided from connectionContext : {0}", JSON.stringify(connectionContext))); return; } @@ -112,7 +112,7 @@ async function launchSsmsDialog(action: string, connectionContext: azdata.Object } else { TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinDialog, 'NoOENode'); - vscode.window.showErrorMessage(localize('adminToolExtWin.noOENode', "Could not determine Object Explorer node from connectionContext : {0}", JSON.stringify(connectionContext))); + void vscode.window.showErrorMessage(localize('adminToolExtWin.noOENode', "Could not determine Object Explorer node from connectionContext : {0}", JSON.stringify(connectionContext))); return; } @@ -163,7 +163,7 @@ async function launchSsmsDialog(action: string, connectionContext: azdata.Object } if (err !== '') { - vscode.window.showErrorMessage(localize( + void vscode.window.showErrorMessage(localize( 'adminToolExtWin.ssmsMinError', "Error calling SsmsMin with args \'{0}\' - {1}", args, err)); } diff --git a/extensions/query-history/.eslintrc.json b/extensions/query-history/.eslintrc.json new file mode 100644 index 0000000000..32b2c64de3 --- /dev/null +++ b/extensions/query-history/.eslintrc.json @@ -0,0 +1,13 @@ +{ + "parserOptions": { + "project": "./extensions/query-history/tsconfig.json" + }, + "rules": { + "@typescript-eslint/no-floating-promises": [ + "error", + { + "ignoreVoid": true + } + ] + } +} diff --git a/extensions/query-history/src/main.ts b/extensions/query-history/src/main.ts index a4dfb89f50..e7cba0ccaa 100644 --- a/extensions/query-history/src/main.ts +++ b/extensions/query-history/src/main.ts @@ -9,7 +9,7 @@ export async function activate(context: vscode.ExtensionContext): Promise // Currently all the functionality for this is contained within the core ADS // code as the extensibility API doesn't currently support all the required // functionality (such as contributing tab panels) - vscode.commands.executeCommand('queryHistory.enableQueryHistory'); + void vscode.commands.executeCommand('queryHistory.enableQueryHistory'); } export async function deactivate(): Promise {