Archived
1
0

Remove block padding (blank lines)

Also made a rule for it.
This commit is contained in:
Asher
2019-02-05 18:08:48 -06:00
parent dc08df5540
commit e770920be0
43 changed files with 108 additions and 189 deletions

View File

@ -17,7 +17,6 @@ import { IURIFactory } from "./fill/uri";
* It also provides task management to help asynchronously load and time code.
*/
export abstract class Client {
public readonly retry = retry;
public readonly clipboard = clipboard;
public readonly uriFactory: IURIFactory;
@ -191,5 +190,4 @@ export abstract class Client {
* Create URI factory.
*/
protected abstract createUriFactory(): IURIFactory;
}

View File

@ -8,7 +8,6 @@ import { retry } from "../retry";
* messages during connection.
*/
class Connection implements ReadWriteConnection {
private activeSocket: WebSocket | undefined;
private readonly messageEmitter: Emitter<Uint8Array> = new Emitter();
private readonly closeEmitter: Emitter<void> = new Emitter();
@ -143,7 +142,6 @@ class Connection implements ReadWriteConnection {
this.activeSocket.close();
}
}
}
// Global instance so all fills can use the same client.

View File

@ -2,10 +2,9 @@ import { IDisposable } from "@coder/disposable";
import { Emitter } from "@coder/events";
/**
* Native clipboard.
* Wrapper around the native clipboard with some fallbacks.
*/
export class Clipboard {
private readonly enableEmitter: Emitter<boolean> = new Emitter();
private _isEnabled: boolean = false;
@ -149,7 +148,6 @@ export class Clipboard {
return Promise.resolve();
}
}
// Global clipboard instance since it's used in the Electron fill.

View File

@ -3,9 +3,6 @@ import { Emitter } from "@coder/events";
import "./dialog.scss";
/**
* Dialog options.
*/
export interface IDialogOptions {
message?: string;
detail?: string;
@ -24,16 +21,12 @@ export interface IDialogAction {
key?: IKey;
}
/**
* Pressed keys.
*/
export enum IKey {
Enter = "Enter",
Escape = "Escape",
}
export class Dialog {
private options: IDialogOptions;
private overlay: HTMLElement;
private cachedActiveElement: HTMLElement | undefined;
@ -190,5 +183,4 @@ export class Dialog {
});
}
}
}

View File

@ -84,7 +84,6 @@ const newCreateElement = <K extends keyof HTMLElementTagNameMap>(tagName: K): HT
document.createElement = newCreateElement;
class Clipboard {
public has(): boolean {
return false;
}
@ -92,21 +91,17 @@ class Clipboard {
public writeText(value: string): Promise<void> {
return clipboard.writeText(value);
}
}
class Shell {
public async moveItemToTrash(path: string): Promise<void> {
await promisify(exec)(
`trash-put --trash-dir ${escapePath("~/.Trash")} ${escapePath(path)}`,
);
}
}
class App extends EventEmitter {
public isAccessibilitySupportEnabled(): boolean {
return false;
}
@ -114,11 +109,9 @@ class App extends EventEmitter {
public setAsDefaultProtocolClient(): void {
throw new Error("not implemented");
}
}
class Dialog {
public showSaveDialog(_: void, options: Electron.SaveDialogOptions, callback: (filename: string | undefined) => void): void {
const defaultPath = options.defaultPath || "/untitled";
const fileIndex = defaultPath.lastIndexOf("/");
@ -203,11 +196,9 @@ class Dialog {
});
dialog.show();
}
}
class WebFrame {
public getZoomFactor(): number {
return 1;
}
@ -219,19 +210,15 @@ class WebFrame {
public setZoomLevel(): void {
// Nothing.
}
}
class Screen {
public getAllDisplays(): [] {
return [];
}
}
class WebRequest extends EventEmitter {
public onBeforeRequest(): void {
throw new Error("not implemented");
}
@ -243,28 +230,22 @@ class WebRequest extends EventEmitter {
public onHeadersReceived(): void {
throw new Error("not implemented");
}
}
class Session extends EventEmitter {
public webRequest = new WebRequest();
public resolveProxy(url: string, callback: (proxy: string) => void): void {
// TODO: not sure what this actually does.
callback(url);
}
}
class WebContents extends EventEmitter {
public session = new Session();
}
class BrowserWindow extends EventEmitter {
public webContents = new WebContents();
private representedFilename: string = "";
@ -323,7 +304,6 @@ class BrowserWindow extends EventEmitter {
public setTitle(value: string): void {
document.title = value;
}
}
/**
@ -331,7 +311,6 @@ class BrowserWindow extends EventEmitter {
* example returns a boolean while we need a promise.
*/
class ElectronFill {
public readonly shell = new Shell();
public readonly clipboard = new Clipboard();
public readonly app = new App();
@ -382,7 +361,6 @@ class ElectronFill {
};
}
// tslint:enable no-any
}
module.exports = new ElectronFill();

View File

@ -1,30 +1,11 @@
import { logger, field } from "@coder/logger";
/**
* Handle for a notification that allows it to be closed and updated.
*/
export interface INotificationHandle {
/**
* Closes the notification.
*/
close(): void;
/**
* Update the message.
*/
updateMessage(message: string): void;
/**
* Update the buttons.
*/
updateButtons(buttons: INotificationButton[]): void;
}
/**
* Notification severity.
*/
export enum Severity {
Ignore = 0,
Info = 1,
@ -32,9 +13,6 @@ export enum Severity {
Error = 3,
}
/**
* Notification button.
*/
export interface INotificationButton {
label: string;
run(): void;
@ -44,48 +22,28 @@ export interface INotificationButton {
* Optional notification service.
*/
export interface INotificationService {
/**
* Display an error message.
*/
error(error: Error): void;
/**
* Show a notification.
*/
prompt(severity: Severity, message: string, buttons: INotificationButton[], onCancel: () => void): INotificationHandle;
}
/**
* Updatable progress.
*/
export interface IProgress {
/**
* Report progress. Progress is the completed percentage from 0 to 100.
* Report progress, which should be the completed percentage from 0 to 100.
*/
report(progress: number): void;
}
/**
* Option progress reporting service.
*/
export interface IProgressService {
/**
* Start a new progress bar that resolves & disappears when the task finishes.
*/
start<T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T>;
}
/**
* Temporary notification service.
*/
export class NotificationService implements INotificationService {
public error(error: Error): void {
logger.error(error.message, field("error", error));
}
@ -93,14 +51,12 @@ export class NotificationService implements INotificationService {
public prompt(_severity: Severity, message: string, _buttons: INotificationButton[], _onCancel: () => void): INotificationHandle {
throw new Error(`cannot prompt using the console: ${message}`);
}
}
/**
* Temporary progress service.
*/
export class ProgressService implements IProgressService {
public start<T>(title: string, task: (progress: IProgress) => Promise<T>): Promise<T> {
logger.info(title);
@ -110,5 +66,4 @@ export class ProgressService implements IProgressService {
},
});
}
}

View File

@ -2,7 +2,6 @@ import { InitData } from "@coder/protocol";
import { client } from "./client";
class OS {
private _homedir: string | undefined;
private _tmpdir: string | undefined;
@ -40,9 +39,9 @@ class OS {
if (navigator.appVersion.indexOf("Mac") != -1) {
return "darwin";
}
return "linux";
}
}
export = new OS();

View File

@ -1,18 +1,14 @@
export interface IURI {
readonly path: string;
readonly fsPath: string;
readonly scheme: string;
}
export interface IURIFactory {
/**
* Convert the object to an instance of a real URI.
*/
create<T extends IURI>(uri: IURI): T;
file(path: string): IURI;
parse(raw: string): IURI;
}

View File

@ -21,7 +21,6 @@ interface IRetryItem {
* to the user explaining what is happening with an option to immediately retry.
*/
export class Retry {
private items: Map<string, IRetryItem>;
// Times are in seconds.
@ -284,7 +283,6 @@ export class Retry {
item.timeout = undefined;
item.end = undefined;
}
}
// Global instance so we can block other retries when retrying the main

View File

@ -32,7 +32,6 @@ interface IEntry {
* Handles file uploads.
*/
export class Upload {
private readonly maxParallelUploads = 100;
private readonly readSize = 32000; // ~32kb max while reading in the file.
private readonly packetSize = 32000; // ~32kb max when writing.
@ -353,7 +352,6 @@ export class Upload {
});
}
}
}
// Global instance.