Add explicit return type linting to some extensions (#19199)

This commit is contained in:
Charles Gagnon
2022-04-25 11:24:23 -07:00
committed by GitHub
parent a7ba78b186
commit 72a43854f8
40 changed files with 202 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
{ {
"rules": { "rules": {
"no-cond-assign": 2, "no-cond-assign": 2,
"jsdoc/check-param-names": "error" "jsdoc/check-param-names": "error",
"@typescript-eslint/explicit-function-return-type": ["error"]
} }
} }

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -8,6 +8,8 @@
{ {
"ignoreVoid": true "ignoreVoid": true
} }
] ],
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
} }
} }

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -8,6 +8,8 @@
{ {
"ignoreVoid": true "ignoreVoid": true
} }
] ],
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
} }
} }

View File

@@ -1,5 +1,6 @@
{ {
"rules": { "rules": {
"no-cond-assign": 0 "no-cond-assign": 0,
"@typescript-eslint/explicit-function-return-type": ["off"]
} }
} }

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -8,6 +8,8 @@
{ {
"ignoreVoid": true "ignoreVoid": true
} }
] ],
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
} }
} }

View File

@@ -8,6 +8,8 @@
{ {
"ignoreVoid": true "ignoreVoid": true
} }
] ],
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
} }
} }

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -68,9 +68,9 @@ export const enterConnectionStringSettingName = localize('enterConnectionStringS
export const enterConnectionString = localize('enterConnectionString', "Enter connection string"); export const enterConnectionString = localize('enterConnectionString', "Enter connection string");
export const saveChangesInFile = localize('saveChangesInFile', "There are unsaved changes in the current file. Save now?"); export const saveChangesInFile = localize('saveChangesInFile', "There are unsaved changes in the current file. Save now?");
export const save = localize('save', "Save"); export const save = localize('save', "Save");
export function settingAlreadyExists(settingName: string) { return localize('SettingAlreadyExists', 'Local app setting \'{0}\' already exists. Overwrite?', settingName); } export function settingAlreadyExists(settingName: string): string { return localize('SettingAlreadyExists', 'Local app setting \'{0}\' already exists. Overwrite?', settingName); }
export function failedToParse(errorMessage: string) { return localize('failedToParse', 'Failed to parse "{0}": {1}.', azureFunctionLocalSettingsFileName, errorMessage); } export function failedToParse(errorMessage: string): string { return localize('failedToParse', 'Failed to parse "{0}": {1}.', azureFunctionLocalSettingsFileName, errorMessage); }
export function jsonParseError(error: string, line: number, column: number) { return localize('jsonParseError', '{0} near line "{1}", column "{2}"', error, line, column); } export function jsonParseError(error: string, line: number, column: number): string { return localize('jsonParseError', '{0} near line "{1}", column "{2}"', error, line, column); }
export const moreInformation = localize('moreInformation', "More Information"); export const moreInformation = localize('moreInformation', "More Information");
export const addPackageReferenceMessage = localize('addPackageReferenceMessage', 'To use SQL bindings, ensure your Azure Functions project has a reference to {0}', sqlExtensionPackageName); export const addPackageReferenceMessage = localize('addPackageReferenceMessage', 'To use SQL bindings, ensure your Azure Functions project has a reference to {0}', sqlExtensionPackageName);
export const addSqlBindingPackageError = localize('addSqlBindingPackageError', 'Error adding Sql Binding extension package to project'); export const addSqlBindingPackageError = localize('addSqlBindingPackageError', 'Error adding Sql Binding extension package to project');
@@ -78,11 +78,11 @@ export const failedToGetConnectionString = localize('failedToGetConnectionString
export const connectionProfile = localize('connectionProfile', 'Select a connection profile'); export const connectionProfile = localize('connectionProfile', 'Select a connection profile');
export const userConnectionString = localize('userConnectionString', 'Enter connection string'); export const userConnectionString = localize('userConnectionString', 'Enter connection string');
export const selectConnectionString = localize('selectConnectionString', 'Select SQL connection string method'); export const selectConnectionString = localize('selectConnectionString', 'Select SQL connection string method');
export const selectConnectionError = (err?: any) => err ? localize('selectConnectionError', "Failed to set connection string app setting: {0}", utils.getErrorMessage(err)) : localize('unableToSetConnectionString', "Failed to set connection string app setting"); export const selectConnectionError = (err?: any): string => err ? localize('selectConnectionError', "Failed to set connection string app setting: {0}", utils.getErrorMessage(err)) : localize('unableToSetConnectionString', "Failed to set connection string app setting");
export const includePassword = localize('includePassword', 'Do you want to include the password from this connection in your local.settings.json file?'); export const includePassword = localize('includePassword', 'Do you want to include the password from this connection in your local.settings.json file?');
export const enterPasswordPrompt = localize('enterPasswordPrompt', 'Enter the password to be used for the connection string'); export const enterPasswordPrompt = localize('enterPasswordPrompt', 'Enter the password to be used for the connection string');
export const enterPasswordManually = localize('enterPasswordManually', 'Enter password or press escape to cancel'); export const enterPasswordManually = localize('enterPasswordManually', 'Enter password or press escape to cancel');
export const userPasswordLater = localize('userPasswordLater', 'In order to user the SQL connection string later you will need to manually enter the password in your local.settings.json file.'); export const userPasswordLater = localize('userPasswordLater', 'In order to user the SQL connection string later you will need to manually enter the password in your local.settings.json file.');
export const openFile = localize('openFile', "Open File"); export const openFile = localize('openFile', "Open File");
export const closeButton = localize('closeButton', "Close"); export const closeButton = localize('closeButton', "Close");
export function addSqlBinding(functionName: string) { return localize('addSqlBinding', 'Adding SQL Binding to function "{0}"...'), functionName; } export function addSqlBinding(functionName: string): string { return localize('addSqlBinding', 'Adding SQL Binding to function "{0}"...'), functionName; }

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { ITreeNodeInfo } from 'vscode-mssql'; import { ITreeNodeInfo } from 'vscode-mssql';
import { IExtension, BindingType } from 'sql-bindings'; import { IExtension, BindingType, GetAzureFunctionsResult, ResultStatus } from 'sql-bindings';
import { getAzdataApi } from './common/utils'; import { getAzdataApi } from './common/utils';
import { addSqlBinding, createAzureFunction, getAzureFunctions } from './services/azureFunctionsService'; import { addSqlBinding, createAzureFunction, getAzureFunctions } from './services/azureFunctionsService';
import { launchAddSqlBindingQuickpick } from './dialogs/addSqlBindingQuickpick'; import { launchAddSqlBindingQuickpick } from './dialogs/addSqlBindingQuickpick';
@@ -19,19 +19,19 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
return await createAzureFunction(node); return await createAzureFunction(node);
})); }));
return { return {
addSqlBinding: async (bindingType: BindingType, filePath: string, functionName: string, objectName: string, connectionStringSetting: string) => { addSqlBinding: async (bindingType: BindingType, filePath: string, functionName: string, objectName: string, connectionStringSetting: string): Promise<ResultStatus> => {
return addSqlBinding(bindingType, filePath, functionName, objectName, connectionStringSetting); return addSqlBinding(bindingType, filePath, functionName, objectName, connectionStringSetting);
}, },
promptForBindingType: async () => { promptForBindingType: async (): Promise<(vscode.QuickPickItem & { type: BindingType }) | undefined> => {
return promptForBindingType(); return promptForBindingType();
}, },
promptForObjectName: async (bindingType: BindingType) => { promptForObjectName: async (bindingType: BindingType): Promise<string | undefined> => {
return promptForObjectName(bindingType); return promptForObjectName(bindingType);
}, },
promptAndUpdateConnectionStringSetting: async (projectUri: vscode.Uri | undefined) => { promptAndUpdateConnectionStringSetting: async (projectUri: vscode.Uri | undefined): Promise<string | undefined> => {
return promptAndUpdateConnectionStringSetting(projectUri); return promptAndUpdateConnectionStringSetting(projectUri);
}, },
getAzureFunctions: async (filePath: string) => { getAzureFunctions: async (filePath: string): Promise<GetAzureFunctionsResult> => {
return getAzureFunctions(filePath); return getAzureFunctions(filePath);
} }
}; };

View File

@@ -8,6 +8,8 @@
{ {
"ignoreVoid": true "ignoreVoid": true
} }
] ],
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
} }
} }

View File

@@ -0,0 +1,6 @@
{
"rules": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/explicit-function-return-type": ["off"]
}
}