Fix extension linting warnings and enable extension linting in pipelines (#16922)

* Fix extension linting errors

* fix test
This commit is contained in:
Charles Gagnon
2021-08-27 15:13:01 -07:00
committed by GitHub
parent ea5f9091d1
commit e7a719ceb4
13 changed files with 76 additions and 73 deletions

View File

@@ -8,7 +8,7 @@ import * as TypeMoq from 'typemoq';
import 'mocha';
import { AzureAuthCodeGrant } from '../../../account-provider/auths/azureAuthCodeGrant';
import { Token, TokenClaims, AccessToken, RefreshToken, OAuthTokenResponse, TokenPostData } from '../../../account-provider/auths/azureAuth';
import { Tenant, AzureAccount } from 'azurecore'
import { Tenant, AzureAccount } from 'azurecore';
import providerSettings from '../../../account-provider/providerSettings';
import { AzureResource } from 'azdata';
import { AxiosResponse } from 'axios';

View File

@@ -1280,10 +1280,10 @@
"@types/request": "^2.48.2",
"@types/stream-meter": "^0.0.22",
"@types/through2": "^2.0.34",
"chai": "^4.2.0",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"should": "^13.2.3",
"typemoq": "^2.1.0",
"vscodetestcover": "^1.1.0"
}

View File

@@ -5,7 +5,7 @@
import { DataItemCache } from '../../util/dataCache';
import 'mocha';
import { should } from 'chai'; should();
import * as should from 'should';
import * as TypeMoq from 'typemoq';
describe('DataItemCache', function (): void {
@@ -22,17 +22,16 @@ describe('DataItemCache', function (): void {
});
it('Should be initialized empty', function (): void {
dataItemCache.should.have.property('cachedItem').and.be.undefined;
should(dataItemCache).not.have.property('cachedItem').and.be.undefined();
});
it('Should be initialized as expired', function (): void {
dataItemCache.isCacheExpired().should.be.true;
should(dataItemCache.isCacheExpired()).be.true();
});
it('Should not be expired immediately after first data fetch', async function (): Promise<void> {
await dataItemCache.getData();
dataItemCache.isCacheExpired().should.be.false;
should(dataItemCache.isCacheExpired()).be.false();
});
it('Should return expected cached item from getValue()', async function (): Promise<void> {
@@ -45,7 +44,7 @@ describe('DataItemCache', function (): void {
await dataItemCache.getData();
await sleep(1.1);
dataItemCache.isCacheExpired().should.be.true;
should(dataItemCache.isCacheExpired()).be.true();
});
it('Should call fetch function once for consecutive getValue() calls prior to expiration', async function (): Promise<void> {

View File

@@ -339,11 +339,6 @@ assert-plus@1.0.0, assert-plus@^1.0.0:
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=
assertion-error@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
async-retry@^1.2.3:
version "1.3.1"
resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.1.tgz#139f31f8ddce50c0870b0ba558a6079684aaed55"
@@ -433,18 +428,6 @@ caseless@~0.12.0:
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
chai@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.2.0.tgz#760aa72cf20e3795e84b12877ce0e83737aa29e5"
integrity sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==
dependencies:
assertion-error "^1.1.0"
check-error "^1.0.2"
deep-eql "^3.0.1"
get-func-name "^2.0.0"
pathval "^1.1.0"
type-detect "^4.0.5"
chalk@^2.0.0, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
@@ -459,11 +442,6 @@ charenc@~0.0.1:
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=
check-error@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=
chokidar@3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.0.tgz#12c0714668c55800f659e262d4962a97faf554a6"
@@ -597,13 +575,6 @@ decamelize@^1.2.0:
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
deep-eql@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df"
integrity sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==
dependencies:
type-detect "^4.0.0"
default-require-extensions@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-3.0.0.tgz#e03f93aac9b2b6443fc52e5e4a37b3ad9ad8df96"
@@ -841,11 +812,6 @@ get-caller-file@^2.0.1:
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
get-func-name@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=
getpass@^0.1.1:
version "0.1.7"
resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
@@ -1489,11 +1455,6 @@ path-parse@^1.0.6:
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
pathval@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
integrity sha1-uULm1L3mUwBe9rcTYd74cn0GReA=
pend@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50"
@@ -1669,6 +1630,50 @@ set-blocking@^2.0.0:
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
should-equal@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-2.0.0.tgz#6072cf83047360867e68e98b09d71143d04ee0c3"
integrity sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==
dependencies:
should-type "^1.4.0"
should-format@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1"
integrity sha1-m/yPdPo5IFxT04w01xcwPidxJPE=
dependencies:
should-type "^1.3.0"
should-type-adaptors "^1.0.1"
should-type-adaptors@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a"
integrity sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==
dependencies:
should-type "^1.3.0"
should-util "^1.0.0"
should-type@^1.3.0, should-type@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3"
integrity sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=
should-util@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.1.tgz#fb0d71338f532a3a149213639e2d32cbea8bcb28"
integrity sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==
should@^13.2.3:
version "13.2.3"
resolved "https://registry.yarnpkg.com/should/-/should-13.2.3.tgz#96d8e5acf3e97b49d89b51feaa5ae8d07ef58f10"
integrity sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==
dependencies:
should-equal "^2.0.0"
should-format "^3.0.3"
should-type "^1.4.0"
should-type-adaptors "^1.0.1"
should-util "^1.0.0"
source-map@^0.5.0:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
@@ -1890,11 +1895,6 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
type-detect@^4.0.0, type-detect@^4.0.5:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
typemoq@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/typemoq/-/typemoq-2.1.0.tgz#4452ce360d92cf2a1a180f0c29de2803f87af1e8"

View File

@@ -39,11 +39,11 @@ describe('Github Remote Book', function () {
format: 'zip',
url: vscode.Uri.parse('https://api.github.com/repos/microsoft/test/releases/v1/assets/1'),
browserDownloadUrl: vscode.Uri.parse('https://github.com/microsoft/test/releases/download/v1/CU-1.0-EN.zip'),
}
};
let remoteLocation = loc.onGitHub;
controller.setRemoteBook(releaseURL, remoteLocation, asset);
should(controller.model.remoteBook).not.null();
should(controller.model.remoteBook instanceof GitHubRemoteBook).be.true;
should(controller.model.remoteBook instanceof GitHubRemoteBook).be.true();
let book = model.remoteBook as GitHubRemoteBook;
should(book.asset.browserDownloadUrl.toString(false)).equal('https://github.com/microsoft/test/releases/download/v1/CU-1.0-EN.zip');
});
@@ -58,13 +58,13 @@ describe('Github Remote Book', function () {
format: 'zip',
url: vscode.Uri.parse('https://api.github.com/repos/microsoft/test/releases/v1/assets/1'),
browserDownloadUrl: vscode.Uri.parse('https://github.com/microsoft/test/releases/download/v1/CU-1.0-EN.zip'),
}
};
let remoteLocation = loc.onGitHub;
const createCopySpy = sinon.spy(GitHubRemoteBook.prototype, 'createLocalCopy');
const setPathSpy = sinon.spy(RemoteBook.prototype, 'setLocalPath');
controller.setRemoteBook(releaseURL, remoteLocation, asset);
should(createCopySpy.calledOnce).be.true;
should(setPathSpy.calledOnce).be.true;
should(createCopySpy.calledOnce).be.true();
should(setPathSpy.calledOnce).be.true();
});
it('Should download contents from Github', async function (): Promise<void> {
@@ -77,7 +77,7 @@ describe('Github Remote Book', function () {
format: 'zip',
url: vscode.Uri.parse('https://api.github.com/repos/microsoft/test/releases/v1/assets/1'),
browserDownloadUrl: vscode.Uri.parse('https://github.com/microsoft/test/releases/download/v1/CU-1.0-EN.zip'),
}
};
let remoteLocation = loc.onGitHub;
controller.setRemoteBook(releaseURL, remoteLocation, asset);
@@ -85,7 +85,7 @@ describe('Github Remote Book', function () {
let setPathStub = sinon.stub(GitHubRemoteBook.prototype, 'setLocalPath');
setPathStub.callsFake(function() {
console.log(`Downloading book in ${model.remoteBook.localPath}`);
})
});
const setExtractSpy = sinon.spy(GitHubRemoteBook.prototype, 'extractFiles');
nock('https://github.com')
.persist()
@@ -108,7 +108,7 @@ describe('Github Remote Book', function () {
nock('https://github.com')
.persist()
.get('/microsoft/test/releases/download/v1/CU-1.0-EN.zip')
.reply(404)
.reply(404);
const createLocalCopy = model.remoteBook.createLocalCopy();
await should(createLocalCopy).be.rejected();
});

View File

@@ -7,7 +7,7 @@ import * as should from 'should';
import * as TypeMoq from 'typemoq';
import * as stream from 'stream';
import * as cp from 'child_process';
import * as si from '../../jupyter/serverInstance'
import * as si from '../../jupyter/serverInstance';
import 'mocha';
import * as sinon from 'sinon';
import * as utils from '../../common/utils';

View File

@@ -196,7 +196,7 @@ describe('PythonPathLookup', function () {
it('getInfoForPaths - empty array arg', async () => {
let getInfoStub = sinon.stub(pathLookup, 'getInfoForPath').rejects('Unexpected getInfoForPath call');
let result = await pathLookup.getInfoForPaths([]);
should(result).not.be.undefined;
should(result).not.be.undefined();
should(result.length).be.equal(0);
should(getInfoStub.callCount).be.equal(0);
});

View File

@@ -10,25 +10,25 @@ import {SchemaCompareOptionsModel} from '../../models/schemaCompareOptionsModel'
describe('Schema Compare Options Model', () => {
it('Should create model and set options successfully', function (): void {
const model = new SchemaCompareOptionsModel(defaultOptions);
should.notEqual(model.getOptionsData(), undefined, "Options shouldn't be undefined");
should.notEqual(model.getObjectsData(), undefined, "Objects shouldn't be udnefined");
should.notEqual(model.getOptionsData(), undefined, 'Options shouldn\'t be undefined');
should.notEqual(model.getObjectsData(), undefined, 'Objects shouldn\'t be undefined');
should.doesNotThrow(() => model.setDeploymentOptions());
should.doesNotThrow(() => model.setObjectTypeOptions());
should(model.getSchemaCompareOptionUtil('')).be.false("Should return false if an invalid option is passed in");
should(model.getSchemaCompareIncludedObjectsUtil('')).be.false("Should return false if invalid object name is passed in");
should(model.getSchemaCompareOptionUtil('')).be.false('Should return false if an invalid option is passed in');
should(model.getSchemaCompareIncludedObjectsUtil('')).be.false('Should return false if invalid object name is passed in');
});
it('Should exclude objects', function (): void {
const model = new SchemaCompareOptionsModel(defaultOptions);
should(model.excludedObjectTypes.length).be.equal(0, "There shuld be no excluded objects");
should(model.excludedObjectTypes.length).be.equal(0, 'There should be no excluded objects');
model.objectTypeLabels.forEach(l => {
model.setSchemaCompareIncludedObjectsUtil(l, false);
});
should(model.excludedObjectTypes.length).be.equal(model.objectTypeLabels.length, "All the object types should be excluded");
should(model.excludedObjectTypes.length).be.equal(model.objectTypeLabels.length, 'All the object types should be excluded');
});
it('Should get descriptions', function (): void {

View File

@@ -868,14 +868,14 @@ describe('Project: properties', function (): void {
projFilePath = await testUtils.createTestSqlProjFile(baselines.sqlProjectMissingVersionBaseline);
const project = await Project.openProject(projFilePath);
should(() => project.getProjectTargetVersion()).throw("Invalid DSP in .sqlproj file");
should(() => project.getProjectTargetVersion()).throw('Invalid DSP in .sqlproj file');
});
it('Should throw on invalid target database version', async function (): Promise<void> {
projFilePath = await testUtils.createTestSqlProjFile(baselines.sqlProjectInvalidVersionBaseline);
const project = await Project.openProject(projFilePath);
should(() => project.getProjectTargetVersion()).throw("Invalid DSP in .sqlproj file");
should(() => project.getProjectTargetVersion()).throw('Invalid DSP in .sqlproj file');
});
it('Should read default database collation', async function (): Promise<void> {
@@ -897,7 +897,7 @@ describe('Project: properties', function (): void {
const project = await Project.openProject(projFilePath);
should(() => project.getDatabaseDefaultCollation())
.throw("Invalid value specified for the property 'DefaultCollation' in .sqlproj file");
.throw('Invalid value specified for the property \'DefaultCollation\' in .sqlproj file');
});
});

View File

@@ -7,5 +7,7 @@
//
// Proper fix: https://github.com/microsoft/TypeScript/issues/31535
/* eslint-disable no-var */
declare var TextDecoder: typeof import('util').TextDecoder;
declare var TextEncoder: typeof import('util').TextEncoder;