Remove unnecessary awaits from extensions (#19571)

* Remove unnecessary awaits

* fix ignore

* revert eslintignore

* try

* increase size

* Increase sql lint size
This commit is contained in:
Charles Gagnon
2022-05-31 15:36:44 -07:00
committed by GitHub
parent 96f345a74a
commit 6ae380b65d
65 changed files with 179 additions and 100 deletions

View File

@@ -8,17 +8,16 @@
**/semver/** **/semver/**
**/test/**/*.js **/test/**/*.js
**/node_modules/** **/node_modules/**
**/vscode-api-tests/testWorkspace/** /extensions/**/out/**
**/vscode-api-tests/testWorkspace2/** /extensions/**/build/**
**/extensions/**/out/** /extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts
**/extensions/**/build/** /extensions/big-data-cluster/src/bigDataCluster/controller/clusterApiGenerated2.ts
**/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts /extensions/markdown-language-features/media/**
**/big-data-cluster/src/bigDataCluster/controller/clusterApiGenerated2.ts /extensions/markdown-language-features/notebook-out/**
**/extensions/markdown-language-features/media/** /extensions/typescript-basics/test/colorize-fixtures/**
**/extensions/markdown-language-features/notebook-out/** /extensions/**/dist/**
**/extensions/typescript-basics/test/colorize-fixtures/** /extensions/types
**/extensions/**/dist/** /extensions/typescript-language-features/test-workspace/**
**/extensions/typescript-language-features/test-workspace/**
# These files are not linted by `yarn eslint`, so we exclude them from being linted in the editor. # These files are not linted by `yarn eslint`, so we exclude them from being linted in the editor.
# This ensures that if we add new rules and they pass CI, the are also no errors in the editor. # This ensures that if we add new rules and they pass CI, the are also no errors in the editor.

View File

@@ -2,6 +2,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"] "@typescript-eslint/explicit-function-return-type": ["error"],
"@typescript-eslint/await-thenable": ["error"]
} }
} }

View File

@@ -1,4 +1,8 @@
{ {
"parserOptions": {
"project": "./extensions/agent/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -40,7 +40,7 @@ export abstract class AgentDialog<T extends IAgentDialogData> {
let event = dialogName ? dialogName : null; let event = dialogName ? dialogName : null;
this.dialog = azdata.window.createModelViewDialog(this.title, event); this.dialog = azdata.window.createModelViewDialog(this.title, event);
await this.model.initialize(); this.model.initialize();
await this.initializeDialog(this.dialog); await this.initializeDialog(this.dialog);

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/arc/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/azcli/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -72,7 +72,7 @@ describe('AccountProvider.FileDatabase', function (): void {
await fileDatabase.deletePrefix('k'); await fileDatabase.deletePrefix('k');
x = await fileDatabase.get(k1); x = fileDatabase.get(k1);
should(x).be.undefined(); should(x).be.undefined();
}); });

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/azurehybridtoolkit/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/azuremonitor/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -40,7 +40,7 @@ export default class CodeAdapter implements IPrompter {
let answers: Answers<T> = {}; let answers: Answers<T> = {};
questions.forEach(async (question: IQuestion) => { questions.forEach(async (question: IQuestion) => {
this.fixQuestion(question); this.fixQuestion(question);
const prompt = await PromptFactory.createPrompt(question, ignoreFocusOut); const prompt = PromptFactory.createPrompt(question, ignoreFocusOut);
if (!question.shouldPrompt || question.shouldPrompt(answers) === true) { if (!question.shouldPrompt || question.shouldPrompt(answers) === true) {
const result = await prompt.render(); const result = await prompt.render();
answers[question.name] = result; answers[question.name] = result;

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/big-data-cluster/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/cms/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

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

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/dacpac/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -31,7 +31,7 @@ export class DeployConfigPage extends DacFxConfigPage {
this.databaseComponent = await this.createDatabaseTextBox(loc.databaseName); this.databaseComponent = await this.createDatabaseTextBox(loc.databaseName);
this.databaseDropdownComponent = await this.createDeployDatabaseDropdown(); this.databaseDropdownComponent = await this.createDeployDatabaseDropdown();
this.databaseDropdownComponent.title = loc.databaseName; this.databaseDropdownComponent.title = loc.databaseName;
let radioButtons = await this.createRadiobuttons(); let radioButtons = this.createRadiobuttons();
this.formBuilder = this.view.modelBuilder.formContainer() this.formBuilder = this.view.modelBuilder.formContainer()
.withFormItems( .withFormItems(

View File

@@ -116,8 +116,8 @@ export class ProjectDashboard {
height: '20px' height: '20px'
}).component(); }).component();
button.onDidClick(async () => { button.onDidClick(() => {
await projectAction.run(this._treeItem); projectAction.run(this._treeItem);
}); });
return button; return button;

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/import/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -37,12 +37,12 @@ export class ImportTestUtils {
} }
public static async getExtensionPath(): Promise<string> { public static async getExtensionPath(): Promise<string> {
return await vscode.extensions.getExtension('Microsoft.import').extensionPath; return vscode.extensions.getExtension('Microsoft.import').extensionPath;
} }
public static async getTestExtensionContext(): Promise<TestExtensionContext> { public static async getTestExtensionContext(): Promise<TestExtensionContext> {
let testContext = new TestExtensionContext(); let testContext = new TestExtensionContext();
testContext.extensionPath = await vscode.extensions.getExtension('Microsoft.import').extensionPath; testContext.extensionPath = vscode.extensions.getExtension('Microsoft.import').extensionPath;
return testContext; return testContext;
} }
} }

View File

@@ -137,7 +137,7 @@ export class ModifyColumnsPage extends ImportPage {
} }
override async onPageLeave(): Promise<boolean> { override async onPageLeave(): Promise<boolean> {
await this.emptyTable(); this.emptyTable();
this.instance.changeNextButtonLabel(constants.nextText); this.instance.changeNextButtonLabel(constants.nextText);
this.instance.registerNavigationValidator((info) => { this.instance.registerNavigationValidator((info) => {
return true; return true;

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/integration-tests/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

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

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/kusto/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -40,7 +40,7 @@ export default class CodeAdapter implements IPrompter {
let answers: Answers<T> = {}; let answers: Answers<T> = {};
questions.forEach(async (question: IQuestion) => { questions.forEach(async (question: IQuestion) => {
this.fixQuestion(question); this.fixQuestion(question);
const prompt = await PromptFactory.createPrompt(question, ignoreFocusOut); const prompt = PromptFactory.createPrompt(question, ignoreFocusOut);
if (!question.shouldPrompt || question.shouldPrompt(answers) === true) { if (!question.shouldPrompt || question.shouldPrompt(answers) === true) {
const result = await prompt.render(); const result = await prompt.render();
answers[question.name] = result; answers[question.name] = result;

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/liveshare/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/machine-learning/tsconfig.json"
},
"rules": { "rules": {
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]
} }

View File

@@ -164,7 +164,7 @@ export class DeployedModelService {
// If database exist verify the table schema // If database exist verify the table schema
// //
if ((await databases).find(x => x === table.databaseName)) { if (databases.find(x => x === table.databaseName)) {
const query = queries.getConfigTableVerificationQuery(table); const query = queries.getConfigTableVerificationQuery(table);
const result = await this._queryRunner.runWithDatabaseChange(connection, query, table.databaseName); const result = await this._queryRunner.runWithDatabaseChange(connection, query, table.databaseName);
return result !== undefined && result.rows.length > 0 && result.rows[0][0].displayValue === '1'; return result !== undefined && result.rows.length > 0 && result.rows[0][0].displayValue === '1';

View File

@@ -27,7 +27,7 @@ export class CurrentLanguagesTab extends LanguageViewBase {
// TODO: only supporting single location for now. We should add a drop down for multi locations mode // TODO: only supporting single location for now. We should add a drop down for multi locations mode
// //
let locationTitle = await this.getServerTitle(); let locationTitle = this.getServerTitle();
this._locationComponent = view.modelBuilder.text().withProps({ this._locationComponent = view.modelBuilder.text().withProps({
value: locationTitle value: locationTitle
}).component(); }).component();

View File

@@ -66,7 +66,7 @@ export class AzureResourceFilterComponent extends ModelViewBase implements IData
}); });
this._workspaces.onValueChanged(async (newValue) => { this._workspaces.onValueChanged(async (newValue) => {
if (newValue.selected !== (<azdata.CategoryValue>this._workspaces.value)?.name) { if (newValue.selected !== (<azdata.CategoryValue>this._workspaces.value)?.name) {
await this.onWorkspaceSelectedChanged(); this.onWorkspaceSelectedChanged();
} }
}); });

View File

@@ -114,7 +114,7 @@ export class ImportModelWizard extends ModelViewBase {
return true; return true;
} catch (error) { } catch (error) {
await this.showErrorMessage(`${constants.modelFailedToRegister} ${constants.getErrorMessage(error)}`); this.showErrorMessage(`${constants.modelFailedToRegister} ${constants.getErrorMessage(error)}`);
return false; return false;
} }
} }

View File

@@ -217,7 +217,7 @@ export abstract class ModelViewBase extends ViewBase {
* Stores the name of the table as recent config table for importing models * Stores the name of the table as recent config table for importing models
*/ */
public async storeImportConfigTable(): Promise<void> { public async storeImportConfigTable(): Promise<void> {
await this.sendRequest(StoreImportTableEventName, this.importTable); this.sendRequest(StoreImportTableEventName, this.importTable);
} }
/** /**

View File

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

View File

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

View File

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

View File

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

View File

@@ -159,95 +159,95 @@ describe('Utils Tests', function () {
it('Constraints have no version specifier', async function (): Promise<void> { it('Constraints have no version specifier', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['3.6.*', '3.*']; let versionConstraints = ['3.6.*', '3.*'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
versionConstraints = ['3.5.*', '3.5']; versionConstraints = ['3.5.*', '3.5'];
result = await utils.isPackageSupported(pythonVersion, versionConstraints); result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.false(); should(result).be.false();
}); });
it('Package is valid for version constraints', async function (): Promise<void> { it('Package is valid for version constraints', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['>=3.5,!=3.2,!=3.4.*']; let versionConstraints = ['>=3.5,!=3.2,!=3.4.*'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Version constraints string has lots of spaces', async function (): Promise<void> { it('Version constraints string has lots of spaces', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['>= 3.5, != 3.2, != 3.4.*']; let versionConstraints = ['>= 3.5, != 3.2, != 3.4.*'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Strictly greater or less than comparisons', async function (): Promise<void> { it('Strictly greater or less than comparisons', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['> 3.5, > 3.4.*', '< 3.8']; let versionConstraints = ['> 3.5, > 3.4.*', '< 3.8'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Strict equality', async function (): Promise<void> { it('Strict equality', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['== 3.6', '== 3.6.*']; let versionConstraints = ['== 3.6', '== 3.6.*'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Package is valid for first set of constraints, but not the second', async function (): Promise<void> { it('Package is valid for first set of constraints, but not the second', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['>=3.5, !=3.2, !=3.4.*', '!=3.6, >=3.5']; let versionConstraints = ['>=3.5, !=3.2, !=3.4.*', '!=3.6, >=3.5'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Package is valid for second set of constraints, but not the first', async function (): Promise<void> { it('Package is valid for second set of constraints, but not the first', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['!=3.6, >=3.5', '>=3.5, !=3.2, !=3.4.*']; let versionConstraints = ['!=3.6, >=3.5', '>=3.5, !=3.2, !=3.4.*'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Package is not valid for constraints', async function (): Promise<void> { it('Package is not valid for constraints', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['>=3.4, !=3.6, >=3.5']; let versionConstraints = ['>=3.4, !=3.6, >=3.5'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.false(); should(result).be.false();
}); });
it('Package is not valid for several sets of constraints', async function (): Promise<void> { it('Package is not valid for several sets of constraints', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['>=3.7', '!=3.6, >=3.5', '>=3.8']; let versionConstraints = ['>=3.7', '!=3.6, >=3.5', '>=3.8'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.false(); should(result).be.false();
}); });
it('Constraints are all empty strings', async function (): Promise<void> { it('Constraints are all empty strings', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints = ['', '', '']; let versionConstraints = ['', '', ''];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Constraints are all undefined', async function (): Promise<void> { it('Constraints are all undefined', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints: string[] = [undefined, undefined, undefined]; let versionConstraints: string[] = [undefined, undefined, undefined];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Constraints are a bunch of commas', async function (): Promise<void> { it('Constraints are a bunch of commas', async function (): Promise<void> {
let pythonVersion = '3.6'; let pythonVersion = '3.6';
let versionConstraints: string[] = [',,,', ',,,,', ', , , , , , ,']; let versionConstraints: string[] = [',,,', ',,,,', ', , , , , , ,'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
it('Installed python version is an empty string', async function (): Promise<void> { it('Installed python version is an empty string', async function (): Promise<void> {
let pythonVersion = ''; let pythonVersion = '';
let versionConstraints = ['>=3.7', '!=3.6, >=3.5', '>=3.8']; let versionConstraints = ['>=3.7', '!=3.6, >=3.5', '>=3.8'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints); let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true(); should(result).be.true();
}); });
}); });

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/profiler/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -0,0 +1,5 @@
{
"rules": {
"@typescript-eslint/await-thenable": ["off"]
}
}

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/resource-deployment/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/schema-compare/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -48,10 +48,10 @@ export class SchemaCompareOptionsDialog {
this.initializeDialog(); this.initializeDialog();
this.dialog.okButton.label = loc.OkButtonText; this.dialog.okButton.label = loc.OkButtonText;
this.dialog.okButton.onClick(async () => await this.execute()); this.dialog.okButton.onClick(() => this.execute());
this.dialog.cancelButton.label = loc.CancelButtonText; this.dialog.cancelButton.label = loc.CancelButtonText;
this.dialog.cancelButton.onClick(async () => await this.cancel()); this.dialog.cancelButton.onClick(() => this.cancel());
let resetButton = azdata.window.createButton(loc.ResetButtonText); let resetButton = azdata.window.createButton(loc.ResetButtonText);
resetButton.onClick(async () => await this.reset()); resetButton.onClick(async () => await this.reset());

View File

@@ -10,7 +10,7 @@ import { SchemaCompareOptionsDialog } from '../../dialogs/schemaCompareOptionsDi
describe('Schema Compare Options Dialog', () => { describe('Schema Compare Options Dialog', () => {
it('Should open dialog successfully ', async function (): Promise<void> { it('Should open dialog successfully ', async function (): Promise<void> {
const optionsDialog = new SchemaCompareOptionsDialog(testUtils.getDeploymentOptions(), undefined); const optionsDialog = new SchemaCompareOptionsDialog(testUtils.getDeploymentOptions(), undefined);
await optionsDialog.openDialog(); optionsDialog.openDialog();
should.notEqual(optionsDialog.dialog, undefined); should.notEqual(optionsDialog.dialog, undefined);
}); });
}); });

View File

@@ -109,7 +109,7 @@ export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompa
let ownerUri = undefined; let ownerUri = undefined;
if (endpoint.endpointType === mssql.SchemaCompareEndpointType.Database && endpoint.connectionDetails) { if (endpoint.endpointType === mssql.SchemaCompareEndpointType.Database && endpoint.connectionDetails) {
let connectionProfile = await connectionInfoToConnectionProfile(endpoint.connectionDetails); let connectionProfile = connectionInfoToConnectionProfile(endpoint.connectionDetails);
let connection = await azdata.connection.connect(connectionProfile, false, false); let connection = await azdata.connection.connect(connectionProfile, false, false);
if (connection) { if (connection) {

View File

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

View File

@@ -0,0 +1,5 @@
{
"parserOptions": {
"project": "./extensions/server-report/tsconfig.json"
}
}

View File

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

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/sql-assessment/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -65,7 +65,7 @@ export class AssessmentEngine {
} else { } else {
if (asmtType === AssessmentType.AvailableRules) { if (asmtType === AssessmentType.AvailableRules) {
TelemetryReporter.sendActionEvent(SqlAssessmentTelemetryView, SqlTelemetryActions.GetDatabaseAssessmentRules); TelemetryReporter.sendActionEvent(SqlAssessmentTelemetryView, SqlTelemetryActions.GetDatabaseAssessmentRules);
await onResult(await this.sqlAssessment.getAssessmentItems(this.connectionUri, azdata.sqlAssessment.SqlAssessmentTargetType.Database), asmtType, false); onResult(await this.sqlAssessment.getAssessmentItems(this.connectionUri, azdata.sqlAssessment.SqlAssessmentTargetType.Database), asmtType, false);
} else { } else {
TelemetryReporter.sendActionEvent(SqlAssessmentTelemetryView, SqlTelemetryActions.InvokeDatabaseAssessment); TelemetryReporter.sendActionEvent(SqlAssessmentTelemetryView, SqlTelemetryActions.InvokeDatabaseAssessment);
const result = await this.sqlAssessment.assessmentInvoke(this.connectionUri, azdata.sqlAssessment.SqlAssessmentTargetType.Database); const result = await this.sqlAssessment.assessmentInvoke(this.connectionUri, azdata.sqlAssessment.SqlAssessmentTargetType.Database);
@@ -76,7 +76,7 @@ export class AssessmentEngine {
result: result result: result
}; };
await onResult(result, asmtType, false); onResult(result, asmtType, false);
this.saveAssessment(this.databaseName, result); this.saveAssessment(this.databaseName, result);
} }
@@ -147,7 +147,7 @@ export class AssessmentEngine {
assessmentResult = await this.sqlAssessment.getAssessmentItems(this.connectionUri, azdata.sqlAssessment.SqlAssessmentTargetType.Server); assessmentResult = await this.sqlAssessment.getAssessmentItems(this.connectionUri, azdata.sqlAssessment.SqlAssessmentTargetType.Server);
} }
await onResult(assessmentResult, asmtType, false); onResult(assessmentResult, asmtType, false);
let connectionProvider = azdata.dataprotocol.getProvider<azdata.ConnectionProvider>( let connectionProvider = azdata.dataprotocol.getProvider<azdata.ConnectionProvider>(
this.connectionProfile.providerId, azdata.DataProviderType.ConnectionProvider); this.connectionProfile.providerId, azdata.DataProviderType.ConnectionProvider);
@@ -167,7 +167,7 @@ export class AssessmentEngine {
this.lastInvokedResults.result.items.push(...assessmentResult?.items); this.lastInvokedResults.result.items.push(...assessmentResult?.items);
this.saveAssessment(db, assessmentResult); this.saveAssessment(db, assessmentResult);
} }
await onResult(assessmentResult, asmtType, true); onResult(assessmentResult, asmtType, true);
} }
} }
} }

View File

@@ -84,7 +84,7 @@ export class DeployService {
if (connectionString && profile.envVariableName) { if (connectionString && profile.envVariableName) {
content.Values[profile.envVariableName] = connectionString; content.Values[profile.envVariableName] = connectionString;
await fse.writeFileSync(profile.appSettingFile, JSON.stringify(content, undefined, 4)); fse.writeFileSync(profile.appSettingFile, JSON.stringify(content, undefined, 4));
this.logToOutput(`app setting '${profile.appSettingFile}' has been updated. env variable name: ${profile.envVariableName} connection String: ${connectionString}`); this.logToOutput(`app setting '${profile.appSettingFile}' has been updated. env variable name: ${profile.envVariableName} connection String: ${connectionString}`);
} else { } else {
@@ -236,11 +236,11 @@ export class DeployService {
} }
private async getConnectionString(connectionUri: string): Promise<string | undefined> { private async getConnectionString(connectionUri: string): Promise<string | undefined> {
const getAzdataApi = await utils.getAzdataApi(); const azdataApi = utils.getAzdataApi();
if (getAzdataApi) { if (azdataApi) {
const connection = await getAzdataApi.connection.getConnection(connectionUri); const connection = await azdataApi.connection.getConnection(connectionUri);
if (connection) { if (connection) {
return await getAzdataApi.connection.getConnectionString(connection.connectionId, true); return await azdataApi.connection.getConnectionString(connection.connectionId, true);
} }
} }
// TODO: vscode connections string // TODO: vscode connections string
@@ -251,9 +251,9 @@ export class DeployService {
// Connects to a database // Connects to a database
private async connectToDatabase(profile: ISqlConnectionProperties, saveConnectionAndPassword: boolean, database: string): Promise<ConnectionResult | string | undefined> { private async connectToDatabase(profile: ISqlConnectionProperties, saveConnectionAndPassword: boolean, database: string): Promise<ConnectionResult | string | undefined> {
const getAzdataApi = await utils.getAzdataApi(); const azdataApi = utils.getAzdataApi();
const vscodeMssqlApi = getAzdataApi ? undefined : await utils.getVscodeMssqlApi(); const vscodeMssqlApi = azdataApi ? undefined : await utils.getVscodeMssqlApi();
if (getAzdataApi) { if (azdataApi) {
const connectionProfile = { const connectionProfile = {
password: profile.password, password: profile.password,
serverName: `${profile.serverName},${profile.port}`, serverName: `${profile.serverName},${profile.port}`,
@@ -267,7 +267,7 @@ export class DeployService {
options: [], options: [],
authenticationType: 'SqlLogin' authenticationType: 'SqlLogin'
}; };
return await getAzdataApi.connection.connect(connectionProfile, saveConnectionAndPassword, false); return await azdataApi.connection.connect(connectionProfile, saveConnectionAndPassword, false);
} else if (vscodeMssqlApi) { } else if (vscodeMssqlApi) {
const connectionProfile = { const connectionProfile = {
password: profile.password, password: profile.password,
@@ -326,10 +326,10 @@ export class DeployService {
// Validates the connection result. If using azdata API, verifies connection was successful and connection id is returns // Validates the connection result. If using azdata API, verifies connection was successful and connection id is returns
// If using vscode API, verifies the connection url is returns // If using vscode API, verifies the connection url is returns
private async validateConnection(connection: ConnectionResult | string | undefined): Promise<utils.ValidationResult> { private async validateConnection(connection: ConnectionResult | string | undefined): Promise<utils.ValidationResult> {
const getAzdataApi = await utils.getAzdataApi(); const azdataApi = utils.getAzdataApi();
if (!connection) { if (!connection) {
return { validated: false, errorMessage: constants.connectionFailedError('No result returned') }; return { validated: false, errorMessage: constants.connectionFailedError('No result returned') };
} else if (getAzdataApi) { } else if (azdataApi) {
const connectionResult = <ConnectionResult>connection; const connectionResult = <ConnectionResult>connection;
if (connectionResult) { if (connectionResult) {
const connected = connectionResult !== undefined && connectionResult.connected && connectionResult.connectionId !== undefined; const connected = connectionResult !== undefined && connectionResult.connected && connectionResult.connectionId !== undefined;
@@ -344,13 +344,13 @@ export class DeployService {
// Formats connection result to string to be able to add to log // Formats connection result to string to be able to add to log
private async formatConnectionResult(connection: ConnectionResult | string | undefined): Promise<string> { private async formatConnectionResult(connection: ConnectionResult | string | undefined): Promise<string> {
const getAzdataApi = await utils.getAzdataApi(); const azdataApi = utils.getAzdataApi();
const connectionResult = connection !== undefined && getAzdataApi ? <ConnectionResult>connection : undefined; const connectionResult = connection !== undefined && azdataApi ? <ConnectionResult>connection : undefined;
return connectionResult?.connected ? connectionResult.connectionId! : <string>connection; return connectionResult?.connected ? connectionResult.connectionId! : <string>connection;
} }
public async getConnection(profile: ISqlConnectionProperties, saveConnectionAndPassword: boolean, database: string): Promise<string | undefined> { public async getConnection(profile: ISqlConnectionProperties, saveConnectionAndPassword: boolean, database: string): Promise<string | undefined> {
const getAzdataApi = await utils.getAzdataApi(); const azdataApi = utils.getAzdataApi();
let connection = await utils.retry( let connection = await utils.retry(
constants.connectingToSqlServerMessage, constants.connectingToSqlServerMessage,
async () => { async () => {
@@ -363,9 +363,9 @@ export class DeployService {
if (connection) { if (connection) {
const connectionResult = <ConnectionResult>connection; const connectionResult = <ConnectionResult>connection;
if (getAzdataApi) { if (azdataApi) {
utils.throwIfNotConnected(connectionResult); utils.throwIfNotConnected(connectionResult);
return getAzdataApi.connection.getUriForConnection(connectionResult.connectionId!); return azdataApi.connection.getUriForConnection(connectionResult.connectionId!);
} else { } else {
return <string>connection; return <string>connection;
} }
@@ -375,11 +375,11 @@ export class DeployService {
} }
private async executeTask<T>(taskName: string, task: () => Promise<T>): Promise<T> { private async executeTask<T>(taskName: string, task: () => Promise<T>): Promise<T> {
const getAzdataApi = await utils.getAzdataApi(); const azdataApi = utils.getAzdataApi();
if (getAzdataApi) { if (azdataApi) {
return new Promise<T>((resolve, reject) => { return new Promise<T>((resolve, reject) => {
let msgTaskName = taskName; let msgTaskName = taskName;
getAzdataApi!.tasks.startBackgroundOperation({ azdataApi!.tasks.startBackgroundOperation({
displayName: msgTaskName, displayName: msgTaskName,
description: msgTaskName, description: msgTaskName,
isCancelable: false, isCancelable: false,
@@ -387,11 +387,11 @@ export class DeployService {
try { try {
let result: T = await task(); let result: T = await task();
op.updateStatus(getAzdataApi!.TaskStatus.Succeeded); op.updateStatus(azdataApi!.TaskStatus.Succeeded);
resolve(result); resolve(result);
} catch (error) { } catch (error) {
let errorMsg = constants.taskFailedError(taskName, error ? error.message : ''); let errorMsg = constants.taskFailedError(taskName, error ? error.message : '');
op.updateStatus(getAzdataApi!.TaskStatus.Failed, errorMsg); op.updateStatus(azdataApi!.TaskStatus.Failed, errorMsg);
reject(errorMsg); reject(errorMsg);
} }
} }

View File

@@ -1264,7 +1264,7 @@ export class Project implements ISqlProject {
*/ */
private async undoExcludeFileFromProjFile(xmlTag: string, relativePath: string): Promise<void> { private async undoExcludeFileFromProjFile(xmlTag: string, relativePath: string): Promise<void> {
const nodes = this.projFileXmlDoc!.documentElement.getElementsByTagName(xmlTag); const nodes = this.projFileXmlDoc!.documentElement.getElementsByTagName(xmlTag);
if (await this.removeNode(relativePath, nodes, true)) { if (this.removeNode(relativePath, nodes, true)) {
await this.serializeToProjFile(this.projFileXmlDoc!); await this.serializeToProjFile(this.projFileXmlDoc!);
} }
} }

View File

@@ -69,11 +69,11 @@ describe('NetCoreTool: Net core tests', function (): void {
should(text.toString().trim()).equal('test'); should(text.toString().trim()).equal('test');
} }
finally { finally {
await fs.exists(dummyFile, async (existBool) => { try {
if (existBool) {
await fs.promises.unlink(dummyFile); await fs.promises.unlink(dummyFile);
} catch (err) {
console.warn(`Failed to clean up ${dummyFile}`);
} }
});
} }
}); });
}); });

View File

@@ -228,7 +228,7 @@ describe('Project: sqlproj content operations', function (): void {
const project = await Project.openProject(projFilePath); const project = await Project.openProject(projFilePath);
await project.changeTargetPlatform('invalidPlatform'); await project.changeTargetPlatform('invalidPlatform');
await testUtils.shouldThrowSpecificError(async () => await project.getSystemDacpacUri(constants.masterDacpac), constants.invalidDataSchemaProvider); await testUtils.shouldThrowSpecificError(() => project.getSystemDacpacUri(constants.masterDacpac), constants.invalidDataSchemaProvider);
}); });
it('Should add system database references correctly', async function (): Promise<void> { it('Should add system database references correctly', async function (): Promise<void> {

View File

@@ -1,4 +1,7 @@
{ {
"parserOptions": {
"project": "./extensions/sql-migration/tsconfig.json"
},
"rules": { "rules": {
// Disabled until the issues can be fixed // Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"] "@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -364,7 +364,7 @@ export async function stopMigration(account: azdata.Account, subscription: Subsc
export async function getLocationDisplayName(location: string): Promise<string> { export async function getLocationDisplayName(location: string): Promise<string> {
const api = await getAzureCoreAPI(); const api = await getAzureCoreAPI();
return await api.getRegionDisplayName(location); return api.getRegionDisplayName(location);
} }
type SortableAzureResources = AzureProduct | azurecore.azureResource.FileShare | azurecore.azureResource.BlobContainer | azurecore.azureResource.Blob | azurecore.azureResource.AzureResourceSubscription | SqlMigrationService; type SortableAzureResources = AzureProduct | azurecore.azureResource.FileShare | azurecore.azureResource.BlobContainer | azurecore.azureResource.Blob | azurecore.azureResource.AzureResourceSubscription | SqlMigrationService;

View File

@@ -56,7 +56,7 @@ export class SavedAssessmentDialog {
dialog.registerCloseValidator(async () => { dialog.registerCloseValidator(async () => {
if (this.stateModel.resumeAssessment) { if (this.stateModel.resumeAssessment) {
if (await !this.stateModel.loadSavedInfo()) { if (!this.stateModel.loadSavedInfo()) {
void vscode.window.showInformationMessage(constants.OPEN_SAVED_INFO_ERROR); void vscode.window.showInformationMessage(constants.OPEN_SAVED_INFO_ERROR);
return false; return false;
} }

View File

@@ -37,7 +37,7 @@ export class CreateResourceGroupDialog {
async initialize(): Promise<azureResource.AzureResourceResourceGroup> { async initialize(): Promise<azureResource.AzureResourceResourceGroup> {
let tab = azdata.window.createTab('sql.migration.CreateResourceGroupDialog'); let tab = azdata.window.createTab('sql.migration.CreateResourceGroupDialog');
await tab.registerContent(async (view: azdata.ModelView) => { tab.registerContent(async (view: azdata.ModelView) => {
this._view = view; this._view = view;
const resourceGroupDescription = view.modelBuilder.text().withProps({ const resourceGroupDescription = view.modelBuilder.text().withProps({

View File

@@ -67,7 +67,7 @@ export class SelectMigrationServiceDialog {
async initialize(): Promise<void> { async initialize(): Promise<void> {
this._serviceContext = await MigrationLocalStorage.getMigrationServiceContext(); this._serviceContext = await MigrationLocalStorage.getMigrationServiceContext();
await this._dialog.registerContent(async (view: azdata.ModelView) => { this._dialog.registerContent(async (view: azdata.ModelView) => {
this._disposables.push( this._disposables.push(
view.onClosed(e => { view.onClosed(e => {
this._disposables.forEach( this._disposables.forEach(

View File

@@ -31,7 +31,7 @@ export class TargetDatabaseSummaryDialog {
async initialize(): Promise<void> { async initialize(): Promise<void> {
let tab = azdata.window.createTab('sql.migration.CreateResourceGroupDialog'); let tab = azdata.window.createTab('sql.migration.CreateResourceGroupDialog');
await tab.registerContent(async (view: azdata.ModelView) => { tab.registerContent(async (view: azdata.ModelView) => {
this._view = view; this._view = view;
const databaseCount = this._view.modelBuilder.text().withProps({ const databaseCount = this._view.modelBuilder.text().withProps({

View File

@@ -174,7 +174,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
} }
}).component(); }).component();
this._chooseTargetComponent = await this.createChooseTargetComponent(view); this._chooseTargetComponent = await this.createChooseTargetComponent(view);
const _azureRecommendationsContainer = await this.createAzureRecommendationContainer(view); const _azureRecommendationsContainer = this.createAzureRecommendationContainer(view);
this.assessmentGroupContainer = await this.createViewAssessmentsContainer(); this.assessmentGroupContainer = await this.createViewAssessmentsContainer();
this._formContainer = view.modelBuilder.formContainer().withFormItems( this._formContainer = view.modelBuilder.formContainer().withFormItems(
[ [

View File

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

View File

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

View File

@@ -47,7 +47,7 @@
"web": "node resources/web/code-web.js", "web": "node resources/web/code-web.js",
"compile-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-web", "compile-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-web",
"watch-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js watch-web", "watch-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js watch-web",
"eslint": "node build/eslint", "eslint": "node --max_old_space_size=4095 build/eslint",
"playwright-install": "node build/azure-pipelines/common/installPlaywright.js", "playwright-install": "node build/azure-pipelines/common/installPlaywright.js",
"compile-build": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-build", "compile-build": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-build",
"compile-extensions-build": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-extensions-build", "compile-extensions-build": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile-extensions-build",
@@ -57,8 +57,8 @@
"hygiene": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js hygiene", "hygiene": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js hygiene",
"core-ci": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js core-ci", "core-ci": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js core-ci",
"extensions-ci": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js extensions-ci", "extensions-ci": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js extensions-ci",
"sqllint": "eslint --no-eslintrc -c .eslintrc.sql.ts.json --rulesdir ./build/lib/eslint --ext .ts ./src/sql", "sqllint": "node --max_old_space_size=4095 ./node_modules/eslint/bin/eslint.js --no-eslintrc -c .eslintrc.sql.ts.json --rulesdir ./build/lib/eslint --ext .ts ./src/sql",
"extensions-lint": "eslint --rulesdir ./build/lib/eslint --ext .ts ./extensions" "extensions-lint": "node --max_old_space_size=4095 ./node_modules/eslint/bin/eslint.js --rulesdir ./build/lib/eslint --ext .ts ./extensions"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "~4.1.3", "@angular/animations": "~4.1.3",