Skip to content

Commit

Permalink
chore: run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Sep 28, 2024
1 parent 0876791 commit cdf567d
Show file tree
Hide file tree
Showing 1,130 changed files with 2,189 additions and 1,260 deletions.
3 changes: 2 additions & 1 deletion benchmarks/bin/benchmark-bench.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"use strict";
import {Command} from "commander";
import inquirer from "inquirer";

import bench from "../src/bench.js";
import {choices, list} from "../src/packages.js";
import {Command} from "commander";

const program = new Command();

Expand Down
11 changes: 6 additions & 5 deletions benchmarks/bin/benchmark-compare.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env node
import os from "os";
import chalk from "chalk";
import Table from "cli-table";
import {Command} from "commander";
import {readdirSync, readFileSync, writeFileSync} from "fs";
import inquirer from "inquirer";
import Table from "cli-table";
import chalk from "chalk";
import os from "os";
import {join} from "path";
import {readdirSync, readFileSync, writeFileSync} from "fs";
import {info} from "../src/packages.js";

import {compare} from "../src/autocannon.js";
import {info} from "../src/packages.js";

const commander = new Command();

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/express-injector-async-hook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from "express";
import {InjectorService} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {InjectorService} from "@tsed/di";
import express from "express";
import {v4} from "uuid";

const app = express();
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/frameworks/express-injector-http-hook.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import express from "express";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {v4} from "uuid";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import express from "express";
import http from "http";
import {v4} from "uuid";

const injector = new InjectorService();
const app = express();
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/frameworks/express-injector-without-events.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import express from "express";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {v4} from "uuid";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import express from "express";
import http from "http";
import {v4} from "uuid";

const injector = new InjectorService();
const app = express();
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/express-injector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from "express";
import {InjectorService} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {InjectorService} from "@tsed/di";
import express from "express";
import {v4} from "uuid";

const app = express();
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/fastify-injector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Fastify from "fastify";
import {InjectorService, runInContext, getContext} from "@tsed/di";
import {PlatformContext} from "@tsed/common";
import {getContext, InjectorService, runInContext} from "@tsed/di";
import Fastify from "fastify";
import {v4} from "uuid";

const fastify = Fastify();
Expand Down
1 change: 1 addition & 0 deletions benchmarks/frameworks/hapi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "make-promises-safe";

import Hapi from "@hapi/hapi";

async function start() {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/frameworks/koa-isomorphic-router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Koa from "koa";
import Router from "benchmarks/frameworks/koa-isomorphic-router.js";
import Koa from "koa";

const app = new Koa();
const router = new Router();
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/frameworks/koa-router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Koa from "koa";
import KoaRouter from "benchmarks/frameworks/koa-router.js";
import Koa from "koa";

const router = KoaRouter();

Expand Down
1 change: 1 addition & 0 deletions benchmarks/frameworks/nest-fastify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import core from "@nestjs/core";
import fastifyPlatform from "@nestjs/platform-fastify";

import {AppModule} from "./nest/app/app.module.js";

core.NestFactory.create(AppModule, new fastifyPlatform.FastifyAdapter(), {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/frameworks/nest/app/app.controller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion benchmarks/frameworks/nest/app/app.module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {__decorate} from "tslib";
import common_1 from "@nestjs/common";
import {__decorate} from "tslib";

import {AppController} from "./app.controller.js";

class AppModule {}
Expand Down
1 change: 1 addition & 0 deletions benchmarks/frameworks/nest/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";
import core from "@nestjs/core";

import {AppModule} from "./app/app.module.js";

core.NestFactory.create(AppModule, {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-express.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformExpress} from "@tsed/platform-express";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$onInit() {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-koa.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformKoa} from "@tsed/platform-koa";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$beforeRoutesInit() {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-no-context.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformExpress} from "@tsed/platform-express";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$onInit() {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-no-events.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformExpress} from "@tsed/platform-express";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$onInit() {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/src/autocannon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import autocannon from "autocannon";
import fs from "fs";
import autoCompare from "autocannon-compare";
import fs from "fs";
import path from "path";
import {promisify} from "util";

Expand Down
3 changes: 2 additions & 1 deletion benchmarks/src/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import {execa} from "execa";
import ora from "ora";
import path from "path";
import {fire} from "./autocannon.js";
import {fileURLToPath} from "url";

import {fire} from "./autocannon.js";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const doBench = async (opts, handler) => {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/src/packages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from "fs";
import {dirname, join} from "path";
import {createRequire} from "module";
import {dirname, join} from "path";

const require = createRequire(import.meta.url);

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/domain/AnyToPromise.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {createReadStream} from "fs";
import {of} from "rxjs";

import {catchAsyncError} from "../utils/catchError.js";
import {isStream} from "../utils/objects/isStream.js";
import {AnyToPromise, AnyToPromiseStatus} from "./AnyToPromise.js";
Expand Down
12 changes: 0 additions & 12 deletions packages/core/src/domain/Metadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ describe("Metadata", () => {
});
});

// describe("getReturnType", () => {
// it("should return types on method", () => {
// expect(Metadata.getReturnType(Test.prototype, "method")).toBe(Boolean);
// });
// });
//
// describe("getOwnReturnType", () => {
// it("should return types on method", () => {
// expect(Metadata.getOwnReturnType(Test.prototype, "method")).toBe(Boolean);
// });
// });

describe("list", () => {
it("should return unique provide from property key", () => {
Metadata.set("controller", "test", Test);
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/domain/Metadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "reflect-metadata";

import {classOf} from "../utils/objects/classOf.js";

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/decorators/useDecorators.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {StoreFn} from "../../decorators/storeFn.js";
import {useDecorators} from "./useDecorators.js";
import {AnyDecorator} from "../../interfaces/AnyDecorator.js";
import {Store} from "../../domain/Store.js";
import {AnyDecorator} from "../../interfaces/AnyDecorator.js";
import {useDecorators} from "./useDecorators.js";

describe("useDecorators", () => {
function decorator1(value: any) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/decorators/useDecorators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DecoratorParameters} from "../../interfaces/DecoratorParameters.js";
import {AnyDecorator} from "../../interfaces/AnyDecorator.js";
import {DecoratorParameters} from "../../interfaces/DecoratorParameters.js";

export function useDecorators(...decorators: AnyDecorator[]): any {
return (...args: DecoratorParameters) => {
Expand Down
30 changes: 11 additions & 19 deletions packages/core/src/utils/objects/ObjectUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ describe("ObjectUtils", () => {
expect(isArrayOrArrayClass(Array)).toBe(true);
});

it("should return true when Array is given", () => {
expect(isArrayOrArrayClass([])).toBe(true);
});

it("should return true when [] is given", () => {
expect(isArrayOrArrayClass([])).toBe(true);
});
Expand All @@ -101,10 +97,6 @@ describe("ObjectUtils", () => {
expect(isCollection(Array)).toBe(true);
});

it("should return true when Array is given", () => {
expect(isCollection([])).toBe(true);
});

it("should return true when [] is given", () => {
expect(isCollection([])).toBe(true);
});
Expand Down Expand Up @@ -138,7 +130,7 @@ describe("ObjectUtils", () => {
expect(isEmpty(null)).toBe(true);
});

it("should return true when empty string is given", () => {
it("should return true when undefined is given", () => {
expect(isEmpty(undefined)).toBe(true);
});
it("should return false when {} is given", () => {
Expand All @@ -154,11 +146,11 @@ describe("ObjectUtils", () => {
});

describe("isClass()", () => {
it("should return true", () => {
it("should return true when is a class", () => {
expect(isClass(class {})).toBe(true);
});

it("should return true", () => {
it("should return true when is a function", () => {
expect(isClass(function t() {})).toBe(true);
});

Expand Down Expand Up @@ -188,31 +180,31 @@ describe("ObjectUtils", () => {
expect(isPromise(Promise)).toBe(true);
});

it("should return true", () => {
it("should return true when its promise resolved", () => {
expect(isPromise(Promise.resolve())).toBe(true);
});
});

describe("nameOf", () => {
it("should return name when class is given", () => {
it("should return 'Test' when class is given", () => {
expect(nameOf(Test)).toBe("Test");
});
it("should return name when symbol is given", () => {
it("should return 'test2' when symbol is given", () => {
expect(nameOf(sym)).toBe("test2");
});
it("should return name when string is given", () => {
it("should return 'test' when string is given", () => {
expect(nameOf("test")).toBe("test");
});
it("should return name when string is given", () => {
it("should return '1' when string is given", () => {
expect(nameOf(1)).toBe("1");
});
it("should return name when string is given", () => {
it("should return 'true' when boolean is given", () => {
expect(nameOf(true)).toBe("true");
});
it("should return name when null is given", () => {
it("should return 'null' when null is given", () => {
expect(nameOf(null)).toBe("null");
});
it("should return name when undefined is given", () => {
it("should return 'undefined' when undefined is given", () => {
expect(nameOf(undefined)).toBe("undefined");
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/objects/ancestorsOf.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {classOf} from "./classOf.js";
import {getInheritedClass} from "./ancestorOf.js";
import {classOf} from "./classOf.js";
import {nameOf} from "./nameOf.js";

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/objects/deepClone.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {classOf} from "./classOf.js";
import {isDate} from "./isDate.js";
import {isFunction} from "./isFunction.js";
import {isNil} from "./isNil.js";
import {isPrimitive} from "./isPrimitive.js";
import {isSymbol} from "./isSymbol.js";
import {isRegExp} from "./isRegExp.js";
import {classOf} from "./classOf.js";
import {isSymbol} from "./isSymbol.js";

const isBasicType = (source: any) => isNil(source) || isPrimitive(source) || isSymbol(source) || isFunction(source);

Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/utils/objects/deepMerge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ describe("deepMerge", () => {
security: ["o", "o1"]
});
});

it("should merge data", () => {
it("should merge data (2)", () => {
expect(
deepMerge(
{
Expand Down Expand Up @@ -182,8 +181,7 @@ describe("deepMerge", () => {
it("should merge data", () => {
expect(deepMerge(["1", "2", "4"], ["1", "2", "3"])).toEqual(["1", "2", "4", "3"]);
});

it("should merge data", () => {
it("should merge data (2)", () => {
expect(deepMerge([{"1": "1"}, {"2": "2"}, {"4": "4"}], [{"1": "1"}, {"2": "2"}, {"3": "3"}])).toEqual([
{"1": "1"},
{"2": "2"},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/objects/getValue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("getValue()", () => {
expect(getValue("users.0", {users: [{user: {name: "name"}}]})).toEqual({user: {name: "name"}});
expect(getValue({users: [{user: {name: "name"}}]}, "users.0")).toEqual({user: {name: "name"}});
});
it("should return given value when expression is given but scope have value (3)", () => {
it("should return given value when expression is given but scope have value (4)", () => {
const map = new Map([["user", "name"]]);
expect(getValue("user", map)).toEqual("name");
expect(getValue(map, "user")).toEqual("name");
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/objects/isInheritedFrom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {classOf} from "./classOf.js";
import {ancestorOf} from "./ancestorOf.js";
import {classOf} from "./classOf.js";
import {nameOf} from "./nameOf.js";

export function isInheritedFrom(target: any, from: any, deep = 5): boolean {
Expand Down
Loading

0 comments on commit cdf567d

Please sign in to comment.