Skip to content

Commit be12c96

Browse files
committed
fix lint
1 parent 864f275 commit be12c96

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

src/platform/common/platform/fileSystem.node.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
import * as path from '../../../platform/vscode-path/path';
55
import * as fs from 'fs-extra';
6-
import glob from 'glob';
6+
import { glob } from 'glob';
77
import { injectable } from 'inversify';
88
import * as tmp from 'tmp';
9-
import { promisify } from 'util';
109
import { TemporaryFile } from './types';
1110
import { IFileSystemNode } from './types.node';
1211
import { ENCODING, FileSystem as FileSystemBase } from './fileSystem';
@@ -19,10 +18,8 @@ import { getFilePath } from './fs-paths';
1918
*/
2019
@injectable()
2120
export class FileSystem extends FileSystemBase implements IFileSystemNode {
22-
private globFiles: (pat: string, options?: { cwd: string; dot?: boolean }) => Promise<string[]>;
23-
constructor() {
24-
super();
25-
this.globFiles = promisify(glob);
21+
private async globFiles(pat: string, options?: { cwd: string; dot?: boolean }): Promise<string[]> {
22+
return glob(pat, options || {});
2623
}
2724

2825
public createLocalWriteStream(path: string): fs.WriteStream {

src/test/interpreters/condaService.node.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import glob from 'glob';
4+
import { glob } from 'glob';
55
import * as path from '../../platform/vscode-path/path';
66
import { parse, SemVer } from 'semver';
7-
import { promisify } from 'util';
87
import { logger } from '../../platform/logging';
98
import { arePathsSame } from '../../platform/common/platform/fileUtils.node';
109
import { ProcessService } from '../../platform/common/process/proc.node';
@@ -65,14 +64,14 @@ const CondaLocationsGlobWin = `{${condaGlobPathsForWindows.join(',')}}`;
6564
*/
6665
async function getCondaFileFromKnownLocations(): Promise<string> {
6766
const globPattern = getOSType() === OSType.Windows ? CondaLocationsGlobWin : CondaLocationsGlob;
68-
const condaFiles = await promisify(glob)(globPattern).catch<string[]>((failReason) => {
67+
const condaFiles = await glob(globPattern, {}).catch<string[]>((failReason) => {
6968
logger.warn(
7069
'Default conda location search failed.',
7170
`Searching for default install locations for conda results in error: ${failReason}`
7271
);
7372
return [];
7473
});
75-
const validCondaFiles = condaFiles.filter((condaPath) => condaPath.length > 0);
74+
const validCondaFiles = condaFiles.filter((condaPath: string) => condaPath.length > 0);
7675
return validCondaFiles.length === 0 ? 'conda' : validCondaFiles[0];
7776
}
7877

src/test/package.nls.json.unit.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@
55

66
import { expect } from 'chai';
77
import * as fs from 'fs';
8-
import glob from 'glob';
8+
import { globSync } from 'glob';
99
import * as path from '../platform/vscode-path/path';
1010
import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants.node';
1111

1212
suite('Extension localization files', () => {
1313
test('Load localization file', () => {
1414
const filesFailed: string[] = [];
15-
glob.sync('package.nls.*.json', { sync: true, cwd: EXTENSION_ROOT_DIR_FOR_TESTS }).forEach(
16-
(localizationFile) => {
17-
try {
18-
JSON.parse(fs.readFileSync(path.join(EXTENSION_ROOT_DIR_FOR_TESTS, localizationFile)).toString());
19-
} catch {
20-
filesFailed.push(localizationFile);
21-
}
15+
globSync('package.nls.*.json', { cwd: EXTENSION_ROOT_DIR_FOR_TESTS }).forEach((localizationFile) => {
16+
try {
17+
JSON.parse(fs.readFileSync(path.join(EXTENSION_ROOT_DIR_FOR_TESTS, localizationFile)).toString());
18+
} catch {
19+
filesFailed.push(localizationFile);
2220
}
23-
);
21+
});
2422

2523
expect(filesFailed).to.be.lengthOf(0, `Failed to load JSON for ${filesFailed.join(', ')}`);
2624
});

0 commit comments

Comments
 (0)