Skip to content

Commit c3f1ea7

Browse files
committed
Enable noImplicitReturns, noFallthroughCasesInSwitch and noUnusedParameters
1 parent 3f98265 commit c3f1ea7

8 files changed

+22
-16
lines changed

src/features/Console.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ interface IShowInputPromptResponseBody {
6060
}
6161

6262

63-
function showChoicePrompt(
64-
promptDetails: IShowChoicePromptRequestArgs,
65-
client: LanguageClient): Thenable<IShowChoicePromptResponseBody> {
63+
function showChoicePrompt(promptDetails: IShowChoicePromptRequestArgs): Thenable<IShowChoicePromptResponseBody> {
6664

6765
let resultThenable: Thenable<IShowChoicePromptResponseBody>;
6866

@@ -226,7 +224,7 @@ export class ConsoleFeature extends LanguageClientConsumer {
226224
this.handlers = [
227225
this.languageClient.onRequest(
228226
ShowChoicePromptRequestType,
229-
(promptDetails) => showChoicePrompt(promptDetails, this.languageClient)),
227+
(promptDetails) => showChoicePrompt(promptDetails)),
230228

231229
this.languageClient.onRequest(
232230
ShowInputPromptRequestType,

src/features/CustomViews.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,12 @@ class PowerShellContentProvider implements vscode.TextDocumentContentProvider {
100100

101101
public closeView(id: string) {
102102
const uriString = this.getUri(id);
103-
const view: CustomView = this.viewIndex[uriString];
104103

105104
vscode.workspace.textDocuments.some((doc) => {
106105
if (doc.uri.toString() === uriString) {
107106
vscode.window
108107
.showTextDocument(doc)
109-
.then((editor) => vscode.commands.executeCommand("workbench.action.closeActiveEditor"));
108+
.then((_) => vscode.commands.executeCommand("workbench.action.closeActiveEditor"));
110109

111110
return true;
112111
}

src/features/ExtensionCommands.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
320320
a.name.localeCompare(b.name));
321321
}
322322

323-
private showExtensionCommands(client: LanguageClient): Thenable<IInvokeExtensionCommandRequestArguments> {
323+
private showExtensionCommands(client: LanguageClient): Thenable<void> {
324324
// If no extension commands are available, show a message
325325
if (this.extensionCommands.length === 0) {
326326
vscode.window.showInformationMessage(
327327
"No extension commands have been loaded into the current session.");
328-
return;
328+
return undefined;
329329
}
330330

331331
const quickPickItems =
@@ -337,7 +337,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
337337
};
338338
});
339339

340-
vscode.window
340+
return vscode.window
341341
.showQuickPick(
342342
quickPickItems,
343343
{ placeHolder: "Select a command" })
@@ -418,7 +418,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
418418
promise =
419419
vscode.workspace.openTextDocument(filePath)
420420
.then((doc) => vscode.window.showTextDocument(doc))
421-
.then((editor) => vscode.commands.executeCommand("workbench.action.closeActiveEditor"))
421+
.then((_) => vscode.commands.executeCommand("workbench.action.closeActiveEditor"))
422422
.then((_) => EditorOperationResponse.Completed);
423423
} else {
424424
promise = Promise.resolve(EditorOperationResponse.Completed);

src/features/GenerateBugReport.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ ${this.generateExtensionTable(extensions)}
8989
if (e.packageJSON.isBuiltin === false) {
9090
return `|${e.packageJSON.name}|${e.packageJSON.publisher}|${e.packageJSON.version}|`;
9191
}
92+
return undefined;
9293
}).join("\n");
9394

9495
const extensionTable = `

src/features/GetCommands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class CommandsExplorerProvider implements vscode.TreeDataProvider<Command> {
101101
return element;
102102
}
103103

104-
public getChildren(element?: Command): Thenable<Command[]> {
104+
public getChildren(_element?: Command): Thenable<Command[]> {
105105
return Promise.resolve(this.powerShellCommands || []);
106106
}
107107
}
@@ -135,7 +135,7 @@ class Command extends vscode.TreeItem {
135135
};
136136
}
137137

138-
public async getChildren(element?): Promise<Command[]> {
138+
public async getChildren(_element?): Promise<Command[]> {
139139
return [];
140140
// Returning an empty array because we need to return something.
141141
}

src/features/RemoteFiles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ export class RemoteFilesFeature extends LanguageClientConsumer {
6666

6767
return vscode.window
6868
.showTextDocument(doc)
69-
.then((editor) => vscode.commands.executeCommand("workbench.action.closeActiveEditor"))
69+
.then((_) => vscode.commands.executeCommand("workbench.action.closeActiveEditor"))
7070
.then((_) => innerCloseFiles());
7171
}
72+
return undefined;
7273
}
7374

7475
innerCloseFiles();

src/platform.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export class PowerShellExeFinder {
104104
for await (const pwsh of this.enumeratePowerShellInstallations()) {
105105
return pwsh;
106106
}
107+
return undefined;
107108
}
108109

109110
/**
@@ -244,6 +245,9 @@ export class PowerShellExeFinder {
244245

245246
case OperatingSystem.Windows:
246247
return await this.findPSCoreWindowsInstallation();
248+
249+
case OperatingSystem.Unknown:
250+
return undefined;
247251
}
248252
}
249253

@@ -257,6 +261,9 @@ export class PowerShellExeFinder {
257261

258262
case OperatingSystem.Windows:
259263
return await this.findPSCoreWindowsInstallation({ findPreview: true });
264+
265+
case OperatingSystem.Unknown:
266+
return undefined;
260267
}
261268
}
262269

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"rootDir": ".",
1414
// TODO: We need to enable stricter checking...
1515
// "strict": true,
16-
// "noImplicitReturns": true,
17-
// "noFallthroughCasesInSwitch": true,
18-
// "noUnusedParameters": true
16+
"noImplicitReturns": true,
17+
"noFallthroughCasesInSwitch": true,
18+
"noUnusedParameters": true
1919
},
2020
"include": [ "src", "test" ],
2121
}

0 commit comments

Comments
 (0)