Skip to content

Commit 6b3a233

Browse files
committed
Fix eslint errors
Related to #1362. Signed-off-by: Denis Golovin <dgolovin@redhat.com>
1 parent 6f6a15f commit 6b3a233

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

src/util/archive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ export class Archive {
6060
.on('close', resolve);
6161
});
6262
}
63-
}
63+
}

src/util/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ export enum GlyphChars {
1010
Push = '\u25C9',
1111
NotPushed = '\u25CE',
1212
NoContext = '\u2718'
13-
14-
}
13+
}

src/util/credentialManager.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,35 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55

6-
import { env, ExtensionContext } from 'vscode';
6+
/* eslint-disable import/no-dynamic-require */
7+
/* eslint-disable global-require */
8+
9+
import { env, ExtensionContext } from 'vscode';
10+
11+
export function getVscodeModule<T>(moduleName: string): T | undefined {
12+
try {
13+
return require(`${env.appRoot}/node_modules.asar/${moduleName}`);
14+
} catch (err) {
15+
// Not in ASAR.
16+
}
17+
try {
18+
return require(`${env.appRoot}/node_modules/${moduleName}`);
19+
} catch (err) {
20+
// Not available.
21+
}
22+
return undefined;
23+
}
724

825
const keytar: any = getVscodeModule('keytar');
926

1027
export class TokenStore {
1128
public static extensionContext: ExtensionContext;
1229

13-
static async setItem(key: string, login: string, value: string): Promise<void> {
14-
return keytar ? keytar.setPassword(key, login, value) : undefined;
30+
static setItem(key: string, login: string, value: string): Promise<void> {
31+
return keytar ? keytar.setPassword(key, login, value) : Promise.resolve();
1532
}
1633

17-
static async getItem(key: string, login: string): Promise<string> {
34+
static getItem(key: string, login: string): Promise<string> {
1835
return keytar ? keytar.getPassword(key, login) : '';
1936
}
2037

@@ -26,17 +43,3 @@ export class TokenStore {
2643
return TokenStore.extensionContext.globalState.get('username');
2744
}
2845
}
29-
30-
export function getVscodeModule<T>(moduleName: string): T | undefined {
31-
try {
32-
return require(`${env.appRoot}/node_modules.asar/${moduleName}`);
33-
} catch (err) {
34-
// Not in ASAR.
35-
}
36-
try {
37-
return require(`${env.appRoot}/node_modules/${moduleName}`);
38-
} catch (err) {
39-
// Not available.
40-
}
41-
return undefined;
42-
}

0 commit comments

Comments
 (0)