From ed9ab34f283f0faf3039dc1c3e30d83a80322e72 Mon Sep 17 00:00:00 2001 From: zkldi Date: Thu, 26 Aug 2021 14:01:23 +0100 Subject: [PATCH] Fix linter errors --- server/src/external/mongo/db.ts | 2 ++ server/src/external/redis/redis-IPC.test.ts | 2 +- .../import-types/api/arc-iidx/class-handler.ts | 1 - .../lib/score-import/import-types/api/eag-sdvx/parser.ts | 2 +- .../lib/score-import/import-types/api/flo-sdvx/parser.ts | 2 +- .../import-types/common/batch-manual/converter.test.ts | 7 ++----- .../lib/score-import/import-types/ir/usc/parser.test.ts | 2 +- server/src/lib/search/search.test.ts | 1 + server/src/server/middleware/rate-limiter.ts | 1 + .../users/_userID/games/_game/_playtype/router.test.ts | 9 +-------- server/src/utils/misc.ts | 4 ++-- 11 files changed, 13 insertions(+), 20 deletions(-) diff --git a/server/src/external/mongo/db.ts b/server/src/external/mongo/db.ts index fd645830a..3d12db6ee 100644 --- a/server/src/external/mongo/db.ts +++ b/server/src/external/mongo/db.ts @@ -81,6 +81,8 @@ const RemoveIDMiddleware: TMiddleware = return next(args, method); }; +// a bug in monks types means that :any has to be used here. Maybe we'll make a PR for this? +// eslint-disable-next-line @typescript-eslint/no-explicit-any const StripIDMiddleware: TMiddleware = () => (next) => (args: any, method) => { if (method === "insert") { if (Array.isArray(args.data)) { diff --git a/server/src/external/redis/redis-IPC.test.ts b/server/src/external/redis/redis-IPC.test.ts index 542f42b2d..45d0ea9d4 100644 --- a/server/src/external/redis/redis-IPC.test.ts +++ b/server/src/external/redis/redis-IPC.test.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import t from "tap"; -import { CloseRedisPubSub, RedisPub, RedisSub } from "./redis-IPC"; +import { RedisPub, RedisSub } from "./redis-IPC"; t.test("Basic PUB/SUB testing", (t) => { t.setTimeout(2000); diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts b/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts index 07e39b6e7..da53d180d 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts @@ -4,7 +4,6 @@ import { IIDXDans } from "lib/constants/classes"; import { ClassHandler } from "../../../framework/user-game-stats/types"; import { ServerConfig } from "lib/setup/config"; import { CreateURLWithParams } from "utils/url"; -import { profile } from "console"; export async function CreateArcIIDXClassHandler( profileID: string, diff --git a/server/src/lib/score-import/import-types/api/eag-sdvx/parser.ts b/server/src/lib/score-import/import-types/api/eag-sdvx/parser.ts index 474f98d48..cb3379d4e 100644 --- a/server/src/lib/score-import/import-types/api/eag-sdvx/parser.ts +++ b/server/src/lib/score-import/import-types/api/eag-sdvx/parser.ts @@ -1,5 +1,5 @@ import { KtLogger } from "lib/logger/logger"; -import { integer, KaiAuthDocument } from "tachi-common"; +import { integer } from "tachi-common"; import { GetKaiAuthGuaranteed } from "utils/queries/auth"; import { ParseKaiSDVX } from "../../common/api-kai/sdvx/parser"; diff --git a/server/src/lib/score-import/import-types/api/flo-sdvx/parser.ts b/server/src/lib/score-import/import-types/api/flo-sdvx/parser.ts index d612f8c6a..def28c295 100644 --- a/server/src/lib/score-import/import-types/api/flo-sdvx/parser.ts +++ b/server/src/lib/score-import/import-types/api/flo-sdvx/parser.ts @@ -1,5 +1,5 @@ import { KtLogger } from "lib/logger/logger"; -import { integer, KaiAuthDocument } from "tachi-common"; +import { integer } from "tachi-common"; import { GetKaiAuthGuaranteed } from "utils/queries/auth"; import { ParseKaiSDVX } from "../../common/api-kai/sdvx/parser"; diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts index 5f7bd7042..5cd41ae51 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts @@ -4,12 +4,9 @@ import { GetKTDataJSON, Testing511Song, Testing511SPA } from "test-utils/test-da import { ResolveChartFromSong, ResolveMatchTypeToKTData, ConverterBatchManual } from "./converter"; import deepmerge from "deepmerge"; import { EscapeStringRegexp } from "utils/misc"; -import { Game, ImportTypes } from "tachi-common"; +import { Game } from "tachi-common"; import ResetDBState from "test-utils/resets"; -import { - InvalidScoreFailure, - KTDataNotFoundFailure, -} from "../../../framework/common/converter-failures"; +import { InvalidScoreFailure } from "../../../framework/common/converter-failures"; import { BatchManualContext } from "./types"; diff --git a/server/src/lib/score-import/import-types/ir/usc/parser.test.ts b/server/src/lib/score-import/import-types/ir/usc/parser.test.ts index 84ff2b483..fcef0281a 100644 --- a/server/src/lib/score-import/import-types/ir/usc/parser.test.ts +++ b/server/src/lib/score-import/import-types/ir/usc/parser.test.ts @@ -29,7 +29,7 @@ t.test("#ParseIRUSC", (t) => { t.throws(() => ParseIRUSC({}, uscChart, logger), { statusCode: 400, message: /invalid usc score/iu, - } as any); + }); t.end(); }); diff --git a/server/src/lib/search/search.test.ts b/server/src/lib/search/search.test.ts index a6cb459b2..41def8b3b 100644 --- a/server/src/lib/search/search.test.ts +++ b/server/src/lib/search/search.test.ts @@ -16,6 +16,7 @@ t.test("#SearchGameSongs", (t) => { artist: "text", "alt-titles": "text", "search-titles": "text", + // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any /* known bug with monk */ ); }); diff --git a/server/src/server/middleware/rate-limiter.ts b/server/src/server/middleware/rate-limiter.ts index b98af728d..68ac6eead 100644 --- a/server/src/server/middleware/rate-limiter.ts +++ b/server/src/server/middleware/rate-limiter.ts @@ -30,5 +30,6 @@ export const RateLimitMiddleware = rateLimit({ message: { success: false, description: `You have exceeded ${ServerConfig.RATE_LIMIT} requests per minute. Please wait.`, + // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any, // @todo #170 report this as a bug with rate-limit types., }); diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts index 657c26ede..0f3297c9d 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts @@ -10,14 +10,7 @@ import { MilestoneDocument, UserMilestoneDocument, } from "tachi-common"; -import { - GetKTDataJSON, - LoadTachiIIDXData, - Testing511Song, - Testing511SPA, - TestingIIDXSPScore, - TestingIIDXSPScorePB, -} from "test-utils/test-data"; +import { Testing511SPA, TestingIIDXSPScore, TestingIIDXSPScorePB } from "test-utils/test-data"; import deepmerge from "deepmerge"; t.test("GET /api/v1/users/:userID/games/:game/:playtype", (t) => { diff --git a/server/src/utils/misc.ts b/server/src/utils/misc.ts index 402e7a3ed..9156b3f8f 100644 --- a/server/src/utils/misc.ts +++ b/server/src/utils/misc.ts @@ -1,5 +1,5 @@ import crypto from "crypto"; -import { ServerConfig, ServerTypeInfo } from "lib/setup/config"; +import { ServerTypeInfo } from "lib/setup/config"; import { Game, Playtypes, GetGameConfig } from "tachi-common"; // https://github.com/sindresorhus/escape-string-regexp/blob/main/index.js @@ -89,7 +89,7 @@ export function StripUrl(url: string, userInput: string | null) { return userInput; } -export function DeleteUndefinedProps(record: any) { +export function DeleteUndefinedProps(record: Record) { for (const key in record) { if (record[key] === undefined) { delete record[key];