Add no-floating-promises to admin-tool-ext-win and query-history (#16944)

This commit is contained in:
Charles Gagnon
2021-08-30 21:16:55 -07:00
committed by GitHub
parent a06fc0e990
commit de3ff30398
4 changed files with 35 additions and 9 deletions

View File

@@ -0,0 +1,13 @@
{
"parserOptions": {
"project": "./extensions/admin-tool-ext-win/tsconfig.json"
},
"rules": {
"@typescript-eslint/no-floating-promises": [
"error",
{
"ignoreVoid": true
}
]
}
}

View File

@@ -52,7 +52,7 @@ function registerCommands(context: vscode.ExtensionContext): void {
async function handleLaunchSsmsMinPropertiesDialogCommand(connectionContext?: azdata.ObjectExplorerContext): Promise<void> { async function handleLaunchSsmsMinPropertiesDialogCommand(connectionContext?: azdata.ObjectExplorerContext): Promise<void> {
if (!connectionContext) { if (!connectionContext) {
TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinProperties, 'NoConnectionContext'); 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; return;
} }
@@ -64,11 +64,11 @@ async function handleLaunchSsmsMinPropertiesDialogCommand(connectionContext?: az
nodeType = connectionContext.nodeInfo.nodeType; nodeType = connectionContext.nodeInfo.nodeType;
} else { } else {
TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinProperties, 'NoOENode'); 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; return;
} }
launchSsmsDialog( return launchSsmsDialog(
nodeTypeToUrnNameMapping[nodeType].action, nodeTypeToUrnNameMapping[nodeType].action,
connectionContext); connectionContext);
} }
@@ -81,10 +81,10 @@ async function handleLaunchSsmsMinGswDialogCommand(connectionContext?: azdata.Ob
const action = 'GenerateScripts'; const action = 'GenerateScripts';
if (!connectionContext) { if (!connectionContext) {
TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinGsw, 'NoConnectionContext'); 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, action,
connectionContext); connectionContext);
} }
@@ -98,7 +98,7 @@ async function handleLaunchSsmsMinGswDialogCommand(connectionContext?: azdata.Ob
async function launchSsmsDialog(action: string, connectionContext: azdata.ObjectExplorerContext): Promise<void> { async function launchSsmsDialog(action: string, connectionContext: azdata.ObjectExplorerContext): Promise<void> {
if (!connectionContext.connectionProfile) { if (!connectionContext.connectionProfile) {
TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinDialog, 'NoConnectionProfile'); 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; return;
} }
@@ -112,7 +112,7 @@ async function launchSsmsDialog(action: string, connectionContext: azdata.Object
} }
else { else {
TelemetryReporter.sendErrorEvent(TelemetryViews.SsmsMinDialog, 'NoOENode'); 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; return;
} }
@@ -163,7 +163,7 @@ async function launchSsmsDialog(action: string, connectionContext: azdata.Object
} }
if (err !== '') { if (err !== '') {
vscode.window.showErrorMessage(localize( void vscode.window.showErrorMessage(localize(
'adminToolExtWin.ssmsMinError', 'adminToolExtWin.ssmsMinError',
"Error calling SsmsMin with args \'{0}\' - {1}", args, err)); "Error calling SsmsMin with args \'{0}\' - {1}", args, err));
} }

View File

@@ -0,0 +1,13 @@
{
"parserOptions": {
"project": "./extensions/query-history/tsconfig.json"
},
"rules": {
"@typescript-eslint/no-floating-promises": [
"error",
{
"ignoreVoid": true
}
]
}
}

View File

@@ -9,7 +9,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
// Currently all the functionality for this is contained within the core ADS // Currently all the functionality for this is contained within the core ADS
// code as the extensibility API doesn't currently support all the required // code as the extensibility API doesn't currently support all the required
// functionality (such as contributing tab panels) // functionality (such as contributing tab panels)
vscode.commands.executeCommand('queryHistory.enableQueryHistory'); void vscode.commands.executeCommand('queryHistory.enableQueryHistory');
} }
export async function deactivate(): Promise<void> { export async function deactivate(): Promise<void> {