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

@@ -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 {
},
});
}
}