Skip to content

Commit 97d6a26

Browse files
committed
Enable 'await-thenable', 'unbound-method' and 'restrict-plus-operands'
1 parent f33b910 commit 97d6a26

File tree

7 files changed

+21
-13
lines changed

7 files changed

+21
-13
lines changed

.eslintrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
"@typescript-eslint/no-floating-promises": [
5353
"error"
5454
],
55+
"@typescript-eslint/await-thenable": [
56+
"error"
57+
],
58+
"@typescript-eslint/unbound-method": [
59+
"error"
60+
],
61+
"@typescript-eslint/restrict-plus-operands": [
62+
"error"
63+
],
5564
"header/header": [
5665
2,
5766
"line",

src/features/HelpCompletion.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ export class HelpCompletionFeature extends LanguageClientConsumer {
3636

3737
if (this.settings.helpCompletion !== Settings.CommentType.Disabled) {
3838
this.helpCompletionProvider = new HelpCompletionProvider();
39-
const subscriptions: Disposable[] = [];
40-
workspace.onDidChangeTextDocument(this.onEvent, this, subscriptions);
41-
this.disposable = Disposable.from(...subscriptions);
39+
this.disposable = workspace.onDidChangeTextDocument(async (e) => { await this.onEvent(e); });
4240
}
4341
}
4442

src/features/OpenInISE.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class OpenInISEFeature implements vscode.Disposable {
2626

2727
ISEPath += "\\WindowsPowerShell\\v1.0\\powershell_ise.exe";
2828

29-
ChildProcess.exec(ISEPath + ` -File "${uri.fsPath}"`).unref();
29+
ChildProcess.exec(`${ISEPath} -File "${uri.fsPath}"`).unref();
3030
});
3131
}
3232

src/logging.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class Logger implements ILogger {
126126
if (choice) {
127127
for (const action of fullActions) {
128128
if (choice === action.prompt) {
129-
await action.action();
129+
action.action();
130130
return;
131131
}
132132
}

src/platform.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import * as os from "os";
55
import * as path from "path";
66
import * as process from "process";
7+
import { integer } from "vscode-languageserver-protocol";
78
import { IPowerShellAdditionalExePathSettings } from "./settings";
89

910
// This uses require so we can rewire it in unit tests!
@@ -339,7 +340,7 @@ export class PowerShellExeFinder {
339340
// We are looking for something like "7-preview"
340341

341342
// Preview dirs all have dashes in them
342-
const dashIndex = item.indexOf("-");
343+
const dashIndex: integer = item.indexOf("-");
343344
if (dashIndex < 0) {
344345
continue;
345346
}

src/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class SessionManager implements Middleware {
232232

233233
public getNewSessionFilePath(): vscode.Uri {
234234
const uniqueId: number = Math.floor(100000 + Math.random() * 900000);
235-
return vscode.Uri.joinPath(this.sessionsFolder, "PSES-VSCode-" + process.env.VSCODE_PID + "-" + uniqueId + ".json");
235+
return vscode.Uri.joinPath(this.sessionsFolder, `PSES-VSCode-${process.env.VSCODE_PID}-${uniqueId}.json`);
236236
}
237237

238238
public async createDebugSessionProcess(settings: Settings.ISettings): Promise<PowerShellProcess> {

test/core/platform.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,9 @@ describe("Platform module", function () {
719719
const defaultPowerShell = await powerShellExeFinder.getFirstAvailablePowerShellInstallation();
720720
const expectedPowerShell = testPlatform.expectedPowerShellSequence[0];
721721

722-
assert.strictEqual(defaultPowerShell.exePath, expectedPowerShell!.exePath);
723-
assert.strictEqual(defaultPowerShell.displayName, expectedPowerShell!.displayName);
724-
assert.strictEqual(defaultPowerShell.supportsProperArguments, expectedPowerShell!.supportsProperArguments);
722+
assert.strictEqual(defaultPowerShell.exePath, expectedPowerShell.exePath);
723+
assert.strictEqual(defaultPowerShell.displayName, expectedPowerShell.displayName);
724+
assert.strictEqual(defaultPowerShell.supportsProperArguments, expectedPowerShell.supportsProperArguments);
725725
});
726726
}
727727

@@ -755,9 +755,9 @@ describe("Platform module", function () {
755755
const foundPowerShell = foundPowerShells[i];
756756
const expectedPowerShell = testPlatform.expectedPowerShellSequence[i];
757757

758-
assert.strictEqual(foundPowerShell && foundPowerShell.exePath, expectedPowerShell!.exePath);
759-
assert.strictEqual(foundPowerShell && foundPowerShell.displayName, expectedPowerShell!.displayName);
760-
assert.strictEqual(foundPowerShell && foundPowerShell.supportsProperArguments, expectedPowerShell!.supportsProperArguments);
758+
assert.strictEqual(foundPowerShell && foundPowerShell.exePath, expectedPowerShell.exePath);
759+
assert.strictEqual(foundPowerShell && foundPowerShell.displayName, expectedPowerShell.displayName);
760+
assert.strictEqual(foundPowerShell && foundPowerShell.supportsProperArguments, expectedPowerShell.supportsProperArguments);
761761
}
762762

763763
assert.strictEqual(

0 commit comments

Comments
 (0)