Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
izatop committed May 27, 2021
1 parent 64f5a1a commit 32f1ce5
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 41 deletions.
8 changes: 4 additions & 4 deletions packages/app/src/Request/KeyValueMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export class KeyValueMap implements IKeyValueMap {
this.#map = new Map(values);
}

public static fromObject(input: Record<string, string>): IKeyValueMap {
return new this(Object.entries(input));
}

public delete(name: string): void {
this.#map.delete(name);
}
Expand All @@ -15,10 +19,6 @@ export class KeyValueMap implements IKeyValueMap {
return [...this.#map.entries()];
}

public static fromObject(input: Record<string, string>): IKeyValueMap {
return new this(Object.entries(input));
}

public has(name: string): boolean {
return this.#map.has(name);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/app/test/src/app/Action/HelloWorldRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default route(
"/u/:id",
() => new Fields({
id: new ToNumber(Int),
payload: new Fields({name: Text}),
payload: () => new Fields({name: Text}),
option: Bool,
}),
new Resolver({
Expand Down
2 changes: 1 addition & 1 deletion packages/app/test/src/app/Context/BaseContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ApplyContext, Context} from "@bunt/unit";
import {Context} from "@bunt/unit";

export class BaseContext extends Context {
public version = "1.0.0";
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/src/RunnableCommand.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {dispose, isDisposable, isRunnable} from "@bunt/unit";
import {Disposable, dispose, isDisposable, isRunnable} from "@bunt/unit";
import {AsyncState} from "@bunt/util";
import {ok} from "assert";
import {Commander} from "../../src";
Expand All @@ -25,4 +25,5 @@ test("Runnable Command", async () => {

await dispose(result);
await expect(heartbeat.beats).toBe(false);
expect(Disposable.size).toBe(0);
});
3 changes: 0 additions & 3 deletions packages/cli/test/src/app/Context/BaseContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {ApplyContext} from "@bunt/unit";
import {CommandContext} from "../../../../src";

export class BaseContext extends CommandContext {
}

export type IBaseContext = ApplyContext<BaseContext>;
6 changes: 3 additions & 3 deletions packages/fs/src/Storage/Bucket/FsBucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ export class FsBucket {
return this.#fs.getDriver().getBucketPolicy(this.name);
}

public getPresignedUrl(file: string, expire: number = 7*24*60*60): Promise<string> {
public getPresignedUrl(file: string, expire: number = 7 * 24 * 60 * 60): Promise<string> {
return this.#fs.getDriver().getPresignedUrl(this.name, file, expire);
}

public putPresignedUrl(file: string, expire: number = 60*60): Promise<string> {
public putPresignedUrl(file: string, expire: number = 60 * 60): Promise<string> {
return this.#fs.getDriver().putPresignedUrl(this.name, file, expire);
}

public removeObject(file: string): Promise<void> {
return this.#fs.getDriver().removeObject(this.name, file);
}

public deletePresignedUrl(file: string, expire: number = 60*60): Promise<string> {
public deletePresignedUrl(file: string, expire: number = 60 * 60): Promise<string> {
return this.#fs.getDriver().deletePresignedUrl(this.name, file, expire);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/fs/src/Storage/Driver/MinIO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export class MinIO extends FsDriverAbstract {
}

public getPresignedUrl(bucket: string, file: string, expire: number): Promise<string> {
return this.#client.presignedUrl('GET', bucket, file, expire);
return this.#client.presignedUrl("GET", bucket, file, expire);
}

public putPresignedUrl(bucket: string, file: string, expire: number): Promise<string> {
return this.#client.presignedUrl('PUT', bucket, file, expire);
return this.#client.presignedUrl("PUT", bucket, file, expire);
}

public deletePresignedUrl(bucket: string, file: string, expire: number): Promise<string> {
return this.#client.presignedUrl('DELETE', bucket, file, expire);
return this.#client.presignedUrl("DELETE", bucket, file, expire);
}

public removeObject(bucket: string, file: string): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/queue/src/Queue/QueueAbstract.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Disposable, IDisposable} from "@bunt/unit";
import {ITransport} from "../interfaces";
import {IQueueList, Message, MessageCtor, MessageHandler, Incoming, Task} from "./interfaces";
import {Incoming, IQueueList, Message, MessageCtor, MessageHandler} from "./interfaces";

export abstract class QueueAbstract<Q extends ITransport> implements IDisposable {
readonly #transport: Q;
Expand Down
4 changes: 4 additions & 0 deletions packages/unit/src/Dispose/Disposable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import {Disposer} from "./Disposer";
const collection = new Map<IDisposable, Disposer>();

export class Disposable {
public static get size(): number {
return collection.size;
}

public static attach(target: IDisposable, disposable: DisposableType): void {
const disposer = this.resolve(target);
disposer.attach(disposable);
Expand Down
3 changes: 3 additions & 0 deletions packages/unit/test/src/Disposable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ describe("Disposable", () => {

Disposable.resolve(disposable5);
Disposable.resolve(disposable6);

expect(Disposable.size).toBe(2);
await Disposable.disposeAll();

expect(Disposable.size).toBe(0);
expect(pending).toEqual([1, 2]);
});
});
11 changes: 5 additions & 6 deletions packages/util/src/Logger/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ export class Logger {
protected static notice = Logger.make(SeverityLevel.NOTICE);
protected static info = Logger.make(SeverityLevel.INFO);
protected static debug = Logger.make(SeverityLevel.DEBUG);

#label: string;
public groupId?: string;
#label: string;

constructor(label: string, groupId?: string | number) {
this.#label = label;
Expand All @@ -52,10 +51,6 @@ export class Logger {
return Logger.severity;
}

public setLabel(label: string): void {
this.#label = label;
}

public static setSeverity(severity: SeverityLevel): void {
this.severity = severity;
const severities = [
Expand Down Expand Up @@ -172,6 +167,10 @@ export class Logger {
};
}

public setLabel(label: string): void {
this.#label = label;
}

public async dispose(): Promise<void> {
writers.splice(0, writers.length);
await Promise.allSettled(transports.map((transport) => transport.close()));
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/Transport/RequestMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Application, IHeaders, RequestAbstract, RequestMessageAbstract, RequestValidatorAbstract} from "@bunt/app";
import {Application, IHeaders, RequestAbstract, RequestValidatorAbstract} from "@bunt/app";
import {isString, toArray} from "@bunt/util";
import {IncomingMessage} from "http";
import {URL} from "url";
Expand Down
2 changes: 1 addition & 1 deletion packages/web/test/src/Main.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Context} from "@bunt/unit";
import * as HTTP from "http-status";
import {JSONResponse, NoContentResponse, RedirectResponse, WebServer} from "../../src";
import HelloWorldRoute from "./actions/HelloWorldRoute";
import HelloWorldRoute from "./app/Action/HelloWorldRoute";

describe("Response", () => {
test("Main", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Action} from "@bunt/unit";
import {IBaseContext} from "../context/BaseContext";
import {BaseContext} from "../Context/BaseContext";

interface IHelloWorldActionState {
id: number;
Expand All @@ -9,7 +9,7 @@ interface IHelloWorldActionState {
option?: boolean;
}

export class HelloWorldAction extends Action<IBaseContext, IHelloWorldActionState> {
export class HelloWorldAction extends Action<BaseContext, IHelloWorldActionState> {
public run(): string {
const {payload} = this.state;
return `Hello, ${payload.name}!`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {Resolver, RouteRule} from "@bunt/app";
import {Bool, Fields, Int, Text, ToNumber} from "@bunt/input";
import {pathRoute} from "../route";
import {route} from "../route";
import {HelloWorldAction} from "./HelloWorldAction";

export default pathRoute(
export default route(
HelloWorldAction,
new RouteRule(
"/u/:id",
() => new Fields({
id: new ToNumber(Int),
payload: new Fields({name: Text}),
payload: () => new Fields({name: Text}),
option: Bool,
}),
new Resolver({
Expand Down
5 changes: 5 additions & 0 deletions packages/web/test/src/app/Context/BaseContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {Context} from "@bunt/unit";

export class BaseContext extends Context {
public version = "1.0.0";
}
3 changes: 3 additions & 0 deletions packages/web/test/src/app/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {RegexpMatcher, Route} from "@bunt/app";

export const route = Route.create(RegexpMatcher.factory);
7 changes: 0 additions & 7 deletions packages/web/test/src/context/BaseContext.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/web/test/src/route.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/ws/src/Connection/interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface IClientConnection<T> extends AsyncIterable<T> {
send(message: T): void;

on(event: "close", listener: () => void): this;
}
3 changes: 2 additions & 1 deletion packages/ws/src/Protocol/GQL/GQLProtoLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
GQLClientOperation,
GQLClientOperationType,
GQLClientPayload,
GQLError, GQLInitFunction,
GQLError,
GQLInitFunction,
GQLOperationMessage,
GQLServerOperationType,
GQLSubscribeFunction,
Expand Down

0 comments on commit 32f1ce5

Please sign in to comment.