Skip to content

Commit e5b0bb8

Browse files
committed
Run eslint . --ext .ts --fix
1 parent fcbfdec commit e5b0bb8

21 files changed

+337
-337
lines changed

src/controls/checkboxQuickPick.ts

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

44
import vscode = require("vscode");
55

6-
const confirmItemLabel: string = "$(checklist) Confirm";
7-
const checkedPrefix: string = "[ $(check) ]";
8-
const uncheckedPrefix: string = "[ ]";
9-
const defaultPlaceHolder: string = "Select 'Confirm' to confirm or press 'Esc' key to cancel";
6+
const confirmItemLabel = "$(checklist) Confirm";
7+
const checkedPrefix = "[ $(check) ]";
8+
const uncheckedPrefix = "[ ]";
9+
const defaultPlaceHolder = "Select 'Confirm' to confirm or press 'Esc' key to cancel";
1010

1111
export interface ICheckboxQuickPickItem {
1212
label: string;

src/features/Console.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function showChoicePrompt(promptDetails: IShowChoicePromptRequestArgs): Thenable
105105
// Select the defaults
106106
for (const choice of promptDetails.defaultChoices) {
107107
checkboxQuickPickItems[choice].isSelected = true;
108-
};
108+
}
109109

110110
resultThenable =
111111
showCheckboxQuickPick(
@@ -232,6 +232,6 @@ export class ConsoleFeature extends LanguageClientConsumer {
232232
this.languageClient.onRequest(
233233
ShowInputPromptRequestType,
234234
(promptDetails) => showInputPrompt(promptDetails)),
235-
]
235+
];
236236
}
237237
}

src/features/CustomViews.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class PowerShellContentProvider implements vscode.TextDocumentContentProvider {
8585
public createView(id: string, title: string, viewType: CustomViewType) {
8686
let view;
8787
switch (viewType) {
88-
case CustomViewType.HtmlContent:
89-
view = new HtmlContentView(id, title);
88+
case CustomViewType.HtmlContent:
89+
view = new HtmlContentView(id, title);
9090
}
9191

9292
this.viewIndex[this.getUri(view.id)] = view;

src/features/DebugSession.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ enum DebugConfig {
2727
LaunchScript,
2828
InteractiveSession,
2929
AttachHostProcess,
30-
};
30+
}
3131

3232
export class DebugSessionFeature extends LanguageClientConsumer
3333
implements DebugConfigurationProvider, vscode.DebugAdapterDescriptorFactory {
3434

35-
private sessionCount: number = 1;
35+
private sessionCount = 1;
3636
private tempDebugProcess: PowerShellProcess | undefined;
3737
private tempSessionDetails: IEditorServicesSessionDetails | undefined;
3838
private handlers: vscode.Disposable[] = [];
@@ -262,7 +262,7 @@ export class DebugSessionFeature extends LanguageClientConsumer
262262
const platformDetails = getPlatformDetails();
263263
const versionDetails = this.sessionManager.getPowerShellVersionDetails();
264264
if (versionDetails === undefined) {
265-
vscode.window.showErrorMessage(`Session version details were not found for ${config.name}`)
265+
vscode.window.showErrorMessage(`Session version details were not found for ${config.name}`);
266266
return null;
267267
}
268268

src/features/ExtensionCommands.ts

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,26 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
191191
}
192192
}),
193193

194-
vscode.commands.registerCommand('PowerShell.ClosePanel',
195-
async () => { await vscode.commands.executeCommand('workbench.action.closePanel'); }),
194+
vscode.commands.registerCommand("PowerShell.ClosePanel",
195+
async () => { await vscode.commands.executeCommand("workbench.action.closePanel"); }),
196196

197-
vscode.commands.registerCommand('PowerShell.PositionPanelLeft',
198-
async () => { await vscode.commands.executeCommand('workbench.action.positionPanelLeft'); }),
197+
vscode.commands.registerCommand("PowerShell.PositionPanelLeft",
198+
async () => { await vscode.commands.executeCommand("workbench.action.positionPanelLeft"); }),
199199

200-
vscode.commands.registerCommand('PowerShell.PositionPanelBottom',
201-
async () => { await vscode.commands.executeCommand('workbench.action.positionPanelBottom'); }),
200+
vscode.commands.registerCommand("PowerShell.PositionPanelBottom",
201+
async () => { await vscode.commands.executeCommand("workbench.action.positionPanelBottom"); }),
202202

203-
vscode.commands.registerCommand('PowerShell.Debug.Start',
203+
vscode.commands.registerCommand("PowerShell.Debug.Start",
204204
async () => {
205205
// TODO: Use a named debug configuration.
206206
await vscode.debug.startDebugging(undefined, {
207207
name: "PowerShell: Launch Current File",
208208
type: "PowerShell",
209209
request: "launch",
210210
script: "${file}",
211-
})
211+
});
212212
})
213-
]
213+
];
214214
}
215215

216216
public override setLanguageClient(languageclient: LanguageClient) {
@@ -431,72 +431,72 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
431431

432432
let newFileAbsolutePath: string;
433433
switch (currentFileUri.scheme) {
434-
case "file":
435-
// If the file to save can't be found, just complete the request
436-
if (!this.findTextDocument(this.normalizeFilePath(currentFileUri.fsPath))) {
437-
await this.log.writeAndShowError(`File to save not found: ${currentFileUri.fsPath}.`);
438-
return EditorOperationResponse.Completed;
439-
}
434+
case "file":
435+
// If the file to save can't be found, just complete the request
436+
if (!this.findTextDocument(this.normalizeFilePath(currentFileUri.fsPath))) {
437+
await this.log.writeAndShowError(`File to save not found: ${currentFileUri.fsPath}.`);
438+
return EditorOperationResponse.Completed;
439+
}
440440

441-
// If no newFile is given, just save the current file
442-
if (!saveFileDetails.newPath) {
443-
const doc = await vscode.workspace.openTextDocument(currentFileUri.fsPath);
444-
if (doc.isDirty) {
445-
await doc.save();
446-
}
447-
return EditorOperationResponse.Completed;
441+
// If no newFile is given, just save the current file
442+
if (!saveFileDetails.newPath) {
443+
const doc = await vscode.workspace.openTextDocument(currentFileUri.fsPath);
444+
if (doc.isDirty) {
445+
await doc.save();
448446
}
447+
return EditorOperationResponse.Completed;
448+
}
449449

450-
// Make sure we have an absolute path
451-
if (path.isAbsolute(saveFileDetails.newPath)) {
452-
newFileAbsolutePath = saveFileDetails.newPath;
453-
} else {
454-
// If not, interpret the path as relative to the current file
455-
newFileAbsolutePath = path.join(path.dirname(currentFileUri.fsPath), saveFileDetails.newPath);
456-
}
457-
break;
450+
// Make sure we have an absolute path
451+
if (path.isAbsolute(saveFileDetails.newPath)) {
452+
newFileAbsolutePath = saveFileDetails.newPath;
453+
} else {
454+
// If not, interpret the path as relative to the current file
455+
newFileAbsolutePath = path.join(path.dirname(currentFileUri.fsPath), saveFileDetails.newPath);
456+
}
457+
break;
458+
459+
case "untitled":
460+
// We need a new name to save an untitled file
461+
if (!saveFileDetails.newPath) {
462+
// TODO: Create a class handle vscode warnings and errors so we can warn easily
463+
// without logging
464+
this.log.writeAndShowWarning(
465+
"Cannot save untitled file. Try SaveAs(\"path/to/file.ps1\") instead.");
466+
return EditorOperationResponse.Completed;
467+
}
458468

459-
case "untitled":
460-
// We need a new name to save an untitled file
461-
if (!saveFileDetails.newPath) {
462-
// TODO: Create a class handle vscode warnings and errors so we can warn easily
463-
// without logging
464-
this.log.writeAndShowWarning(
465-
"Cannot save untitled file. Try SaveAs(\"path/to/file.ps1\") instead.");
469+
// Make sure we have an absolute path
470+
if (path.isAbsolute(saveFileDetails.newPath)) {
471+
newFileAbsolutePath = saveFileDetails.newPath;
472+
} else {
473+
// In fresh contexts, workspaceFolders is not defined...
474+
if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) {
475+
this.log.writeAndShowWarning("Cannot save file to relative path: no workspaces are open. " +
476+
"Try saving to an absolute path, or open a workspace.");
466477
return EditorOperationResponse.Completed;
467478
}
468479

469-
// Make sure we have an absolute path
470-
if (path.isAbsolute(saveFileDetails.newPath)) {
471-
newFileAbsolutePath = saveFileDetails.newPath;
472-
} else {
473-
// In fresh contexts, workspaceFolders is not defined...
474-
if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) {
475-
this.log.writeAndShowWarning("Cannot save file to relative path: no workspaces are open. " +
476-
"Try saving to an absolute path, or open a workspace.");
477-
return EditorOperationResponse.Completed;
478-
}
479-
480-
// If not, interpret the path as relative to the workspace root
481-
const workspaceRootUri = vscode.workspace.workspaceFolders[0].uri;
482-
// We don't support saving to a non-file URI-schemed workspace
483-
if (workspaceRootUri.scheme !== "file") {
484-
this.log.writeAndShowWarning(
485-
"Cannot save untitled file to a relative path in an untitled workspace. " +
480+
// If not, interpret the path as relative to the workspace root
481+
const workspaceRootUri = vscode.workspace.workspaceFolders[0].uri;
482+
// We don't support saving to a non-file URI-schemed workspace
483+
if (workspaceRootUri.scheme !== "file") {
484+
this.log.writeAndShowWarning(
485+
"Cannot save untitled file to a relative path in an untitled workspace. " +
486486
"Try saving to an absolute path or opening a workspace folder.");
487-
return EditorOperationResponse.Completed;
488-
}
489-
newFileAbsolutePath = path.join(workspaceRootUri.fsPath, saveFileDetails.newPath);
487+
return EditorOperationResponse.Completed;
490488
}
491-
break;
489+
newFileAbsolutePath = path.join(workspaceRootUri.fsPath, saveFileDetails.newPath);
490+
}
491+
break;
492492

493-
default:
494-
// Other URI schemes are not supported
495-
const msg = JSON.stringify(saveFileDetails);
496-
this.log.writeVerbose(
497-
`<${ExtensionCommandsFeature.name}>: Saving a document with scheme '${currentFileUri.scheme}' ` +
493+
default:
494+
// Other URI schemes are not supported
495+
const msg = JSON.stringify(saveFileDetails);
496+
this.log.writeVerbose(
497+
`<${ExtensionCommandsFeature.name}>: Saving a document with scheme '${currentFileUri.scheme}' ` +
498498
`is currently unsupported. Message: '${msg}'`);
499-
return EditorOperationResponse.Completed;
499+
return EditorOperationResponse.Completed;
500500
}
501501

502502
await this.saveDocumentContentToAbsolutePath(currentFileUri, newFileAbsolutePath);

src/features/ExternalApi.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
import * as vscode from "vscode";
5-
import { v4 as uuidv4 } from 'uuid';
5+
import { v4 as uuidv4 } from "uuid";
66
import { LanguageClientConsumer } from "../languageClientConsumer";
77
import { Logger } from "../logging";
88
import { SessionManager } from "../session";
@@ -56,7 +56,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower
5656
RETURNS:
5757
string session uuid
5858
*/
59-
public registerExternalExtension(id: string, apiVersion: string = 'v1'): string {
59+
public registerExternalExtension(id: string, apiVersion = "v1"): string {
6060
this.log.writeDiagnostic(`Registering extension '${id}' for use with API version '${apiVersion}'.`);
6161

6262
for (const [_, externalExtension] of ExternalApiFeature.registeredExternalExtension) {
@@ -97,15 +97,15 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower
9797
RETURNS:
9898
true if it worked, otherwise throws an error.
9999
*/
100-
public unregisterExternalExtension(uuid: string = ""): boolean {
100+
public unregisterExternalExtension(uuid = ""): boolean {
101101
this.log.writeDiagnostic(`Unregistering extension with session UUID: ${uuid}`);
102102
if (!ExternalApiFeature.registeredExternalExtension.delete(uuid)) {
103103
throw new Error(`No extension registered with session UUID: ${uuid}`);
104104
}
105105
return true;
106106
}
107107

108-
private getRegisteredExtension(uuid: string = ""): IExternalExtension {
108+
private getRegisteredExtension(uuid = ""): IExternalExtension {
109109
if (!ExternalApiFeature.registeredExternalExtension.has(uuid)) {
110110
throw new Error(
111111
"UUID provided was invalid, make sure you ran the 'powershellExtensionClient.registerExternalExtension(extensionId)' method and pass in the UUID that it returns to subsequent methods.");
@@ -133,7 +133,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower
133133
architecture: string;
134134
}
135135
*/
136-
public async getPowerShellVersionDetails(uuid: string = ""): Promise<IExternalPowerShellDetails> {
136+
public async getPowerShellVersionDetails(uuid = ""): Promise<IExternalPowerShellDetails> {
137137
const extension = this.getRegisteredExtension(uuid);
138138
this.log.writeDiagnostic(`Extension '${extension.id}' called 'getPowerShellVersionDetails'`);
139139

@@ -161,7 +161,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower
161161
If the extension is not started by some mechanism
162162
then this will wait indefinitely.
163163
*/
164-
public async waitUntilStarted(uuid: string = ""): Promise<void> {
164+
public async waitUntilStarted(uuid = ""): Promise<void> {
165165
const extension = this.getRegisteredExtension(uuid);
166166
this.log.writeDiagnostic(`Extension '${extension.id}' called 'waitUntilStarted'`);
167167
await this.sessionManager.waitUntilStarted();

src/features/GenerateBugReport.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import vscode = require("vscode");
66
import { SessionManager } from "../session";
77
import Settings = require("../settings");
88

9-
const queryStringPrefix: string = "?";
9+
const queryStringPrefix = "?";
1010

1111
const settings = Settings.load();
1212
const project = settings.bugReporting.project;
13-
const issuesUrl: string = `${project}/issues/new`;
13+
const issuesUrl = `${project}/issues/new`;
1414

1515
const extensions =
1616
vscode.extensions.all.filter((element) => element.packageJSON.isBuiltin === false)
@@ -84,7 +84,7 @@ ${this.generateExtensionTable(extensions)}
8484
return "none";
8585
}
8686

87-
const tableHeader = `|Extension|Author|Version|\n|---|---|---|`;
87+
const tableHeader = "|Extension|Author|Version|\n|---|---|---|";
8888
const table = installedExtensions.map((e) => {
8989
if (e.packageJSON.isBuiltin === false) {
9090
return `|${e.packageJSON.name}|${e.packageJSON.publisher}|${e.packageJSON.version}|`;
@@ -109,8 +109,8 @@ ${tableHeader}\n${table};
109109
const powerShellArgs = [
110110
"-NoProfile",
111111
"-Command",
112-
'$PSVersionString = "|Name|Value|\n"; $PSVersionString += "|---|---|\n"; $PSVersionTable.keys | ' +
113-
'ForEach-Object { $PSVersionString += "|$_|$($PSVersionTable.Item($_))|\n" }; $PSVersionString',
112+
"$PSVersionString = \"|Name|Value|\n\"; $PSVersionString += \"|---|---|\n\"; $PSVersionTable.keys | " +
113+
"ForEach-Object { $PSVersionString += \"|$_|$($PSVersionTable.Item($_))|\n\" }; $PSVersionString",
114114
];
115115

116116
const spawn = require("child_process").spawnSync;

src/features/HelpCompletion.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,30 +87,30 @@ class TriggerFinder {
8787

8888
public updateState(document: TextDocument, changeText: string): void {
8989
switch (this.state) {
90-
case SearchState.Searching:
91-
if (changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) {
92-
this.state = SearchState.Locked;
93-
this.document = document;
94-
this.count++;
95-
}
96-
break;
90+
case SearchState.Searching:
91+
if (changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) {
92+
this.state = SearchState.Locked;
93+
this.document = document;
94+
this.count++;
95+
}
96+
break;
9797

98-
case SearchState.Locked:
99-
if (document === this.document &&
98+
case SearchState.Locked:
99+
if (document === this.document &&
100100
changeText.length === 1 &&
101101
changeText[0] === this.triggerCharacters[this.count]) {
102-
this.count++;
103-
if (this.count === this.triggerCharacters.length) {
104-
this.state = SearchState.Found;
105-
}
106-
} else {
107-
this.reset();
102+
this.count++;
103+
if (this.count === this.triggerCharacters.length) {
104+
this.state = SearchState.Found;
108105
}
109-
break;
110-
111-
default:
106+
} else {
112107
this.reset();
113-
break;
108+
}
109+
break;
110+
111+
default:
112+
this.reset();
113+
break;
114114
}
115115
}
116116

src/features/ISECompatibility.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class ISECompatibilityFeature implements vscode.Disposable {
3737
vscode.commands.registerCommand("PowerShell.EnableISEMode", async () => { await this.EnableISEMode(); }),
3838
vscode.commands.registerCommand("PowerShell.DisableISEMode", async () => { await this.DisableISEMode(); }),
3939
vscode.commands.registerCommand("PowerShell.ToggleISEMode", async () => { await this.ToggleISEMode(); })
40-
]
40+
];
4141
}
4242

4343
public dispose() {

src/features/NewFileOrProject.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer {
6161
}
6262
}
6363

64-
private async showProjectTemplates(includeInstalledModules: boolean = false): Promise<void> {
64+
private async showProjectTemplates(includeInstalledModules = false): Promise<void> {
6565
const template = await vscode.window.showQuickPick(
6666
this.getProjectTemplates(includeInstalledModules),
6767
{
@@ -80,7 +80,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer {
8080

8181
private async getProjectTemplates(includeInstalledModules: boolean): Promise<ITemplateQuickPickItem[]> {
8282
if (this.languageClient === undefined) {
83-
return Promise.reject<ITemplateQuickPickItem[]>("Language client not defined!")
83+
return Promise.reject<ITemplateQuickPickItem[]>("Language client not defined!");
8484
}
8585

8686
const response = await this.languageClient.sendRequest(

0 commit comments

Comments
 (0)