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/**
**/test/**/*.js
**/node_modules/**
**/vscode-api-tests/testWorkspace/**
**/vscode-api-tests/testWorkspace2/**
**/extensions/**/out/**
**/extensions/**/build/**
**/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts
**/big-data-cluster/src/bigDataCluster/controller/clusterApiGenerated2.ts
**/extensions/markdown-language-features/media/**
**/extensions/markdown-language-features/notebook-out/**
**/extensions/typescript-basics/test/colorize-fixtures/**
**/extensions/**/dist/**
**/extensions/typescript-language-features/test-workspace/**
/extensions/**/out/**
/extensions/**/build/**
/extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts
/extensions/big-data-cluster/src/bigDataCluster/controller/clusterApiGenerated2.ts
/extensions/markdown-language-features/media/**
/extensions/markdown-language-features/notebook-out/**
/extensions/typescript-basics/test/colorize-fixtures/**
/extensions/**/dist/**
/extensions/types
/extensions/typescript-language-features/test-workspace/**
# 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.

View File

@@ -2,6 +2,7 @@
"rules": {
"no-cond-assign": 2,
"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": {
// Disabled until the issues can be fixed
"@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;
this.dialog = azdata.window.createModelViewDialog(this.title, event);
await this.model.initialize();
this.model.initialize();
await this.initializeDialog(this.dialog);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
{
"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": {
// Disabled until the issues can be fixed
"@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.databaseDropdownComponent = await this.createDeployDatabaseDropdown();
this.databaseDropdownComponent.title = loc.databaseName;
let radioButtons = await this.createRadiobuttons();
let radioButtons = this.createRadiobuttons();
this.formBuilder = this.view.modelBuilder.formContainer()
.withFormItems(

View File

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

View File

@@ -1,6 +1,7 @@
{
"rules": {
"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": {
"@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": {
"@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": {
"@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": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -37,12 +37,12 @@ export class ImportTestUtils {
}
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> {
let testContext = new TestExtensionContext();
testContext.extensionPath = await vscode.extensions.getExtension('Microsoft.import').extensionPath;
testContext.extensionPath = vscode.extensions.getExtension('Microsoft.import').extensionPath;
return testContext;
}
}

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
{
"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": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]

View File

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

View File

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

View File

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

View File

@@ -164,7 +164,7 @@ export class DeployedModelService {
// 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 result = await this._queryRunner.runWithDatabaseChange(connection, query, table.databaseName);
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
//
let locationTitle = await this.getServerTitle();
let locationTitle = this.getServerTitle();
this._locationComponent = view.modelBuilder.text().withProps({
value: locationTitle
}).component();

View File

@@ -66,7 +66,7 @@ export class AzureResourceFilterComponent extends ModelViewBase implements IData
});
this._workspaces.onValueChanged(async (newValue) => {
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;
} catch (error) {
await this.showErrorMessage(`${constants.modelFailedToRegister} ${constants.getErrorMessage(error)}`);
this.showErrorMessage(`${constants.modelFailedToRegister} ${constants.getErrorMessage(error)}`);
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
*/
public async storeImportConfigTable(): Promise<void> {
await this.sendRequest(StoreImportTableEventName, this.importTable);
this.sendRequest(StoreImportTableEventName, this.importTable);
}
/**

View File

@@ -1,5 +1,6 @@
{
"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": {
"@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": {
"@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": {
"@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> {
let pythonVersion = '3.6';
let versionConstraints = ['3.6.*', '3.*'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints);
let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true();
versionConstraints = ['3.5.*', '3.5'];
result = await utils.isPackageSupported(pythonVersion, versionConstraints);
result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.false();
});
it('Package is valid for version constraints', async function (): Promise<void> {
let pythonVersion = '3.6';
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();
});
it('Version constraints string has lots of spaces', async function (): Promise<void> {
let pythonVersion = '3.6';
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();
});
it('Strictly greater or less than comparisons', async function (): Promise<void> {
let pythonVersion = '3.6';
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();
});
it('Strict equality', async function (): Promise<void> {
let pythonVersion = '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();
});
it('Package is valid for first set of constraints, but not the second', async function (): Promise<void> {
let pythonVersion = '3.6';
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();
});
it('Package is valid for second set of constraints, but not the first', async function (): Promise<void> {
let pythonVersion = '3.6';
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();
});
it('Package is not valid for constraints', async function (): Promise<void> {
let pythonVersion = '3.6';
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();
});
it('Package is not valid for several sets of constraints', async function (): Promise<void> {
let pythonVersion = '3.6';
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();
});
it('Constraints are all empty strings', async function (): Promise<void> {
let pythonVersion = '3.6';
let versionConstraints = ['', '', ''];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints);
let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true();
});
it('Constraints are all undefined', async function (): Promise<void> {
let pythonVersion = '3.6';
let versionConstraints: string[] = [undefined, undefined, undefined];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints);
let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true();
});
it('Constraints are a bunch of commas', async function (): Promise<void> {
let pythonVersion = '3.6';
let versionConstraints: string[] = [',,,', ',,,,', ', , , , , , ,'];
let result = await utils.isPackageSupported(pythonVersion, versionConstraints);
let result = utils.isPackageSupported(pythonVersion, versionConstraints);
should(result).be.true();
});
it('Installed python version is an empty string', async function (): Promise<void> {
let pythonVersion = '';
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();
});
});

View File

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

View File

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

View File

@@ -48,10 +48,10 @@ export class SchemaCompareOptionsDialog {
this.initializeDialog();
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.onClick(async () => await this.cancel());
this.dialog.cancelButton.onClick(() => this.cancel());
let resetButton = azdata.window.createButton(loc.ResetButtonText);
resetButton.onClick(async () => await this.reset());

View File

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

View File

@@ -109,7 +109,7 @@ export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompa
let ownerUri = undefined;
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);
if (connection) {

View File

@@ -1,5 +1,6 @@
{
"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": {
"@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": {
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"]

View File

@@ -65,7 +65,7 @@ export class AssessmentEngine {
} else {
if (asmtType === AssessmentType.AvailableRules) {
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 {
TelemetryReporter.sendActionEvent(SqlAssessmentTelemetryView, SqlTelemetryActions.InvokeDatabaseAssessment);
const result = await this.sqlAssessment.assessmentInvoke(this.connectionUri, azdata.sqlAssessment.SqlAssessmentTargetType.Database);
@@ -76,7 +76,7 @@ export class AssessmentEngine {
result: result
};
await onResult(result, asmtType, false);
onResult(result, asmtType, false);
this.saveAssessment(this.databaseName, result);
}
@@ -147,7 +147,7 @@ export class AssessmentEngine {
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>(
this.connectionProfile.providerId, azdata.DataProviderType.ConnectionProvider);
@@ -167,7 +167,7 @@ export class AssessmentEngine {
this.lastInvokedResults.result.items.push(...assessmentResult?.items);
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) {
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}`);
} else {
@@ -236,11 +236,11 @@ export class DeployService {
}
private async getConnectionString(connectionUri: string): Promise<string | undefined> {
const getAzdataApi = await utils.getAzdataApi();
if (getAzdataApi) {
const connection = await getAzdataApi.connection.getConnection(connectionUri);
const azdataApi = utils.getAzdataApi();
if (azdataApi) {
const connection = await azdataApi.connection.getConnection(connectionUri);
if (connection) {
return await getAzdataApi.connection.getConnectionString(connection.connectionId, true);
return await azdataApi.connection.getConnectionString(connection.connectionId, true);
}
}
// TODO: vscode connections string
@@ -251,9 +251,9 @@ export class DeployService {
// Connects to a database
private async connectToDatabase(profile: ISqlConnectionProperties, saveConnectionAndPassword: boolean, database: string): Promise<ConnectionResult | string | undefined> {
const getAzdataApi = await utils.getAzdataApi();
const vscodeMssqlApi = getAzdataApi ? undefined : await utils.getVscodeMssqlApi();
if (getAzdataApi) {
const azdataApi = utils.getAzdataApi();
const vscodeMssqlApi = azdataApi ? undefined : await utils.getVscodeMssqlApi();
if (azdataApi) {
const connectionProfile = {
password: profile.password,
serverName: `${profile.serverName},${profile.port}`,
@@ -267,7 +267,7 @@ export class DeployService {
options: [],
authenticationType: 'SqlLogin'
};
return await getAzdataApi.connection.connect(connectionProfile, saveConnectionAndPassword, false);
return await azdataApi.connection.connect(connectionProfile, saveConnectionAndPassword, false);
} else if (vscodeMssqlApi) {
const connectionProfile = {
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
// If using vscode API, verifies the connection url is returns
private async validateConnection(connection: ConnectionResult | string | undefined): Promise<utils.ValidationResult> {
const getAzdataApi = await utils.getAzdataApi();
const azdataApi = utils.getAzdataApi();
if (!connection) {
return { validated: false, errorMessage: constants.connectionFailedError('No result returned') };
} else if (getAzdataApi) {
} else if (azdataApi) {
const connectionResult = <ConnectionResult>connection;
if (connectionResult) {
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
private async formatConnectionResult(connection: ConnectionResult | string | undefined): Promise<string> {
const getAzdataApi = await utils.getAzdataApi();
const connectionResult = connection !== undefined && getAzdataApi ? <ConnectionResult>connection : undefined;
const azdataApi = utils.getAzdataApi();
const connectionResult = connection !== undefined && azdataApi ? <ConnectionResult>connection : undefined;
return connectionResult?.connected ? connectionResult.connectionId! : <string>connection;
}
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(
constants.connectingToSqlServerMessage,
async () => {
@@ -363,9 +363,9 @@ export class DeployService {
if (connection) {
const connectionResult = <ConnectionResult>connection;
if (getAzdataApi) {
if (azdataApi) {
utils.throwIfNotConnected(connectionResult);
return getAzdataApi.connection.getUriForConnection(connectionResult.connectionId!);
return azdataApi.connection.getUriForConnection(connectionResult.connectionId!);
} else {
return <string>connection;
}
@@ -375,11 +375,11 @@ export class DeployService {
}
private async executeTask<T>(taskName: string, task: () => Promise<T>): Promise<T> {
const getAzdataApi = await utils.getAzdataApi();
if (getAzdataApi) {
const azdataApi = utils.getAzdataApi();
if (azdataApi) {
return new Promise<T>((resolve, reject) => {
let msgTaskName = taskName;
getAzdataApi!.tasks.startBackgroundOperation({
azdataApi!.tasks.startBackgroundOperation({
displayName: msgTaskName,
description: msgTaskName,
isCancelable: false,
@@ -387,11 +387,11 @@ export class DeployService {
try {
let result: T = await task();
op.updateStatus(getAzdataApi!.TaskStatus.Succeeded);
op.updateStatus(azdataApi!.TaskStatus.Succeeded);
resolve(result);
} catch (error) {
let errorMsg = constants.taskFailedError(taskName, error ? error.message : '');
op.updateStatus(getAzdataApi!.TaskStatus.Failed, errorMsg);
op.updateStatus(azdataApi!.TaskStatus.Failed, errorMsg);
reject(errorMsg);
}
}

View File

@@ -1264,7 +1264,7 @@ export class Project implements ISqlProject {
*/
private async undoExcludeFileFromProjFile(xmlTag: string, relativePath: string): Promise<void> {
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!);
}
}

View File

@@ -69,11 +69,11 @@ describe('NetCoreTool: Net core tests', function (): void {
should(text.toString().trim()).equal('test');
}
finally {
await fs.exists(dummyFile, async (existBool) => {
if (existBool) {
await fs.promises.unlink(dummyFile);
}
});
try {
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);
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> {

View File

@@ -1,4 +1,7 @@
{
"parserOptions": {
"project": "./extensions/sql-migration/tsconfig.json"
},
"rules": {
// Disabled until the issues can be fixed
"@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> {
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
{
"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": {
"@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",
"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",
"eslint": "node build/eslint",
"eslint": "node --max_old_space_size=4095 build/eslint",
"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-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",
"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",
"sqllint": "eslint --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"
"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": "node --max_old_space_size=4095 ./node_modules/eslint/bin/eslint.js --rulesdir ./build/lib/eslint --ext .ts ./extensions"
},
"dependencies": {
"@angular/animations": "~4.1.3",