This commit is contained in:
Will Lorey 2021-02-12 11:31:51 -08:00 коммит произвёл GitHub
Родитель 28650c90a2
Коммит 4d43353ad9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
139 изменённых файлов: 15954 добавлений и 526 удалений

2
.eslintignore Normal file
Просмотреть файл

@ -0,0 +1,2 @@
gulpfile.ts
.eslintrc.js

37
.eslintrc.js Normal file
Просмотреть файл

@ -0,0 +1,37 @@
module.exports = {
"env": {
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"import"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"no-unused-vars": "off",
"no-useless-escape": "off",
"no-inner-declarations": "off",
"no-case-declarations": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
],
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "off",
}
};

2
.vscode/extensions.json поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"dbaeumer.vscode-eslint",
"ms-vscode.azure-account"
]
}

3
.vscode/settings.json поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.tslint": true,
"source.fixAll.eslint": true,
"source.organizeImports": true
},
"editor.detectIndentation": false,
@ -18,7 +18,6 @@
".vscode-test": true,
"resources/backup*Templates": true
},
"tslint.ignoreDefinitionFiles": true,
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.tsdk": "node_modules/typescript/lib"
}

2
.vscode/tasks.json поставляемый
Просмотреть файл

@ -17,7 +17,7 @@
{
"type": "npm",
"script": "lint",
"problemMatcher": "$tslint5"
"problemMatcher": "$eslint-stylish"
}
]
}

Просмотреть файл

@ -1,4 +1,6 @@
.azure-pipelines/**
.eslintignore
.eslintrc.js
.github/**
.gitignore
.vscode-test/**
@ -21,6 +23,5 @@ test/**
testWorkspace/**
tools/**
tsconfig.json
tslint.json
typings/**
webpack.config*

Просмотреть файл

@ -3,13 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// tslint:disable:no-console
// tslint:disable:no-implicit-dependencies (this allows the use of dev dependencies)
// Grandfathered in
// tslint:disable:typedef
// tslint:disable:no-unsafe-any
import * as msRest from '@azure/ms-rest-js';
import * as fse from 'fs-extra';
import * as gulp from 'gulp';

15880
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1060,8 +1060,8 @@
"compile": "tsc -watch",
"cleanReadme": "gulp cleanReadme",
"package": "vsce package --githubBranch main",
"lint": "tslint --project tsconfig.json -t verbose",
"lint-fix": "tslint --project tsconfig.json -t verbose --fix",
"lint": "eslint --ext .ts .",
"lint-fix": "eslint --ext .ts . --fix",
"pretest": "npm run webpack-prod && gulp preTest",
"test": "node ./out/test/runTest.js",
"webpack": "npm run build && gulp webpack-dev",
@ -1085,7 +1085,11 @@
"@types/websocket": "^1.0.0",
"@types/xml2js": "^0.4.5",
"@types/xregexp": "^3.0.30",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"copy-webpack-plugin": "^6.0.3",
"eslint": "^7.19.0",
"eslint-plugin-import": "^2.22.1",
"glob": "^7.1.6",
"gulp": "^4.0.2",
"gulp-chmod": "^2.0.0",
@ -1096,8 +1100,6 @@
"mocha-multi-reporters": "^1.1.7",
"request": "^2.88.2",
"ts-node": "^7.0.1",
"tslint": "^5.20.1",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "^3.8.3",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",

Просмотреть файл

@ -29,11 +29,11 @@ export async function promptForFuncVersion(message?: string): Promise<FuncVersio
picks.push({ label: localize('learnMore', '$(link-external) Learn more...'), description: '', data: undefined });
const options: IAzureQuickPickOptions = { placeHolder: message || localize('selectVersion', 'Select a version'), suppressPersistence: true };
// tslint:disable-next-line: no-constant-condition
// eslint-disable-next-line no-constant-condition
while (true) {
const version: FuncVersion | undefined = (await ext.ui.showQuickPick(picks, options)).data;
if (version === undefined) {
await openUrl('https://aka.ms/AA1tpij');
openUrl('https://aka.ms/AA1tpij');
} else {
return version;
}

Просмотреть файл

@ -31,7 +31,6 @@ export class BindingCreateStep extends AzureWizardExecuteStep<IBindingWizardCont
}
await confirmEditJsonFile(context.functionJsonPath, (functionJson: IFunctionJson) => {
// tslint:disable-next-line: strict-boolean-expressions
functionJson.bindings = functionJson.bindings || [];
functionJson.bindings.push(binding);
return functionJson;
@ -40,7 +39,7 @@ export class BindingCreateStep extends AzureWizardExecuteStep<IBindingWizardCont
await verifyExtensionBundle(context, bindingTemplate);
window.showTextDocument(await workspace.openTextDocument(Uri.file(context.functionJsonPath)));
await window.showTextDocument(await workspace.openTextDocument(Uri.file(context.functionJsonPath)));
}
public shouldExecute(context: IBindingWizardContext): boolean {

Просмотреть файл

@ -26,6 +26,7 @@ export class BindingListStep extends AzureWizardPromptStep<IBindingWizardContext
return !context.bindingTemplate;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async getSubWizard(context: IBindingWizardContext): Promise<IWizardOptions<IBindingWizardContext> | undefined> {
const binding: IBindingTemplate | undefined = context.bindingTemplate;
if (binding) {

Просмотреть файл

@ -38,7 +38,7 @@ export class BindingNameStep extends StringPromptStep {
} else if (await this.bindingExists(context, val)) {
return localize('existingBindingError', 'A binding with the name "{0}" already exists.', val);
} else {
return await super.validateInput(context, val);
return super.validateInput(context, val);
}
}

Просмотреть файл

@ -28,7 +28,7 @@ export class LocalAppSettingCreateStep extends AzureWizardExecuteStep<IBindingWi
public async execute(context: IBindingWizardContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
progress.report({ message: localize('updatingLocalSettings', 'Updating {0}...', localSettingsFileName) });
const appSettingName: string | undefined = nonNullValue(getBindingSetting(context, this._setting), this._setting.name);
// tslint:disable-next-line: no-unsafe-any no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await setLocalAppSetting(context.projectPath, appSettingName, nonNullProp(context, <any>this._valueKey));
}

Просмотреть файл

@ -17,10 +17,12 @@ export class StringPromptStep extends BindingSettingStepBase {
});
}
// eslint-disable-next-line @typescript-eslint/require-await
public async getDefaultValue(_wizardContext: IBindingWizardContext): Promise<string | undefined> {
return this._setting.defaultValue;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async validateInput(_wizardContext: IBindingWizardContext, val: string | undefined): Promise<string | undefined> {
return this._setting.validateSetting(val);
}

Просмотреть файл

@ -40,7 +40,6 @@ export class AzureWebJobsStoragePromptStep<T extends IAzureWebJobsStorageWizardC
context.azureWebJobsStorageType = 'emulator';
}
// tslint:disable-next-line: strict-boolean-expressions
context.telemetry.properties.azureWebJobsStorageType = context.azureWebJobsStorageType || 'skipForNow';
}

Просмотреть файл

@ -66,7 +66,7 @@ export async function downloadAppSettingsInternal(context: IActionContext, clien
ext.outputChannel.appendLog(localize('downloadedSettings', 'Successfully downloaded settings.'), { resourceName: client.fullName });
const openFile: string = localize('openFile', 'Open File');
// don't wait
vscode.window.showInformationMessage(localize('downloadedSettingsFrom', 'Successfully downloaded settings from "{0}".', client.fullName), openFile, viewOutput).then(async result => {
void vscode.window.showInformationMessage(localize('downloadedSettingsFrom', 'Successfully downloaded settings from "{0}".', client.fullName), openFile, viewOutput).then(async result => {
if (result === openFile) {
const doc: vscode.TextDocument = await vscode.workspace.openTextDocument(localSettingsUri);
await vscode.window.showTextDocument(doc);

Просмотреть файл

@ -16,7 +16,6 @@ import { tryGetFunctionProjectRoot } from "../createNewProject/verifyIsProject";
* Otherwise, prompt
*/
export async function getLocalSettingsFile(message: string, workspacePath?: string): Promise<string> {
// tslint:disable-next-line: strict-boolean-expressions
const folders: readonly WorkspaceFolder[] = workspace.workspaceFolders || [];
if (workspacePath || folders.length === 1) {
workspacePath = workspacePath || folders[0].uri.fsPath;

Просмотреть файл

@ -60,7 +60,7 @@ export async function uploadAppSettingsInternal(context: IActionContext, client:
ext.outputChannel.appendLog(localize('uploadedSettings', 'Successfully uploaded settings.'), { resourceName: client.fullName });
// don't wait
vscode.window.showInformationMessage(localize('uploadedSettingsTo', 'Successfully uploaded settings to "{0}".', client.fullName), viewOutput).then(async result => {
void vscode.window.showInformationMessage(localize('uploadedSettingsTo', 'Successfully uploaded settings to "{0}".', client.fullName), viewOutput).then(result => {
if (result === viewOutput) {
ext.outputChannel.show();
}

Просмотреть файл

@ -14,5 +14,5 @@ export async function browseWebsite(context: IActionContext, node?: SlotTreeItem
node = await ext.tree.showTreeItemPicker<SlotTreeItemBase>(ProductionSlotTreeItem.contextValue, context);
}
await openUrl(node.root.client.defaultHostUrl);
openUrl(node.root.client.defaultHostUrl);
}

Просмотреть файл

@ -22,13 +22,13 @@ interface ICachedFunction {
const cacheKey: string = 'azFuncPostFunctionCreate';
export function runPostFunctionCreateStepsFromCache(): void {
export async function runPostFunctionCreateStepsFromCache(): Promise<void> {
const cachedFunc: ICachedFunction | undefined = ext.context.globalState.get(cacheKey);
if (cachedFunc) {
try {
runPostFunctionCreateSteps(cachedFunc);
} finally {
ext.context.globalState.update(cacheKey, undefined);
await ext.context.globalState.update(cacheKey, undefined);
}
}
}
@ -57,9 +57,9 @@ export abstract class FunctionCreateStepBase<T extends IFunctionWizardContext> e
if (context.openBehavior) {
// OpenFolderStep sometimes restarts the extension host, so we will cache this to run on the next extension activation
ext.context.globalState.update(cacheKey, cachedFunc);
await ext.context.globalState.update(cacheKey, cachedFunc);
// Delete cached information if the extension host was not restarted after 5 seconds
setTimeout(() => { ext.context.globalState.update(cacheKey, undefined); }, 5 * 1000);
setTimeout(() => { void ext.context.globalState.update(cacheKey, undefined); }, 5 * 1000);
}
runPostFunctionCreateSteps(cachedFunc);
@ -72,13 +72,12 @@ export abstract class FunctionCreateStepBase<T extends IFunctionWizardContext> e
function runPostFunctionCreateSteps(func: ICachedFunction): void {
// Don't wait
// tslint:disable-next-line: no-floating-promises
callWithTelemetryAndErrorHandling('postFunctionCreate', async (context: IActionContext) => {
void callWithTelemetryAndErrorHandling('postFunctionCreate', async (context: IActionContext) => {
context.telemetry.suppressIfSuccessful = true;
if (getContainingWorkspace(func.projectPath)) {
if (await fse.pathExists(func.newFilePath)) {
window.showTextDocument(await workspace.openTextDocument(Uri.file(func.newFilePath)));
await window.showTextDocument(await workspace.openTextDocument(Uri.file(func.newFilePath)));
}
}
});

Просмотреть файл

@ -38,7 +38,6 @@ export class FunctionListStep extends AzureWizardPromptStep<IFunctionWizardConte
private constructor(functionSettings: { [key: string]: string | undefined } | undefined, isProjectWizard: boolean | undefined) {
super();
// tslint:disable-next-line: strict-boolean-expressions
this._functionSettings = functionSettings || {};
this._isProjectWizard = !!isProjectWizard;
}
@ -142,7 +141,6 @@ export class FunctionListStep extends AzureWizardPromptStep<IFunctionWizardConte
}
public async prompt(context: IFunctionWizardContext): Promise<void> {
// tslint:disable-next-line: strict-boolean-expressions
let templateFilter: TemplateFilter = getWorkspaceSetting<TemplateFilter>(templateFilterSetting, context.projectPath) || TemplateFilter.Verified;
while (!context.functionTemplate) {

Просмотреть файл

@ -18,7 +18,7 @@ export function setBindingSetting(context: IFunctionWizardContext, setting: IBin
}
export function getBindingSetting(context: IFunctionWizardContext, setting: IBindingSetting): string | undefined {
// tslint:disable-next-line: no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const value: string | undefined = context[setting.name.toLowerCase()];
if (value) {
return value;

Просмотреть файл

@ -76,7 +76,7 @@ async function getWorkspaceFolder(context: IActionContext): Promise<WorkspaceFol
if (result === newProject) {
// don't wait
commands.executeCommand('azureFunctions.createNewProject');
void commands.executeCommand('azureFunctions.createNewProject');
context.telemetry.properties.noWorkspaceResult = 'createNewProject';
} else {
const uri: Uri[] = await context.ui.showOpenDialog({
@ -86,7 +86,7 @@ async function getWorkspaceFolder(context: IActionContext): Promise<WorkspaceFol
openLabel: localize('open', 'Open')
});
// don't wait
commands.executeCommand('vscode.openFolder', uri[0]);
void commands.executeCommand('vscode.openFolder', uri[0]);
context.telemetry.properties.noWorkspaceResult = 'openExistingProject';
}

Просмотреть файл

@ -83,9 +83,9 @@ async function validateAutorestInstalled(context: IActionContext): Promise<void>
} catch (error) {
const message: string = localize('autorestNotFound', 'Failed to find "autorest" | Extension needs AutoRest to generate a function app from an OpenAPI specification. Click "Learn more" for more details on installation steps.');
if (!context.errorHandling.suppressDisplay) {
window.showErrorMessage(message, DialogResponses.learnMore).then(async result => {
void window.showErrorMessage(message, DialogResponses.learnMore).then(result => {
if (result === DialogResponses.learnMore) {
await openUrl('https://aka.ms/autorest');
openUrl('https://aka.ms/autorest');
}
});
context.errorHandling.suppressDisplay = true;
@ -101,7 +101,6 @@ async function addAutorestSpecificTypescriptDependencies(context: IFunctionWizar
const packagePath: string = path.join(context.projectPath, 'package.json');
await confirmEditJsonFile(packagePath, (data: { devDependencies?: { [key: string]: string } }): {} => {
// tslint:disable-next-line: strict-boolean-expressions
data.devDependencies = data.devDependencies || {};
if (!data.devDependencies[coreHttp]) {
data.devDependencies[coreHttp] = coreHttpVersion;

Просмотреть файл

@ -16,7 +16,7 @@ export class TypeScriptFunctionCreateStep extends ScriptFunctionCreateStep {
let outDir: string = tsDefaultOutDir;
try {
const tsconfigPath: string = path.join(context.projectPath, tsConfigFileName);
// tslint:disable-next-line:no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
outDir = (await fse.readJSON(tsconfigPath)).compilerOptions.outDir;
} catch {
// ignore and use default outDir

Просмотреть файл

@ -85,6 +85,7 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi
name: extensionVersionKey,
value: '~' + getMajorVersion(context.version)
},
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
...Object.entries(stackSettings.appSettingsDictionary).map(([name, value]) => { return { name, value }; })
];

Просмотреть файл

@ -24,6 +24,7 @@ export class FunctionAppHostingPlanStep extends AzureWizardPromptStep<IAppServic
return context.useConsumptionPlan === undefined;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async getSubWizard(context: IAppServiceWizardContext): Promise<IWizardOptions<IAppServiceWizardContext> | undefined> {
if (!context.useConsumptionPlan) {
return { promptSteps: [new AppServicePlanListStep()] };

Просмотреть файл

@ -23,7 +23,7 @@ export function showSiteCreated(client: SiteClient, context: ISiteCreatedOptions
if (context.showCreatedNotification) {
// don't wait
window.showInformationMessage(message, viewOutput).then(async result => {
void window.showInformationMessage(message, viewOutput).then(result => {
if (result === viewOutput) {
ext.outputChannel.show();
}

Просмотреть файл

@ -5,7 +5,6 @@
// Types copied from here:
// https://github.com/Azure/azure-functions-ux/blob/3322f0b5151bbfcf7a08f281efe678ebac643dc0/server/src/stacks/2020-10-01/models/AppStackModel.ts
// tslint:disable: interface-name
export interface AppStack<T, V> {
displayText: string;

Просмотреть файл

@ -7,7 +7,6 @@ import { AppInsightsSettings, AppStack, CommonSettings, GitHubActionSettings } f
// Types copied from here:
// https://github.com/Azure/azure-functions-ux/blob/3322f0b5151bbfcf7a08f281efe678ebac643dc0/server/src/stacks/2020-10-01/models/FunctionAppStackModel.ts
// tslint:disable: interface-name
export type FunctionAppStack = AppStack<FunctionAppRuntimes, FunctionAppStackValue>;
export type FunctionAppStackValue = 'dotnet' | 'java' | 'node' | 'powershell' | 'python' | 'custom';

Просмотреть файл

@ -62,7 +62,7 @@ export class NewProjectLanguageStep extends AzureWizardPromptStep<IProjectWizard
const options: QuickPickOptions = { placeHolder: localize('selectLanguage', 'Select a language') };
const result: ProjectLanguage | undefined = (await context.ui.showQuickPick(languagePicks, options)).data;
if (result === undefined) {
await openUrl('https://aka.ms/AA4ul9b');
openUrl('https://aka.ms/AA4ul9b');
context.telemetry.properties.cancelStep = 'viewSampleProjects';
throw new UserCancelledError();
} else {

Просмотреть файл

@ -11,7 +11,6 @@ export class OpenFolderStep extends AzureWizardExecuteStep<IProjectWizardContext
public priority: number = 250;
public async execute(context: IProjectWizardContext): Promise<void> {
// tslint:disable-next-line:strict-boolean-expressions
const openFolders: readonly WorkspaceFolder[] = workspace.workspaceFolders || [];
if (context.openBehavior === 'AddToWorkspace' && openFolders.length === 0) {
// no point in adding to an empty workspace

Просмотреть файл

@ -56,7 +56,6 @@ export function convertToValidPackageName(name: string): string {
}
// https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore
// tslint:disable-next-line:no-multiline-string
const nodeGitignore: string = `# Logs
logs
*.log

Просмотреть файл

@ -67,7 +67,7 @@ export class PowerShellProjectCreateStep extends ScriptProjectCreateStep {
public async executeCore(context: IProjectWizardContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
if (await hasMinFuncCliVersion('3.0.2534', context.version)) {
// tslint:disable-next-line:no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.localSettingsJson.Values![workerRuntimeVersionKey] = '~7';
}
@ -121,14 +121,13 @@ export class PowerShellProjectCreateStep extends ScriptProjectCreateStep {
}
private parseLatestAzModuleVersion(response: HttpOperationResponse): string {
// tslint:disable-next-line: no-any
/* eslint-disable */
const moduleInfo: any = response.parsedBody;
// tslint:disable: no-unsafe-any
if (moduleInfo?.entry && Array.isArray(moduleInfo.entry)) {
const releasedVersions: string[] = moduleInfo.entry
.filter(entry => entry['m:properties']['d:IsPrerelease']._ === 'false')
.map(entry => entry['m:properties']['d:Version']);
// tslint:enable: no-unsafe-any
/* eslint-enable */
// Select the latest version
if (releasedVersions.length > 0) {

Просмотреть файл

@ -52,7 +52,6 @@ export class PythonProjectCreateStep extends ScriptProjectCreateStep {
}
// https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
// tslint:disable-next-line:no-multiline-string
const pythonGitignore: string = `# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

Просмотреть файл

@ -40,7 +40,7 @@ export class ScriptProjectCreateStep extends ProjectCreateStepBase {
if (await confirmOverwriteFile(localSettingsJsonPath)) {
const functionsWorkerRuntime: string | undefined = getFunctionsWorkerRuntime(context.language);
if (functionsWorkerRuntime) {
// tslint:disable-next-line:no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.localSettingsJson.Values![workerRuntimeKey] = functionsWorkerRuntime;
}
@ -50,7 +50,6 @@ export class ScriptProjectCreateStep extends ProjectCreateStepBase {
const proxiesJsonPath: string = path.join(context.projectPath, proxiesFileName);
if (await confirmOverwriteFile(proxiesJsonPath)) {
await writeFormattedJson(proxiesJsonPath, {
// tslint:disable-next-line:no-http-string
$schema: 'http://json.schemastore.org/proxies',
proxies: {}
});

Просмотреть файл

@ -45,11 +45,8 @@ export async function createNewProjectFromCommand(
export async function createNewProjectInternal(context: IActionContext, options: api.ICreateFunctionOptions): Promise<void> {
addLocalFuncTelemetry(context);
// tslint:disable-next-line: strict-boolean-expressions
const language: ProjectLanguage | undefined = <ProjectLanguage>options.language || getGlobalSetting(projectLanguageSetting);
// tslint:disable-next-line: strict-boolean-expressions
const version: string = options.version || getGlobalSetting(funcVersionSetting) || await tryGetLocalFuncVersion() || latestGAVersion;
const wizardContext: Partial<IFunctionWizardContext> & IActionContext = Object.assign(context, options, { language, version: tryParseFuncVersion(version) });
if (options.folderPath) {
@ -72,5 +69,5 @@ export async function createNewProjectInternal(context: IActionContext, options:
await wizard.execute();
// don't wait
window.showInformationMessage(localize('finishedCreating', 'Finished creating project.'));
void window.showInformationMessage(localize('finishedCreating', 'Finished creating project.'));
}

Просмотреть файл

@ -14,7 +14,6 @@ export class JavaPackageNameStep extends AzureWizardPromptStep<IJavaProjectWizar
placeHolder: localize('packagePlaceHolder', 'Package name'),
prompt: localize('packagePrompt', 'Provide a package name'),
validateInput: validatePackageName,
// tslint:disable-next-line: strict-boolean-expressions
value: context.javaGroupId || 'com.function'
};
context.javaPackageName = await context.ui.showInputBox(options);

Просмотреть файл

@ -29,6 +29,7 @@ export class PythonAliasListStep extends AzureWizardPromptStep<IPythonVenvWizard
return !context.useExistingVenv && !context.pythonAlias;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async getSubWizard(context: IPythonVenvWizardContext): Promise<IWizardOptions<IPythonVenvWizardContext> | undefined> {
if (context.manuallyEnterAlias) {
return {

Просмотреть файл

@ -28,8 +28,7 @@ export class PythonVenvCreateStep extends AzureWizardExecuteStep<IPythonVenvWiza
}
// Don't wait just for telemetry and don't block on errors
// tslint:disable-next-line: no-floating-promises
getPythonVersion(pythonAlias).then(value => context.telemetry.properties.pythonVersion = value);
void getPythonVersion(pythonAlias).then(value => context.telemetry.properties.pythonVersion = value);
await cpUtils.executeCommand(ext.outputChannel, context.projectPath, pythonAlias, '-m', 'venv', context.venvName);

Просмотреть файл

@ -74,7 +74,6 @@ async function promptForProjectSubpath(workspacePath: string, matchingSubpaths:
* Checks if the path is already a function project. If not, it will prompt to create a new project and return undefined
*/
export async function verifyAndPromptToCreateProject(context: IActionContext, fsPath: string, options?: api.ICreateFunctionOptions): Promise<string | undefined> {
// tslint:disable-next-line: strict-boolean-expressions
options = options || {};
const projectPath: string | undefined = await tryGetFunctionProjectRoot(fsPath);

Просмотреть файл

@ -62,8 +62,7 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
await runPreDeployTask(context, context.effectiveDeployFsPath, siteConfig.scmType);
if (isZipDeploy) {
// tslint:disable-next-line:no-floating-promises
validateGlobSettings(context, context.effectiveDeployFsPath);
void validateGlobSettings(context, context.effectiveDeployFsPath);
}
if (language === ProjectLanguage.CSharp && !node.root.client.isLinux) {

Просмотреть файл

@ -22,7 +22,7 @@ export async function notifyDeployComplete(context: IActionContext, node: SlotTr
const uploadSettings: MessageItem = { title: localize('uploadAppSettings', 'Upload settings') };
// Don't wait
window.showInformationMessage(deployComplete, streamLogs, uploadSettings, viewOutput).then(async result => {
void window.showInformationMessage(deployComplete, streamLogs, uploadSettings, viewOutput).then(async result => {
await callWithTelemetryAndErrorHandling('postDeploy', async (postDeployContext: IActionContext) => {
postDeployContext.telemetry.properties.dialogResult = result && result.title;
if (result === viewOutput) {

Просмотреть файл

@ -45,7 +45,7 @@ async function promptToBuildNativeDeps(context: IActionContext, deployFsPath: st
return await tryRunPreDeployTask(context, deployFsPath, scmType);
} else if (result === DialogResponses.learnMore) {
context.telemetry.properties.preDeployTaskResponse = 'packLearnMore';
await openUrl('https://aka.ms/func-python-publish');
openUrl('https://aka.ms/func-python-publish');
throw new UserCancelledError();
} else {
context.telemetry.properties.preDeployTaskResponse = 'cancel';

Просмотреть файл

@ -26,7 +26,7 @@ export async function verifyAppSettings(context: IActionContext, node: SlotTreeI
updateAppSettings = await verifyWebContentSettings(context, appSettings.properties);
}
} else {
updateAppSettings = await verifyRunFromPackage(context, node.root.client, appSettings.properties);
updateAppSettings = verifyRunFromPackage(context, node.root.client, appSettings.properties);
}
if (updateAppSettings) {
@ -64,7 +64,7 @@ export async function verifyVersionAndLanguage(context: IActionContext, siteName
* Automatically set to 1 on windows plans because it has significant perf improvements
* https://github.com/microsoft/vscode-azurefunctions/issues/1465
*/
async function verifyRunFromPackage(context: IActionContext, client: SiteClient, remoteProperties: { [propertyName: string]: string }): Promise<boolean> {
function verifyRunFromPackage(context: IActionContext, client: SiteClient, remoteProperties: { [propertyName: string]: string }): boolean {
const shouldAddSetting: boolean = !remoteProperties[runFromPackageKey];
if (shouldAddSetting) {
remoteProperties[runFromPackageKey] = '1';

Просмотреть файл

@ -76,5 +76,5 @@ export async function executeFunction(context: IActionContext, node?: FunctionTr
});
const message: string = responseText ? localize('executedWithResponse', 'Executed function "{0}". Response: "{1}"', node.name, responseText) : localize('executed', 'Executed function "{0}"', node.name);
window.showInformationMessage(message);
void window.showInformationMessage(message);
}

Просмотреть файл

@ -65,7 +65,6 @@ export class DotnetInitVSCodeStep extends InitVSCodeStepBase {
const versionInProjFile: string | undefined = await dotnetUtils.tryGetFuncVersion(projFilePath);
context.telemetry.properties.versionInProjFile = versionInProjFile;
// The version from the proj file takes precedence over whatever was set in `context` before this
// tslint:disable-next-line: strict-boolean-expressions
context.version = tryParseFuncVersion(versionInProjFile) || context.version;
if (context.version === FuncVersion.v1) {
@ -75,7 +74,7 @@ export class DotnetInitVSCodeStep extends InitVSCodeStepBase {
try {
const result: MessageItem = await context.ui.showWarningMessage(message, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
if (result === DialogResponses.learnMore) {
await openUrl('https://aka.ms/azFunc64bit');
openUrl('https://aka.ms/azFunc64bit');
} else if (result === DialogResponses.dontWarnAgain) {
await updateGlobalSetting(settingKey, false);
}

Просмотреть файл

@ -77,14 +77,14 @@ export abstract class InitVSCodeStepBase extends AzureWizardExecuteStep<IProject
private async writeTasksJson(context: IProjectWizardContext, vscodePath: string, language: ProjectLanguage): Promise<void> {
const newTasks: TaskDefinition[] = this.getTasks(language);
for (const task of newTasks) {
// tslint:disable-next-line: strict-boolean-expressions no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
let cwd: string = (task.options && task.options.cwd) || '.';
cwd = this.addSubDir(context, cwd);
if (!isPathEqual(cwd, '.')) {
// tslint:disable-next-line: strict-boolean-expressions
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
task.options = task.options || {};
// always use posix for debug config
// tslint:disable-next-line: no-unsafe-any no-invalid-template-strings
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
task.options.cwd = path.posix.join('${workspaceFolder}', cwd);
}
}
@ -98,11 +98,11 @@ export abstract class InitVSCodeStepBase extends AzureWizardExecuteStep<IProject
if (context.workspaceFolder && !isMultiRootWorkspace()) {
const currentVersion: string | undefined = getTasksVersion(context.workspaceFolder);
if (!currentVersion) {
updateTasksVersion(context.workspaceFolder, tasksVersion);
await updateTasksVersion(context.workspaceFolder, tasksVersion);
} else if (currentVersion !== tasksVersion) {
throw versionMismatchError;
}
updateTasks(context.workspaceFolder, this.insertNewTasks(getTasks(context.workspaceFolder), newTasks));
await updateTasks(context.workspaceFolder, this.insertNewTasks(getTasks(context.workspaceFolder), newTasks));
} else { // otherwise manually edit json
const tasksJsonPath: string = path.join(vscodePath, tasksFileName);
await confirmEditJsonFile(
@ -121,7 +121,6 @@ export abstract class InitVSCodeStepBase extends AzureWizardExecuteStep<IProject
}
private insertNewTasks(existingTasks: ITask[] | undefined, newTasks: ITask[]): ITask[] {
// tslint:disable-next-line: strict-boolean-expressions
existingTasks = existingTasks || [];
// Remove tasks that match the ones we're about to add
existingTasks = existingTasks.filter(t1 => !newTasks.find(t2 => {
@ -157,11 +156,11 @@ export abstract class InitVSCodeStepBase extends AzureWizardExecuteStep<IProject
if (folder && !isMultiRootWorkspace()) {
const currentVersion: string | undefined = getLaunchVersion(folder);
if (!currentVersion) {
updateLaunchVersion(folder, launchVersion);
await updateLaunchVersion(folder, launchVersion);
} else if (currentVersion !== launchVersion) {
throw versionMismatchError;
}
updateDebugConfigs(folder, this.insertLaunchConfig(getDebugConfigs(folder), newDebugConfig));
await updateDebugConfigs(folder, this.insertLaunchConfig(getDebugConfigs(folder), newDebugConfig));
} else { // otherwise manually edit json
const launchJsonPath: string = path.join(vscodePath, launchFileName);
await confirmEditJsonFile(
@ -181,9 +180,7 @@ export abstract class InitVSCodeStepBase extends AzureWizardExecuteStep<IProject
}
private insertLaunchConfig(existingConfigs: DebugConfiguration[] | undefined, newConfig: DebugConfiguration): DebugConfiguration[] {
// tslint:disable-next-line: strict-boolean-expressions
existingConfigs = existingConfigs || [];
// Remove configs that match the one we're about to add
existingConfigs = existingConfigs.filter(l1 => !isDebugConfigEqual(l1, newConfig));
existingConfigs.push(newConfig);
return existingConfigs;

Просмотреть файл

@ -27,7 +27,7 @@ export class JavaInitVSCodeStep extends InitVSCodeStepBase {
const functionAppName: string | undefined = await mavenUtils.getFunctionAppNameInPom(pomFilePath);
if (!functionAppName) {
this._debugSubpath = '<function_build_path>';
window.showWarningMessage(localize('functionAppNameNotFound', 'Cannot parse the Azure Functions name from pom file, you may need to specify it in the tasks.json.'));
void window.showWarningMessage(localize('functionAppNameNotFound', 'Cannot parse the Azure Functions name from pom file, you may need to specify it in the tasks.json.'));
} else {
this._debugSubpath = getJavaDebugSubpath(functionAppName);
}

Просмотреть файл

@ -42,9 +42,7 @@ export async function initProjectForVSCode(context: IActionContext, fsPath?: str
return;
}
// tslint:disable-next-line: strict-boolean-expressions
language = language || getGlobalSetting(projectLanguageSetting) || await detectProjectLanguage(projectPath);
// tslint:disable-next-line: strict-boolean-expressions
const version: FuncVersion = getGlobalSetting(funcVersionSetting) || await tryGetLocalFuncVersion() || latestGAVersion;
const wizardContext: IProjectWizardContext = Object.assign(context, { projectPath, workspacePath, language, version, workspaceFolder });
@ -53,5 +51,5 @@ export async function initProjectForVSCode(context: IActionContext, fsPath?: str
await wizard.execute();
// don't wait
window.showInformationMessage(localize('finishedInitializing', 'Finished initializing for use with VS Code.'));
void window.showInformationMessage(localize('finishedInitializing', 'Finished initializing for use with VS Code.'));
}

Просмотреть файл

@ -7,12 +7,9 @@ import { WebSiteManagementModels } from '@azure/arm-appservice';
import { SiteClient } from 'vscode-azureappservice';
export async function enableFileLogging(client: SiteClient, logsConfig?: WebSiteManagementModels.SiteLogsConfig): Promise<void> {
// tslint:disable-next-line: strict-boolean-expressions
logsConfig = logsConfig || await client.getLogsConfig();
// tslint:disable-next-line:strict-boolean-expressions
logsConfig.applicationLogs = logsConfig.applicationLogs || {};
// tslint:disable-next-line:strict-boolean-expressions
logsConfig.applicationLogs.fileSystem = logsConfig.applicationLogs.fileSystem || {};
logsConfig.applicationLogs.fileSystem.level = 'Information';
// Azure will throw errors if these have incomplete information (aka missing a sasUrl). Since we already know these are turned off, just make them undefined

Просмотреть файл

@ -73,7 +73,7 @@ async function openLiveMetricsStream(treeItem: SlotTreeItemBase | RemoteFunction
// Not using `openInPortal` because this url is so unconventional
const url: string = `${treeItem.root.environment.portalUrl}/#blade/AppInsightsExtension/QuickPulseBladeV2/ComponentId/${componentId}/ResourceId/${resourceId}`;
await openUrl(url);
openUrl(url);
}
}
}

Просмотреть файл

@ -25,7 +25,7 @@ export async function pickFuncProcess(context: IActionContext, debugConfig: vsco
await waitForPrevFuncTaskToStop(result.workspace);
// tslint:disable-next-line: no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const preLaunchTaskName: string | undefined = debugConfig.preLaunchTask;
const tasks: vscode.Task[] = await vscode.tasks.fetchTasks();
const funcTask: vscode.Task | undefined = tasks.find(t => {
@ -41,7 +41,7 @@ export async function pickFuncProcess(context: IActionContext, debugConfig: vsco
}
async function waitForPrevFuncTaskToStop(workspaceFolder: vscode.WorkspaceFolder): Promise<void> {
await stopFuncTaskIfRunning(workspaceFolder);
stopFuncTaskIfRunning(workspaceFolder);
const timeoutInSeconds: number = 30;
const maxTime: number = Date.now() + timeoutInSeconds * 1000;
@ -92,7 +92,7 @@ async function startFuncTask(context: IActionContext, workspaceFolder: vscode.Wo
try {
// wait for status url to indicate functions host is running
const response: HttpOperationResponse = await client.sendRequest(statusRequest);
// tslint:disable-next-line: no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
if (response.parsedBody.state.toLowerCase() === 'running') {
return taskInfo.processId.toString();
}
@ -136,7 +136,6 @@ type OSAgnosticProcess = { command: string | undefined; pid: number | string };
*/
async function pickChildProcess(rootPid: string): Promise<string> {
const children: OSAgnosticProcess[] = process.platform === 'win32' ? await getWindowsChildren(rootPid) : await getUnixChildren(rootPid);
// tslint:disable-next-line: strict-boolean-expressions
const child: OSAgnosticProcess | undefined = children.reverse().find(c => /(dotnet|func)(\.exe|)$/i.test(c.command || ''));
return child ? child.pid.toString() : rootPid;
}

Просмотреть файл

@ -142,9 +142,11 @@ export class DebugProxy extends EventEmitter {
if (this._keepAlive) {
try {
await pingFunctionApp(this._client);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
setTimeout(this.keepAlive, 60 * 1000 /* 60 seconds */);
} catch (err) {
ext.outputChannel.appendLog(`[Proxy Server] ${err}`);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
setTimeout(this.keepAlive, 5 * 1000 /* 5 seconds */);
}
}

Просмотреть файл

@ -33,8 +33,8 @@ export async function remoteDebugJavaFunctionApp(context: IActionContext, node?:
});
await vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, async (p: vscode.Progress<{}>) => {
// tslint:disable-next-line:no-any
return new Promise(async (resolve: () => void, reject: (e: any) => void): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/no-explicit-any, no-async-promise-executor
return new Promise(async (resolve: (value: unknown) => void, reject: (e: any) => void): Promise<void> => {
try {
const siteConfig: WebSiteManagementModels.SiteConfigResource = await client.getSiteConfig();
const appSettings: WebSiteManagementModels.StringDictionary = await client.listApplicationSettings();
@ -42,7 +42,7 @@ export async function remoteDebugJavaFunctionApp(context: IActionContext, node?:
const confirmMsg: string = localize('confirmRemoteDebug', 'The configurations of the selected app will be changed before debugging. Would you like to continue?');
const result: vscode.MessageItem = await context.ui.showWarningMessage(confirmMsg, { modal: true }, DialogResponses.yes, DialogResponses.learnMore, DialogResponses.cancel);
if (result === DialogResponses.learnMore) {
await openUrl('https://aka.ms/azfunc-remotedebug');
openUrl('https://aka.ms/azfunc-remotedebug');
return;
} else {
await updateSiteConfig(client, p, siteConfig);
@ -52,8 +52,7 @@ export async function remoteDebugJavaFunctionApp(context: IActionContext, node?:
p.report({ message: 'starting debug proxy...' });
ext.outputChannel.appendLog('starting debug proxy...');
// tslint:disable-next-line:no-floating-promises
debugProxy.startProxy();
void debugProxy.startProxy();
debugProxy.on('start', resolve);
} catch (error) {
reject(error);
@ -115,6 +114,5 @@ function needUpdateSiteConfig(siteConfig: WebSiteManagementModels.SiteConfigReso
}
function needUpdateAppSettings(properties: {}): boolean | undefined {
// tslint:disable-next-line:no-string-literal
return properties['JAVA_OPTS'] !== JAVA_OPTS || properties['HTTP_PLATFORM_DEBUG_PORT'] !== HTTP_PLATFORM_DEBUG_PORT;
}

Просмотреть файл

@ -35,6 +35,6 @@ async function updateDisabledState(context: IActionContext, node: FunctionTreeIt
const message: string = isDisabled ? localize('disabledFunction', 'Disabled function "{0}".', node.name) : localize('enabledFunction', 'Enabled function "{0}".', node.name);
// don't wait
window.showInformationMessage(message);
void window.showInformationMessage(message);
ext.outputChannel.appendLog(message, { resourceName: node.parent.parent.label });
}

Просмотреть файл

@ -14,7 +14,7 @@ export abstract class FuncDebugProviderBase implements DebugConfigurationProvide
protected abstract defaultPortOrPipeName: number | string;
protected abstract debugConfig: DebugConfiguration;
private readonly _debugPorts: Map<WorkspaceFolder | undefined, number | undefined> = new Map();
private readonly _debugPorts: Map<WorkspaceFolder | undefined, number | undefined> = new Map<WorkspaceFolder | undefined, number | undefined>();
public abstract getWorkerArgValue(folder: WorkspaceFolder): Promise<string>;
@ -34,7 +34,6 @@ export abstract class FuncDebugProviderBase implements DebugConfigurationProvide
return result;
});
// tslint:disable-next-line: strict-boolean-expressions
return configs || [];
}
@ -64,7 +63,6 @@ export abstract class FuncDebugProviderBase implements DebugConfigurationProvide
}
protected getDebugPortOrPipeName(folder: WorkspaceFolder): number | string {
// tslint:disable-next-line:strict-boolean-expressions
return this._debugPorts.get(folder) || this.defaultPortOrPipeName;
}
}

Просмотреть файл

@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import * as process from 'process';
import { isNullOrUndefined } from 'util';
import { CancellationToken, ShellExecution, ShellExecutionOptions, Task, TaskDefinition, TaskProvider, TaskScope, workspace, WorkspaceFolder } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui';
import { tryGetFunctionProjectRoot } from '../commands/createNewProject/verifyIsProject';
@ -70,7 +69,7 @@ export class FuncTaskProvider implements TaskProvider {
}
}
if (!isNullOrUndefined(lastError)) {
if (!(lastError === null || lastError === undefined)) {
// throw the last error just for the sake of telemetry
// (This won't block providing tasks since it's inside callWithTelemetryAndErrorHandling)
throw lastError;
@ -87,7 +86,7 @@ export class FuncTaskProvider implements TaskProvider {
context.errorHandling.suppressDisplay = true;
context.telemetry.suppressIfSuccessful = true;
// tslint:disable-next-line: no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const command: string | undefined = task.definition.command;
if (command && task.scope !== undefined && task.scope !== TaskScope.Global && task.scope !== TaskScope.Workspace) {
const folder: WorkspaceFolder = task.scope;
@ -112,13 +111,11 @@ export class FuncTaskProvider implements TaskProvider {
options = await this.getHostStartOptions(folder, language);
}
// tslint:disable-next-line: strict-boolean-expressions
options = options || {};
if (projectRoot) {
options.cwd = projectRoot;
}
// tslint:disable-next-line: strict-boolean-expressions
definition = definition || { type: func, command };
return new Task(definition, folder, command, func, new ShellExecution(commandLine, options), problemMatcher);
}

Просмотреть файл

@ -24,6 +24,7 @@ export class JavaDebugProvider extends FuncDebugProviderBase {
protected readonly defaultPortOrPipeName: number = defaultJavaDebugPort;
protected readonly debugConfig: DebugConfiguration = javaDebugConfig;
// eslint-disable-next-line @typescript-eslint/require-await
public async getWorkerArgValue(folder: WorkspaceFolder): Promise<string> {
const port: string | number = this.getDebugPortOrPipeName(folder);
return `-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${port}`;

Просмотреть файл

@ -23,6 +23,7 @@ export class NodeDebugProvider extends FuncDebugProviderBase {
protected readonly defaultPortOrPipeName: number = defaultNodeDebugPort;
protected readonly debugConfig: DebugConfiguration = nodeDebugConfig;
// eslint-disable-next-line @typescript-eslint/require-await
public async getWorkerArgValue(folder: WorkspaceFolder): Promise<string> {
const port: string | number = this.getDebugPortOrPipeName(folder);
return `--inspect=${port}`;

Просмотреть файл

@ -24,6 +24,7 @@ export class PowerShellDebugProvider extends FuncDebugProviderBase {
protected defaultPortOrPipeName: string | number = defaultCustomPipeName;
protected readonly debugConfig: DebugConfiguration = powershellDebugConfig;
// eslint-disable-next-line @typescript-eslint/require-await
public async getWorkerArgValue(folder: WorkspaceFolder): Promise<string> {
const port: string | number = this.getDebugPortOrPipeName(folder);
return String(port);

Просмотреть файл

@ -37,7 +37,6 @@ async function getPythonCommand(host: string, port: number): Promise<string> {
await pyExtension.activate();
}
// tslint:disable-next-line:strict-boolean-expressions
if (pyExtension.exports && pyExtension.exports.debug) {
return (await pyExtension.exports.debug.getRemoteLauncherCommand(host, port, false)).join(' ');
} else {

Просмотреть файл

@ -142,7 +142,6 @@ async function validateEmulatorIsRunning(projectPath: string): Promise<boolean>
await new Promise((resolve, reject): void => {
// Checking against a common container for functions, but doesn't really matter what call we make here
client.doesContainerExist('azure-webjob-hosts', (err: Error | undefined) => {
// tslint:disable-next-line: no-void-expression
err ? reject(err) : resolve();
});
});

Просмотреть файл

@ -5,8 +5,6 @@
import { localize } from './localize';
// tslint:disable:max-classes-per-file export-name
export class NoWorkspaceError extends Error {
public message: string = localize('noWorkspaceError', 'You must have a workspace open to perform this operation.');
}

Просмотреть файл

@ -9,7 +9,6 @@ import { WebSiteManagementMappers } from '@azure/arm-appservice';
import * as vscode from 'vscode';
import { registerAppServiceExtensionVariables } from 'vscode-azureappservice';
import { AzExtTreeDataProvider, AzureUserInput, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, IActionContext, registerErrorHandler, registerEvent, registerReportIssueCommand, registerUIExtensionVariables } from 'vscode-azureextensionui';
// tslint:disable-next-line:no-submodule-imports
import { AzureExtensionApiProvider } from 'vscode-azureextensionui/api';
import { createFunctionFromApi } from './commands/api/createFunctionFromApi';
import { downloadAppSettingsFromApi } from './commands/api/downloadAppSettingsFromApi';
@ -41,14 +40,13 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta
registerUIExtensionVariables(ext);
registerAppServiceExtensionVariables(ext);
await callWithTelemetryAndErrorHandling('azureFunctions.activate', async (activateContext: IActionContext) => {
await callWithTelemetryAndErrorHandling('azureFunctions.activate', (activateContext: IActionContext) => {
activateContext.telemetry.properties.isActivationEvent = 'true';
activateContext.telemetry.measurements.mainFileLoad = (perfStats.loadEndTime - perfStats.loadStartTime) / 1000;
runPostFunctionCreateStepsFromCache();
void runPostFunctionCreateStepsFromCache();
// tslint:disable-next-line:no-floating-promises
validateFuncCoreToolsIsLatest();
void validateFuncCoreToolsIsLatest();
ext.azureAccountTreeItem = new AzureAccountTreeItemWithProjects();
context.subscriptions.push(ext.azureAccountTreeItem);
@ -57,8 +55,7 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta
context.subscriptions.push(ext.treeView);
const validateEventId: string = 'azureFunctions.validateFunctionProjects';
// tslint:disable-next-line:no-floating-promises
callWithTelemetryAndErrorHandling(validateEventId, async (actionContext: IActionContext) => {
void callWithTelemetryAndErrorHandling(validateEventId, async (actionContext: IActionContext) => {
await verifyVSCodeConfigOnActivate(actionContext, vscode.workspace.workspaceFolders);
});
registerEvent(validateEventId, vscode.workspace.onDidChangeWorkspaceFolders, async (actionContext: IActionContext, event: vscode.WorkspaceFoldersChangeEvent) => {
@ -89,9 +86,9 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta
// Temporary workaround so that "powerShellVersion" is an allowed property on SiteConfig
// https://github.com/Azure/azure-sdk-for-js/issues/10552
// tslint:disable-next-line: no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
WebSiteManagementMappers.SiteConfig.type.modelProperties!.powerShellVersion = { serializedName: 'powerShellVersion', type: { name: 'String' } };
// tslint:disable-next-line: no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
WebSiteManagementMappers.SiteConfigResource.type.modelProperties!.powerShellVersion = { serializedName: 'properties.powerShellVersion', type: { name: 'String' } };
});
@ -104,6 +101,6 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta
}]);
}
// tslint:disable-next-line:no-empty
// eslint-disable-next-line @typescript-eslint/no-empty-function
export function deactivateInternal(): void {
}

Просмотреть файл

@ -20,6 +20,7 @@ export namespace ext {
export let outputChannel: IAzExtOutputChannel;
export let ui: IAzureUserInput;
export let templateProvider: CentralTemplateProvider;
// eslint-disable-next-line prefer-const
export let funcCliPath: string = func;
export let ignoreBundle: boolean | undefined;
export const prefix: string = 'azureFunctions';

Просмотреть файл

@ -12,7 +12,6 @@ export interface IFunctionJson {
}
export interface IFunctionBinding {
// tslint:disable-next-line:no-reserved-keywords
type?: string;
name?: string;
route?: string;
@ -34,9 +33,9 @@ export enum HttpAuthLevel {
export class ParsedFunctionJson {
public readonly data: IFunctionJson;
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
public constructor(data: any) {
// tslint:disable-next-line:no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (typeof data === 'object' && data !== null && (data.bindings === undefined || data.bindings instanceof Array)) {
this.data = <IFunctionJson>data;
} else {
@ -45,7 +44,6 @@ export class ParsedFunctionJson {
}
public get bindings(): IFunctionBinding[] {
// tslint:disable-next-line: strict-boolean-expressions
return this.data.bindings || [];
}
@ -58,7 +56,6 @@ export class ParsedFunctionJson {
* https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings
*/
public get triggerBinding(): IFunctionBinding | undefined {
// tslint:disable-next-line: strict-boolean-expressions
return this.bindings.find(b => /trigger$/i.test(b.type || ''));
}

Просмотреть файл

@ -52,7 +52,6 @@ export async function setLocalAppSetting(functionAppPath: string, key: string, v
const localSettingsPath: string = path.join(functionAppPath, localSettingsFileName);
const settings: ILocalSettingsJson = await getLocalSettingsJson(localSettingsPath);
// tslint:disable-next-line:strict-boolean-expressions
settings.Values = settings.Values || {};
if (settings.Values[key] === value) {
return;

Просмотреть файл

@ -11,16 +11,15 @@ export interface IRunningFuncTask {
processId: number;
}
export const runningFuncTaskMap: Map<vscode.WorkspaceFolder | vscode.TaskScope, IRunningFuncTask> = new Map();
export const runningFuncTaskMap: Map<vscode.WorkspaceFolder | vscode.TaskScope, IRunningFuncTask> = new Map<vscode.WorkspaceFolder | vscode.TaskScope, IRunningFuncTask>();
export function isFuncHostTask(task: vscode.Task): boolean {
const commandLine: string | undefined = task.execution && (<vscode.ShellExecution>task.execution).commandLine;
// tslint:disable-next-line: strict-boolean-expressions
return /func (host )?start/i.test(commandLine || '');
}
export function registerFuncHostTaskEvents(): void {
registerEvent('azureFunctions.onDidStartTask', vscode.tasks.onDidStartTaskProcess, async (context: IActionContext, e: vscode.TaskProcessStartEvent) => {
registerEvent('azureFunctions.onDidStartTask', vscode.tasks.onDidStartTaskProcess, (context: IActionContext, e: vscode.TaskProcessStartEvent) => {
context.errorHandling.suppressDisplay = true;
context.telemetry.suppressIfSuccessful = true;
if (e.execution.task.scope !== undefined && isFuncHostTask(e.execution.task)) {
@ -28,7 +27,7 @@ export function registerFuncHostTaskEvents(): void {
}
});
registerEvent('azureFunctions.onDidEndTask', vscode.tasks.onDidEndTaskProcess, async (context: IActionContext, e: vscode.TaskProcessEndEvent) => {
registerEvent('azureFunctions.onDidEndTask', vscode.tasks.onDidEndTaskProcess, (context: IActionContext, e: vscode.TaskProcessEndEvent) => {
context.errorHandling.suppressDisplay = true;
context.telemetry.suppressIfSuccessful = true;
if (e.execution.task.scope !== undefined && isFuncHostTask(e.execution.task)) {
@ -36,17 +35,17 @@ export function registerFuncHostTaskEvents(): void {
}
});
registerEvent('azureFunctions.onDidTerminateDebugSession', vscode.debug.onDidTerminateDebugSession, async (context: IActionContext, debugSession: vscode.DebugSession) => {
registerEvent('azureFunctions.onDidTerminateDebugSession', vscode.debug.onDidTerminateDebugSession, (context: IActionContext, debugSession: vscode.DebugSession) => {
context.errorHandling.suppressDisplay = true;
context.telemetry.suppressIfSuccessful = true;
if (getWorkspaceSetting<boolean>('stopFuncTaskPostDebug') && debugSession.workspaceFolder) {
await stopFuncTaskIfRunning(debugSession.workspaceFolder);
stopFuncTaskIfRunning(debugSession.workspaceFolder);
}
});
}
export async function stopFuncTaskIfRunning(workspaceFolder: vscode.WorkspaceFolder): Promise<void> {
export function stopFuncTaskIfRunning(workspaceFolder: vscode.WorkspaceFolder): void {
const runningFuncTask: IRunningFuncTask | undefined = runningFuncTaskMap.get(workspaceFolder);
if (runningFuncTask !== undefined) {
// Use `process.kill` because `TaskExecution.terminate` closes the terminal pane and erases all output

Просмотреть файл

@ -24,7 +24,6 @@ export async function getLocalFuncCoreToolsVersion(): Promise<string | null> {
}
return semver.valid(localVersion);
}
// tslint:disable-next-line: no-null-keyword
return null;
}
}
@ -32,9 +31,7 @@ export async function getLocalFuncCoreToolsVersion(): Promise<string | null> {
export function addLocalFuncTelemetry(context: IActionContext): void {
context.telemetry.properties.funcCliVersion = 'unknown';
// tslint:disable-next-line:no-floating-promises
getLocalFuncCoreToolsVersion().then((version: string) => {
// tslint:disable-next-line:strict-boolean-expressions
context.telemetry.properties.funcCliVersion = version || 'none';
}).catch(() => {
context.telemetry.properties.funcCliVersion = 'none';

Просмотреть файл

@ -12,7 +12,6 @@ import { getBrewPackageName } from './getBrewPackageName';
import { getNpmDistTag, INpmDistTag } from './getNpmDistTag';
export async function installFuncCoreTools(packageManagers: PackageManager[], version?: FuncVersion): Promise<void> {
// tslint:disable-next-line: strict-boolean-expressions
version = version || await promptForFuncVersion(localize('selectVersion', 'Select the version of the runtime to install'));
ext.outputChannel.show();

Просмотреть файл

@ -16,7 +16,6 @@ import { tryGetLocalFuncVersion } from './tryGetLocalFuncVersion';
export async function uninstallFuncCoreTools(context: IActionContext, packageManagers?: PackageManager[]): Promise<void> {
ext.outputChannel.show();
// tslint:disable-next-line: strict-boolean-expressions
packageManagers = packageManagers || await getFuncPackageManagers(true /* isFuncInstalled */);
let packageManager: PackageManager;
if (packageManagers.length === 0) {

Просмотреть файл

@ -47,7 +47,7 @@ export async function validateFuncCoreToolsInstalled(message: string, fsPath: st
await installFuncCoreTools(packageManagers, version);
installed = true;
} else if (input === DialogResponses.learnMore) {
await openUrl('https://aka.ms/Dqur4e');
openUrl('https://aka.ms/Dqur4e');
}
}
});
@ -55,7 +55,7 @@ export async function validateFuncCoreToolsInstalled(message: string, fsPath: st
// validate that Func Tools was installed only if user confirmed
if (input === install && !installed) {
if (await ext.ui.showWarningMessage(localize('failedInstallFuncTools', 'The Azure Functions Core Tools installation has failed and will have to be installed manually.'), DialogResponses.learnMore) === DialogResponses.learnMore) {
await openUrl('https://aka.ms/Dqur4e');
openUrl('https://aka.ms/Dqur4e');
}
}

Просмотреть файл

@ -89,7 +89,7 @@ export async function validateFuncCoreToolsIsLatest(): Promise<void> {
result = packageManager !== undefined ? await context.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain) :
await context.ui.showWarningMessage(message, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
if (result === DialogResponses.learnMore) {
await openUrl('https://aka.ms/azFuncOutdated');
openUrl('https://aka.ms/azFuncOutdated');
} else if (result === update) {
await updateFuncCoreTools(packageManager, versionFromSetting);
} else if (result === DialogResponses.dontWarnAgain) {

Просмотреть файл

@ -186,7 +186,6 @@ export class CentralTemplateProvider {
}
private async getLatestTemplates(context: IActionContext, provider: TemplateProviderBase, latestTemplateVersion: string): Promise<ITemplates | undefined> {
// tslint:disable-next-line:strict-boolean-expressions
if (!this.templateSource || this.templateSource === TemplateSource.Latest || this.templateSource === TemplateSource.Staging) {
context.telemetry.properties.templateSource = 'latest';
const result: ITemplates = await provider.getLatestTemplates(context, latestTemplateVersion);
@ -199,7 +198,6 @@ export class CentralTemplateProvider {
}
private async tryGetCachedTemplates(context: IActionContext, provider: TemplateProviderBase): Promise<ITemplates | undefined> {
// tslint:disable-next-line:strict-boolean-expressions
if (!this.templateSource) {
try {
context.telemetry.properties.templateSource = 'cache';
@ -215,7 +213,6 @@ export class CentralTemplateProvider {
}
private async tryGetBackupTemplates(context: IActionContext, provider: TemplateProviderBase): Promise<ITemplates | undefined> {
// tslint:disable-next-line:strict-boolean-expressions
if (!this.templateSource || this.templateSource === TemplateSource.Backup) {
try {
context.telemetry.properties.templateSource = 'backup';

Просмотреть файл

@ -7,7 +7,6 @@
* Describes a template used for creating a binding
*/
export interface IBindingTemplate {
// tslint:disable-next-line: no-reserved-keywords
type: string;
direction: string;
displayName: string;

Просмотреть файл

@ -35,11 +35,11 @@ export abstract class TemplateProviderBase {
}
public async updateCachedValue(key: string, value: unknown): Promise<void> {
ext.context.globalState.update(await this.getCacheKey(key), value);
await ext.context.globalState.update(await this.getCacheKey(key), value);
}
public async deleteCachedValue(key: string): Promise<void> {
ext.context.globalState.update(await this.getCacheKey(key), undefined);
await ext.context.globalState.update(await this.getCacheKey(key), undefined);
}
public async getCachedValue<T>(key: string): Promise<T | undefined> {
@ -66,11 +66,11 @@ export abstract class TemplateProviderBase {
}
public async getBackupTemplateVersion(): Promise<string> {
return (await fse.readFile(this.getBackupVersionPath())).toString().trim();
return (await fse.readFile(await this.getBackupVersionPath())).toString().trim();
}
public async updateBackupTemplateVersion(version: string): Promise<void> {
const filePath: string = this.getBackupVersionPath();
const filePath: string = await this.getBackupVersionPath();
await fse.ensureFile(filePath);
await fse.writeFile(filePath, version);
}
@ -79,11 +79,13 @@ export abstract class TemplateProviderBase {
return ext.context.asAbsolutePath(path.join('resources', 'backupTemplates', this.backupSubpath));
}
protected async getCacheKeySuffix(): Promise<string> {
// eslint-disable-next-line @typescript-eslint/require-await
protected async getCacheKeySuffix(): Promise<string>{
return '';
}
private getBackupVersionPath(): string {
// eslint-disable-next-line @typescript-eslint/require-await
private async getBackupVersionPath(): Promise<string> {
return path.join(this.getBackupPath(), 'version.txt');
}

Просмотреть файл

@ -78,6 +78,7 @@ export class DotnetTemplateProvider extends TemplateProviderBase {
}
}
// eslint-disable-next-line @typescript-eslint/require-await
public async cacheTemplates(): Promise<void> {
await this.updateCachedValue(this._dotnetTemplatesKey, this._rawTemplates);
}

Просмотреть файл

@ -28,7 +28,6 @@ export async function executeDotnetTemplateCommand(context: IActionContext, vers
}
export function getDotnetTemplatesPath(): string {
// tslint:disable-next-line:strict-boolean-expressions
return path.join(ext.context.globalStoragePath, 'dotnetTemplates', ext.templateProvider.templateSource || '');
}

Просмотреть файл

@ -67,6 +67,7 @@ export class JavaTemplateProvider extends ScriptTemplateProvider {
return true;
}
// eslint-disable-next-line @typescript-eslint/require-await
protected async getCacheKeySuffix(): Promise<string> {
return 'Java';
}

Просмотреть файл

@ -58,10 +58,9 @@ export class ScriptTemplateProvider extends TemplateProviderBase {
const filePath: string = path.join(templatesPath, `${getRandomHexString()}.zip`);
await requestUtils.downloadFile(templateRelease.templateApiZip, filePath);
await new Promise(async (resolve: () => void, reject: (e: Error) => void): Promise<void> => {
// tslint:disable-next-line:no-unsafe-any
await new Promise((resolve: (value?: unknown) => void, reject: (e: Error) => void): void => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
extract(filePath, { dir: templatesPath }, (err: Error) => {
// tslint:disable-next-line:strict-boolean-expressions
if (err) {
reject(err);
}
@ -90,12 +89,14 @@ export class ScriptTemplateProvider extends TemplateProviderBase {
}
}
// eslint-disable-next-line @typescript-eslint/require-await
public async cacheTemplates(): Promise<void> {
await this.updateCachedValue(this._templatesKey, this._rawTemplates);
await this.updateCachedValue(this._bindingsKey, this._rawBindings);
await this.updateCachedValue(this._resourcesKey, this._rawResources);
}
// eslint-disable-next-line @typescript-eslint/require-await
public async clearCache(): Promise<void> {
await this.deleteCachedValue(this._templatesKey);
await this.deleteCachedValue(this._bindingsKey);

Просмотреть файл

@ -43,7 +43,6 @@ export function getScriptResourcesLanguage(vscodeLang: string = vscode.env.langu
}
if (!supportedLanguage) {
// tslint:disable-next-line: strict-boolean-expressions
locale = locale || '[a-z]*';
const regExp: RegExp = new RegExp(`^${language}(-${locale})?$`, 'i');
supportedLanguage = supportedLanguages.find(f => regExp.test(f));

Просмотреть файл

@ -16,7 +16,6 @@ import { ITemplates } from '../ITemplates';
*/
export interface IRawTemplate {
id?: string;
// tslint:disable-next-line:no-reserved-keywords
function?: {};
metadata?: {
defaultFunctionName: string;
@ -43,7 +42,6 @@ interface IRawSetting {
expression: string;
errorText: string;
}[];
// tslint:disable-next-line:no-reserved-keywords
enum?: {
value: string;
display: string;
@ -51,7 +49,6 @@ interface IRawSetting {
}
interface IRawBinding {
// tslint:disable-next-line:no-reserved-keywords
type?: string;
documentation: string;
displayName: string;
@ -81,7 +78,6 @@ export interface IResources {
en: { [key: string]: string | undefined };
}
// tslint:disable-next-line:no-any
function getVariableValue(resources: IResources, variables: IVariables, data: string): string {
if (!isString(data)) {
// This evaluates to a non-string value in rare cases, in which case we just return the value as-is
@ -159,7 +155,6 @@ export function parseScriptBindings(config: IConfig, resources: IResources): IBi
for (const rawBinding of config.bindings) {
try {
if (rawBinding.type) {
// tslint:disable-next-line: strict-boolean-expressions
const settings: IBindingSetting[] = (rawBinding.settings || []).map((setting: object) => parseScriptSetting(setting, resources, config.variables));
result.push({
direction: rawBinding.direction,
@ -231,9 +226,7 @@ export function parseScriptTemplate(rawTemplate: IRawTemplate, resources: IResou
defaultFunctionName: rawTemplate.metadata.defaultFunctionName,
language,
userPromptedSettings,
// tslint:disable-next-line: strict-boolean-expressions
templateFiles: rawTemplate.files || {},
// tslint:disable-next-line: strict-boolean-expressions
categories: rawTemplate.metadata.category || []
};
}

Просмотреть файл

@ -64,7 +64,6 @@ export class AzureAccountTreeItemWithProjects extends AzureAccountTreeItemBase {
Disposable.from(...this._projectDisposables).dispose();
this._projectDisposables = [];
// tslint:disable-next-line: strict-boolean-expressions
const folders: readonly WorkspaceFolder[] = workspace.workspaceFolders || [];
for (const folder of folders) {
const projectPath: string | undefined = await tryGetFunctionProjectRoot(folder.uri.fsPath, true /* suppressPrompt */);

Просмотреть файл

@ -88,7 +88,6 @@ export abstract class FunctionTreeItemBase extends AzExtTreeItem {
private async refreshTriggerUrl(): Promise<void> {
const triggerUrl: url.URL = new url.URL(this.parent.parent.hostUrl);
// tslint:disable-next-line: strict-boolean-expressions
const route: string = (this.config.triggerBinding && this.config.triggerBinding.route) || this.name;
const hostJson: IParsedHostJson = await this.parent.parent.getHostJson();
triggerUrl.pathname = `${hostJson.routePrefix}/${route}`;
@ -118,7 +117,6 @@ export abstract class FunctionTreeItemBase extends AzExtTreeItem {
* The following resulted in an enabled function:
* false, fAlse, 0, fdsaf, 2, undefined
*/
// tslint:disable-next-line:strict-boolean-expressions
this._disabled = /^(1|true)$/i.test(appSettings[this.disabledStateKey] || '');
}
}

Просмотреть файл

@ -18,7 +18,7 @@ export class SlotTreeItem extends SlotTreeItemBase {
}
public get label(): string {
// tslint:disable-next-line:no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return this.root.client.slotName!;
}
}

Просмотреть файл

@ -105,7 +105,6 @@ export abstract class SlotTreeItemBase extends AzureParentTreeItem<ISiteTreeRoot
} catch {
// ignore and use default
}
// tslint:disable-next-line: strict-boolean-expressions
result = version || latestGAVersion;
this._cachedVersion = result;
}
@ -116,9 +115,10 @@ export abstract class SlotTreeItemBase extends AzureParentTreeItem<ISiteTreeRoot
public async getHostJson(): Promise<IParsedHostJson> {
let result: IParsedHostJson | undefined = this._cachedHostJson;
if (!result) {
// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let data: any;
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
data = JSON.parse((await getFile(this.client, 'site/wwwroot/host.json')).data);
} catch {
// ignore and use default
@ -133,7 +133,6 @@ export abstract class SlotTreeItemBase extends AzureParentTreeItem<ISiteTreeRoot
public async getApplicationSettings(): Promise<ApplicationSettings> {
const appSettings: WebSiteManagementModels.StringDictionary = await this.root.client.listApplicationSettings();
// tslint:disable-next-line: strict-boolean-expressions
return appSettings.properties || {};
}
@ -177,6 +176,7 @@ export abstract class SlotTreeItemBase extends AzureParentTreeItem<ISiteTreeRoot
return [this._functionsTreeItem, this.appSettingsTreeItem, this._siteFilesTreeItem, this._logFilesTreeItem, this.deploymentsNode, this._proxiesTreeItem];
}
// eslint-disable-next-line @typescript-eslint/require-await
public async pickTreeItemImpl(expectedContextValues: (string | RegExp)[]): Promise<AzExtTreeItem | undefined> {
for (const expectedContextValue of expectedContextValues) {
switch (expectedContextValue) {

Просмотреть файл

@ -53,7 +53,7 @@ export class SlotsTreeItem extends AzureParentTreeItem<ISiteTreeRoot> {
return await this.createTreeItemsWithErrorHandling(
webAppCollection,
'azFuncInvalidSlot',
async (site: WebSiteManagementModels.Site) => {
(site: WebSiteManagementModels.Site) => {
const siteClient: SiteClient = new SiteClient(site, this.root);
return new SlotTreeItem(this, siteClient, site);
},

Просмотреть файл

@ -61,7 +61,7 @@ export class SubscriptionTreeItem extends SubscriptionTreeItemBase {
return await this.createTreeItemsWithErrorHandling(
webAppCollection,
'azFuncInvalidFunctionApp',
async (site: WebSiteManagementModels.Site) => {
(site: WebSiteManagementModels.Site) => {
const siteClient: SiteClient = new SiteClient(site, this.root);
if (siteClient.isFunctionApp) {
return new ProductionSlotTreeItem(this, siteClient, site);

Просмотреть файл

@ -22,6 +22,7 @@ export class InitLocalProjectTreeItem extends LocalProjectTreeItemBase {
return false;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async loadMoreChildrenImpl(_clearCache: boolean): Promise<AzExtTreeItem[]> {
const ti: GenericTreeItem = new GenericTreeItem(this, {
contextValue: 'initProject',

Просмотреть файл

@ -20,6 +20,7 @@ export class InvalidLocalProjectTreeItem extends LocalProjectTreeItemBase {
return false;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async loadMoreChildrenImpl(_clearCache: boolean): Promise<AzExtTreeItem[]> {
throw this._projectError;
}

Просмотреть файл

@ -23,6 +23,7 @@ export class LocalFunctionTreeItem extends FunctionTreeItemBase {
return ti;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async getKey(): Promise<string | undefined> {
return undefined;
}

Просмотреть файл

@ -58,6 +58,7 @@ export class LocalProjectTreeItem extends LocalProjectTreeItemBase implements Di
return false;
}
// eslint-disable-next-line @typescript-eslint/require-await
public async loadMoreChildrenImpl(_clearCache: boolean): Promise<AzExtTreeItem[]> {
return [this._localFunctionsTreeItem];
}
@ -78,18 +79,18 @@ export class LocalProjectTreeItem extends LocalProjectTreeItemBase implements Di
public async getHostJson(): Promise<IParsedHostJson> {
const version: FuncVersion = await this.getVersion();
// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
const data: any = await fse.readJSON(path.join(this.effectiveProjectPath, hostFileName));
return parseHostJson(data, version);
}
// eslint-disable-next-line @typescript-eslint/require-await
public async getVersion(): Promise<FuncVersion> {
return this.version;
}
public async getApplicationSettings(): Promise<ApplicationSettings> {
const localSettings: ILocalSettingsJson = await getLocalSettingsJson(path.join(this.effectiveProjectPath, localSettingsFileName));
// tslint:disable-next-line: strict-boolean-expressions
return localSettings.Values || {};
}

Просмотреть файл

@ -54,7 +54,7 @@ export class RemoteFunctionTreeItem extends FunctionTreeItemBase {
await window.withProgress({ location: ProgressLocation.Notification, title: deleting }, async (): Promise<void> => {
ext.outputChannel.appendLog(deleting);
await this.client.deleteFunction(this.name);
window.showInformationMessage(deleteSucceeded);
void window.showInformationMessage(deleteSucceeded);
ext.outputChannel.appendLog(deleteSucceeded);
});
}

Просмотреть файл

@ -37,7 +37,6 @@ export namespace bundleFeedUtils {
}
export async function getLatestTemplateVersion(bundleMetadata: IBundleMetadata | undefined): Promise<string> {
// tslint:disable-next-line: strict-boolean-expressions
bundleMetadata = bundleMetadata || {};
const feed: IBundleFeed = await getBundleFeed(bundleMetadata);

Просмотреть файл

@ -5,7 +5,6 @@
export namespace envUtils {
export function isEnvironmentVariableSet(val: string | undefined): boolean {
// tslint:disable-next-line: strict-boolean-expressions
return !/^(false|0)?$/i.test(val || '');
}
}

Просмотреть файл

@ -10,14 +10,14 @@ import * as vscode from 'vscode';
*/
export function getCoreNodeModule<T>(moduleName: string): T | undefined {
try {
// tslint:disable-next-line:non-literal-require no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return require(`${vscode.env.appRoot}/node_modules.asar/${moduleName}`);
} catch (err) {
// ignore
}
try {
// tslint:disable-next-line:non-literal-require no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return require(`${vscode.env.appRoot}/node_modules/${moduleName}`);
} catch (err) {
// ignore

Просмотреть файл

@ -21,9 +21,9 @@ export namespace mavenUtils {
if (!context.errorHandling.suppressDisplay) {
// don't wait
vscode.window.showErrorMessage(message, DialogResponses.learnMore).then(async result => {
void vscode.window.showErrorMessage(message, DialogResponses.learnMore).then(result => {
if (result === DialogResponses.learnMore) {
await openUrl('https://aka.ms/azurefunction_maven');
openUrl('https://aka.ms/azurefunction_maven');
}
});
context.errorHandling.suppressDisplay = true;
@ -36,12 +36,12 @@ export namespace mavenUtils {
export async function getFunctionAppNameInPom(pomLocation: string): Promise<string | undefined> {
const pomString: string = await fse.readFile(pomLocation, 'utf-8');
return await new Promise((resolve: (ret: string | undefined) => void): void => {
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
xml2js.parseString(pomString, { explicitArray: false }, (err: any, result: any): void => {
if (result && !err) {
// tslint:disable-next-line:no-string-literal no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (result['project'] && result['project']['properties']) {
// tslint:disable-next-line:no-string-literal no-unsafe-any
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
resolve(result['project']['properties']['functionAppName']);
return;
}

Просмотреть файл

@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { isNullOrUndefined } from 'util';
/**
* Retrieves a property by name from an object and checks that it's not null and not undefined. It is strongly typed
* for the property and will give a compile error if the given name is not a property of the source.
@ -18,9 +16,8 @@ export function nonNullProp<TSource, TKey extends keyof TSource>(source: TSource
* Validates that a given value is not null and not undefined.
*/
export function nonNullValue<T>(value: T | undefined, propertyNameOrMessage?: string): T {
if (isNullOrUndefined(value)) {
if (value === null || value === undefined) {
throw new Error(
// tslint:disable-next-line:prefer-template
'Internal error: Expected value to be neither null nor undefined'
+ (propertyNameOrMessage ? `: ${propertyNameOrMessage}` : ''));
}
@ -34,7 +31,6 @@ export function nonNullValue<T>(value: T | undefined, propertyNameOrMessage?: st
export function nonNullOrEmptyValue(value: string | undefined, propertyNameOrMessage?: string): string {
if (!value) {
throw new Error(
// tslint:disable-next-line:prefer-template
'Internal error: Expected value to be neither null, undefined, nor empty'
+ (propertyNameOrMessage ? `: ${propertyNameOrMessage}` : ''));
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше