From bcf2d682465ea0298b1eaad13b82d2b6e12027ad Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 8 Apr 2021 16:25:00 -0700 Subject: [PATCH] fix: tsec hygiene check --- build/package.json | 2 +- build/yarn.lock | 10 +++++----- package.json | 2 +- src/vs/base/node/decoder.ts | 2 +- src/vs/base/node/id.ts | 2 +- src/vs/base/node/macAddress.ts | 2 +- src/vs/code/electron-main/main.ts | 2 +- src/vs/workbench/services/search/node/fileSearch.ts | 8 ++++---- .../electron-browser/nativeTextFileService.io.test.ts | 4 ++-- yarn.lock | 7 +------ 10 files changed, 18 insertions(+), 23 deletions(-) diff --git a/build/package.json b/build/package.json index f2273fd9ead54..94b32c29c26bb 100644 --- a/build/package.json +++ b/build/package.json @@ -24,7 +24,7 @@ "@types/minimist": "^1.2.1", "@types/mkdirp": "^1.0.1", "@types/mocha": "^8.2.0", - "@types/node": "^12.19.9", + "@types/node": "^14.14.37", "@types/p-limit": "^2.2.0", "@types/plist": "^3.0.2", "@types/pump": "^1.0.1", diff --git a/build/yarn.lock b/build/yarn.lock index f44e07a9bdfed..177a315464489 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -371,16 +371,16 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.51.tgz#b31d716fb8d58eeb95c068a039b9b6292817d5fb" integrity sha512-El3+WJk2D/ppWNd2X05aiP5l2k4EwF7KwheknQZls+I26eSICoWRhRIJ56jGgw2dqNGQ5LtNajmBU2ajS28EvQ== -"@types/node@^12.19.9": - version "12.19.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.9.tgz#990ad687ad8b26ef6dcc34a4f69c33d40c95b679" - integrity sha512-yj0DOaQeUrk3nJ0bd3Y5PeDRJ6W0r+kilosLA+dzF3dola/o9hxhMSg2sFvVcA2UHS5JSOsZp4S0c1OEXc4m1Q== - "@types/node@^14.14.21": version "14.14.22" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.22.tgz#0d29f382472c4ccf3bd96ff0ce47daf5b7b84b18" integrity sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw== +"@types/node@^14.14.37": + version "14.14.37" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.37.tgz#a3dd8da4eb84a996c36e331df98d82abd76b516e" + integrity sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw== + "@types/p-limit@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@types/p-limit/-/p-limit-2.2.0.tgz#94a608e9b258a6c6156a13d1a14fd720dba70b97" diff --git a/package.json b/package.json index e836f78dc11eb..c63dbf589e34b 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "@types/keytar": "^4.4.0", "@types/minimist": "^1.2.1", "@types/mocha": "^8.2.0", - "@types/node": "^12.19.9", + "@types/node": "^14.14.37", "@types/sinon": "^1.16.36", "@types/trusted-types": "^1.0.6", "@types/vscode-windows-registry": "^1.0.0", diff --git a/src/vs/base/node/decoder.ts b/src/vs/base/node/decoder.ts index 767cf6d89c114..36a3de5175c09 100644 --- a/src/vs/base/node/decoder.ts +++ b/src/vs/base/node/decoder.ts @@ -18,7 +18,7 @@ export class LineDecoder { private stringDecoder: sd.StringDecoder; private remaining: string | null; - constructor(encoding: string = 'utf8') { + constructor(encoding: BufferEncoding = 'utf8') { this.stringDecoder = new sd.StringDecoder(encoding); this.remaining = null; } diff --git a/src/vs/base/node/id.ts b/src/vs/base/node/id.ts index 2799ffc718da5..679de0699ccaf 100644 --- a/src/vs/base/node/id.ts +++ b/src/vs/base/node/id.ts @@ -57,7 +57,7 @@ export const virtualMachineHint: { value(): number } = new class { const interfaces = networkInterfaces(); for (let name in interfaces) { if (Object.prototype.hasOwnProperty.call(interfaces, name)) { - for (const { mac, internal } of interfaces[name]) { + for (const { mac, internal } of interfaces[name]!) { if (!internal) { interfaceCount += 1; if (this._isVirtualMachineMacAdress(mac.toUpperCase())) { diff --git a/src/vs/base/node/macAddress.ts b/src/vs/base/node/macAddress.ts index 35fec9fc86ba5..0e5383c42ebab 100644 --- a/src/vs/base/node/macAddress.ts +++ b/src/vs/base/node/macAddress.ts @@ -35,7 +35,7 @@ function doGetMac(): Promise { try { const ifaces = networkInterfaces(); for (const [, infos] of Object.entries(ifaces)) { - for (const info of infos) { + for (const info of infos!) { if (validateMacAddress(info.mac)) { return resolve(info.mac); } diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index a2687622d9d88..b4650d50702ce 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -204,7 +204,7 @@ class CodeMain { private initServices(environmentMainService: IEnvironmentMainService, configurationService: ConfigurationService, stateService: StateService): Promise { // Environment service (paths) - const environmentServiceInitialization = Promise.all([ + const environmentServiceInitialization = Promise.all([ environmentMainService.extensionsPath, environmentMainService.nodeCachedDataDir, environmentMainService.logsPath, diff --git a/src/vs/workbench/services/search/node/fileSearch.ts b/src/vs/workbench/services/search/node/fileSearch.ts index 71b7f1b2101b9..e1cc1d116cb88 100644 --- a/src/vs/workbench/services/search/node/fileSearch.ts +++ b/src/vs/workbench/services/search/node/fileSearch.ts @@ -295,7 +295,7 @@ export class FileWalker { /** * Public for testing. */ - readStdout(cmd: childProcess.ChildProcess, encoding: string, cb: (err: Error | null, stdout?: string) => void): void { + readStdout(cmd: childProcess.ChildProcess, encoding: BufferEncoding, cb: (err: Error | null, stdout?: string) => void): void { let all = ''; this.collectStdout(cmd, encoding, () => { }, (err: Error | null, stdout?: string, last?: boolean) => { if (err) { @@ -310,7 +310,7 @@ export class FileWalker { }); } - private collectStdout(cmd: childProcess.ChildProcess, encoding: string, onMessage: (message: IProgressMessage) => void, cb: (err: Error | null, stdout?: string, last?: boolean) => void): void { + private collectStdout(cmd: childProcess.ChildProcess, encoding: BufferEncoding, onMessage: (message: IProgressMessage) => void, cb: (err: Error | null, stdout?: string, last?: boolean) => void): void { let onData = (err: Error | null, stdout?: string, last?: boolean) => { if (err || last) { onData = () => { }; @@ -357,7 +357,7 @@ export class FileWalker { }); } - private forwardData(stream: Readable, encoding: string, cb: (err: Error | null, stdout?: string) => void): StringDecoder { + private forwardData(stream: Readable, encoding: BufferEncoding, cb: (err: Error | null, stdout?: string) => void): StringDecoder { const decoder = new StringDecoder(encoding); stream.on('data', (data: Buffer) => { cb(null, decoder.write(data)); @@ -373,7 +373,7 @@ export class FileWalker { return buffers; } - private decodeData(buffers: Buffer[], encoding: string): string { + private decodeData(buffers: Buffer[], encoding: BufferEncoding): string { const decoder = new StringDecoder(encoding); return buffers.map(buffer => decoder.write(buffer)).join(''); } diff --git a/src/vs/workbench/services/textfile/test/electron-browser/nativeTextFileService.io.test.ts b/src/vs/workbench/services/textfile/test/electron-browser/nativeTextFileService.io.test.ts index bcefbded72979..57a724eeab326 100644 --- a/src/vs/workbench/services/textfile/test/electron-browser/nativeTextFileService.io.test.ts +++ b/src/vs/workbench/services/textfile/test/electron-browser/nativeTextFileService.io.test.ts @@ -30,8 +30,8 @@ flakySuite('Files - NativeTextFileService i/o', function () { let testDir: string; function readFile(path: string): Promise; - function readFile(path: string, encoding: string): Promise; - function readFile(path: string, encoding?: string): Promise { + function readFile(path: string, encoding: BufferEncoding): Promise; + function readFile(path: string, encoding?: BufferEncoding): Promise { return promises.readFile(path, encoding); } diff --git a/yarn.lock b/yarn.lock index 67e70a4c92ff4..f445582e2c060 100644 --- a/yarn.lock +++ b/yarn.lock @@ -494,12 +494,7 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.21.tgz#7e8a0c34cf29f4e17a36e9bd0ea72d45ba03908e" integrity sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ== -"@types/node@^12.19.9": - version "12.19.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.9.tgz#990ad687ad8b26ef6dcc34a4f69c33d40c95b679" - integrity sha512-yj0DOaQeUrk3nJ0bd3Y5PeDRJ6W0r+kilosLA+dzF3dola/o9hxhMSg2sFvVcA2UHS5JSOsZp4S0c1OEXc4m1Q== - -"@types/node@^14.6.2": +"@types/node@^14.14.37", "@types/node@^14.6.2": version "14.14.37" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.37.tgz#a3dd8da4eb84a996c36e331df98d82abd76b516e" integrity sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==