Skip to content

Commit e770920

Browse files
committed
Remove block padding (blank lines)
Also made a rule for it.
1 parent dc08df5 commit e770920

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+108
-189
lines changed

packages/disposable/src/disposable.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
export interface IDisposable {
2-
32
dispose(): void;
4-
53
}

packages/events/src/events.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export interface Event<T> {
88
* Emitter typecasts for a single event type
99
*/
1010
export class Emitter<T> {
11-
1211
private listeners: Array<(e: T) => void> | undefined;
1312

1413
public constructor() {
@@ -56,5 +55,4 @@ export class Emitter<T> {
5655
public get hasListeners(): boolean {
5756
return !!this.listeners && this.listeners.length > 0;
5857
}
59-
60-
}
58+
}

packages/ide/src/client.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { IURIFactory } from "./fill/uri";
1717
* It also provides task management to help asynchronously load and time code.
1818
*/
1919
export abstract class Client {
20-
2120
public readonly retry = retry;
2221
public readonly clipboard = clipboard;
2322
public readonly uriFactory: IURIFactory;
@@ -191,5 +190,4 @@ export abstract class Client {
191190
* Create URI factory.
192191
*/
193192
protected abstract createUriFactory(): IURIFactory;
194-
195193
}

packages/ide/src/fill/client.ts

-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { retry } from "../retry";
88
* messages during connection.
99
*/
1010
class Connection implements ReadWriteConnection {
11-
1211
private activeSocket: WebSocket | undefined;
1312
private readonly messageEmitter: Emitter<Uint8Array> = new Emitter();
1413
private readonly closeEmitter: Emitter<void> = new Emitter();
@@ -143,7 +142,6 @@ class Connection implements ReadWriteConnection {
143142
this.activeSocket.close();
144143
}
145144
}
146-
147145
}
148146

149147
// Global instance so all fills can use the same client.

packages/ide/src/fill/clipboard.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { IDisposable } from "@coder/disposable";
22
import { Emitter } from "@coder/events";
33

44
/**
5-
* Native clipboard.
5+
* Wrapper around the native clipboard with some fallbacks.
66
*/
77
export class Clipboard {
8-
98
private readonly enableEmitter: Emitter<boolean> = new Emitter();
109
private _isEnabled: boolean = false;
1110

@@ -149,7 +148,6 @@ export class Clipboard {
149148

150149
return Promise.resolve();
151150
}
152-
153151
}
154152

155153
// Global clipboard instance since it's used in the Electron fill.

packages/ide/src/fill/dialog.ts

-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { Emitter } from "@coder/events";
33

44
import "./dialog.scss";
55

6-
/**
7-
* Dialog options.
8-
*/
96
export interface IDialogOptions {
107
message?: string;
118
detail?: string;
@@ -24,16 +21,12 @@ export interface IDialogAction {
2421
key?: IKey;
2522
}
2623

27-
/**
28-
* Pressed keys.
29-
*/
3024
export enum IKey {
3125
Enter = "Enter",
3226
Escape = "Escape",
3327
}
3428

3529
export class Dialog {
36-
3730
private options: IDialogOptions;
3831
private overlay: HTMLElement;
3932
private cachedActiveElement: HTMLElement | undefined;
@@ -190,5 +183,4 @@ export class Dialog {
190183
});
191184
}
192185
}
193-
194186
}

packages/ide/src/fill/electron.ts

-22
Original file line numberDiff line numberDiff line change
@@ -84,41 +84,34 @@ const newCreateElement = <K extends keyof HTMLElementTagNameMap>(tagName: K): HT
8484
document.createElement = newCreateElement;
8585

8686
class Clipboard {
87-
8887
public has(): boolean {
8988
return false;
9089
}
9190

9291
public writeText(value: string): Promise<void> {
9392
return clipboard.writeText(value);
9493
}
95-
9694
}
9795

9896
class Shell {
99-
10097
public async moveItemToTrash(path: string): Promise<void> {
10198
await promisify(exec)(
10299
`trash-put --trash-dir ${escapePath("~/.Trash")} ${escapePath(path)}`,
103100
);
104101
}
105-
106102
}
107103

108104
class App extends EventEmitter {
109-
110105
public isAccessibilitySupportEnabled(): boolean {
111106
return false;
112107
}
113108

114109
public setAsDefaultProtocolClient(): void {
115110
throw new Error("not implemented");
116111
}
117-
118112
}
119113

120114
class Dialog {
121-
122115
public showSaveDialog(_: void, options: Electron.SaveDialogOptions, callback: (filename: string | undefined) => void): void {
123116
const defaultPath = options.defaultPath || "/untitled";
124117
const fileIndex = defaultPath.lastIndexOf("/");
@@ -203,11 +196,9 @@ class Dialog {
203196
});
204197
dialog.show();
205198
}
206-
207199
}
208200

209201
class WebFrame {
210-
211202
public getZoomFactor(): number {
212203
return 1;
213204
}
@@ -219,19 +210,15 @@ class WebFrame {
219210
public setZoomLevel(): void {
220211
// Nothing.
221212
}
222-
223213
}
224214

225215
class Screen {
226-
227216
public getAllDisplays(): [] {
228217
return [];
229218
}
230-
231219
}
232220

233221
class WebRequest extends EventEmitter {
234-
235222
public onBeforeRequest(): void {
236223
throw new Error("not implemented");
237224
}
@@ -243,28 +230,22 @@ class WebRequest extends EventEmitter {
243230
public onHeadersReceived(): void {
244231
throw new Error("not implemented");
245232
}
246-
247233
}
248234

249235
class Session extends EventEmitter {
250-
251236
public webRequest = new WebRequest();
252237

253238
public resolveProxy(url: string, callback: (proxy: string) => void): void {
254239
// TODO: not sure what this actually does.
255240
callback(url);
256241
}
257-
258242
}
259243

260244
class WebContents extends EventEmitter {
261-
262245
public session = new Session();
263-
264246
}
265247

266248
class BrowserWindow extends EventEmitter {
267-
268249
public webContents = new WebContents();
269250
private representedFilename: string = "";
270251

@@ -323,15 +304,13 @@ class BrowserWindow extends EventEmitter {
323304
public setTitle(value: string): void {
324305
document.title = value;
325306
}
326-
327307
}
328308

329309
/**
330310
* We won't be able to do a 1 to 1 fill because things like moveItemToTrash for
331311
* example returns a boolean while we need a promise.
332312
*/
333313
class ElectronFill {
334-
335314
public readonly shell = new Shell();
336315
public readonly clipboard = new Clipboard();
337316
public readonly app = new App();
@@ -382,7 +361,6 @@ class ElectronFill {
382361
};
383362
}
384363
// tslint:enable no-any
385-
386364
}
387365

388366
module.exports = new ElectronFill();

packages/ide/src/fill/notification.ts

+1-46
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,18 @@
11
import { logger, field } from "@coder/logger";
22

3-
/**
4-
* Handle for a notification that allows it to be closed and updated.
5-
*/
63
export interface INotificationHandle {
7-
8-
/**
9-
* Closes the notification.
10-
*/
114
close(): void;
12-
13-
/**
14-
* Update the message.
15-
*/
165
updateMessage(message: string): void;
17-
18-
/**
19-
* Update the buttons.
20-
*/
216
updateButtons(buttons: INotificationButton[]): void;
22-
237
}
248

25-
/**
26-
* Notification severity.
27-
*/
289
export enum Severity {
2910
Ignore = 0,
3011
Info = 1,
3112
Warning = 2,
3213
Error = 3,
3314
}
3415

35-
/**
36-
* Notification button.
37-
*/
3816
export interface INotificationButton {
3917
label: string;
4018
run(): void;
@@ -44,63 +22,41 @@ export interface INotificationButton {
4422
* Optional notification service.
4523
*/
4624
export interface INotificationService {
47-
48-
/**
49-
* Display an error message.
50-
*/
5125
error(error: Error): void;
52-
53-
/**
54-
* Show a notification.
55-
*/
5626
prompt(severity: Severity, message: string, buttons: INotificationButton[], onCancel: () => void): INotificationHandle;
57-
5827
}
5928

60-
/**
61-
* Updatable progress.
62-
*/
6329
export interface IProgress {
64-
6530
/**
66-
* Report progress. Progress is the completed percentage from 0 to 100.
31+
* Report progress, which should be the completed percentage from 0 to 100.
6732
*/
6833
report(progress: number): void;
69-
7034
}
7135

72-
/**
73-
* Option progress reporting service.
74-
*/
7536
export interface IProgressService {
76-
7737
/**
7838
* Start a new progress bar that resolves & disappears when the task finishes.
7939
*/
8040
start<T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T>;
81-
8241
}
8342

8443
/**
8544
* Temporary notification service.
8645
*/
8746
export class NotificationService implements INotificationService {
88-
8947
public error(error: Error): void {
9048
logger.error(error.message, field("error", error));
9149
}
9250

9351
public prompt(_severity: Severity, message: string, _buttons: INotificationButton[], _onCancel: () => void): INotificationHandle {
9452
throw new Error(`cannot prompt using the console: ${message}`);
9553
}
96-
9754
}
9855

9956
/**
10057
* Temporary progress service.
10158
*/
10259
export class ProgressService implements IProgressService {
103-
10460
public start<T>(title: string, task: (progress: IProgress) => Promise<T>): Promise<T> {
10561
logger.info(title);
10662

@@ -110,5 +66,4 @@ export class ProgressService implements IProgressService {
11066
},
11167
});
11268
}
113-
11469
}

packages/ide/src/fill/os.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { InitData } from "@coder/protocol";
22
import { client } from "./client";
33

44
class OS {
5-
65
private _homedir: string | undefined;
76
private _tmpdir: string | undefined;
87

@@ -40,9 +39,9 @@ class OS {
4039
if (navigator.appVersion.indexOf("Mac") != -1) {
4140
return "darwin";
4241
}
42+
4343
return "linux";
4444
}
45-
4645
}
4746

4847
export = new OS();

packages/ide/src/fill/uri.ts

-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
export interface IURI {
2-
32
readonly path: string;
43
readonly fsPath: string;
54
readonly scheme: string;
6-
75
}
86

97
export interface IURIFactory {
10-
118
/**
129
* Convert the object to an instance of a real URI.
1310
*/
1411
create<T extends IURI>(uri: IURI): T;
1512
file(path: string): IURI;
1613
parse(raw: string): IURI;
17-
1814
}

packages/ide/src/retry.ts

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ interface IRetryItem {
2121
* to the user explaining what is happening with an option to immediately retry.
2222
*/
2323
export class Retry {
24-
2524
private items: Map<string, IRetryItem>;
2625

2726
// Times are in seconds.
@@ -284,7 +283,6 @@ export class Retry {
284283
item.timeout = undefined;
285284
item.end = undefined;
286285
}
287-
288286
}
289287

290288
// Global instance so we can block other retries when retrying the main

0 commit comments

Comments
 (0)