From a9f1580aabe26a31fb3778213cb6e9342c996724 Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 27 Sep 2022 15:49:32 +0200 Subject: [PATCH] fixed duplicate imports --- backend/src/api/controllers/result.ts | 3 +-- backend/src/api/routes/index.ts | 11 ++++++++--- frontend/src/ts/controllers/analytics-controller.ts | 8 ++++++-- frontend/src/ts/controllers/chart-controller.ts | 2 ++ frontend/src/ts/index.ts | 1 - frontend/src/ts/popups/mobile-test-config-popup.ts | 3 +-- frontend/src/ts/test/result.ts | 1 + 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/backend/src/api/controllers/result.ts b/backend/src/api/controllers/result.ts index ef7977b79..3ee999874 100644 --- a/backend/src/api/controllers/result.ts +++ b/backend/src/api/controllers/result.ts @@ -36,7 +36,6 @@ import { getDailyLeaderboard } from "../../utils/daily-leaderboards"; import AutoRoleList from "../../constants/auto-roles"; import * as UserDAL from "../../dal/user"; import { buildMonkeyMail } from "../../utils/monkey-mail"; -import { updateStreak } from "../../dal/user"; try { if (anticheatImplemented() === false) throw new Error("undefined"); @@ -371,7 +370,7 @@ export async function addResult( ); } - const streak = await updateStreak(uid, result.timestamp); + const streak = await UserDAL.updateStreak(uid, result.timestamp); const xpGained = await calculateXp( result, diff --git a/backend/src/api/routes/index.ts b/backend/src/api/routes/index.ts index a0aad7b5c..92fe322b5 100644 --- a/backend/src/api/routes/index.ts +++ b/backend/src/api/routes/index.ts @@ -2,7 +2,6 @@ import _ from "lodash"; import psas from "./psas"; import users from "./users"; import { join } from "path"; -import express from "express"; import quotes from "./quotes"; import configs from "./configs"; import results from "./results"; @@ -15,7 +14,13 @@ import addSwaggerMiddlewares from "./swagger"; import { asyncHandler } from "../../middlewares/api-utils"; import { MonkeyResponse } from "../../utils/monkey-response"; import { recordClientVersion } from "../../utils/prometheus"; -import { Application, NextFunction, Response, Router } from "express"; +import { + Application, + NextFunction, + Response, + Router, + static as expressStatic, +} from "express"; const pathOverride = process.env.API_PATH_OVERRIDE; const BASE_ROUTE = pathOverride ? `/${pathOverride}` : ""; @@ -41,7 +46,7 @@ function addApiRoutes(app: Application): void { app.use("/configuration", configuration); if (process.env.MODE === "dev") { - app.use("/configure", express.static(join(__dirname, "../../../private"))); + app.use("/configure", expressStatic(join(__dirname, "../../../private"))); } addSwaggerMiddlewares(app); diff --git a/frontend/src/ts/controllers/analytics-controller.ts b/frontend/src/ts/controllers/analytics-controller.ts index e5cc67fc3..5847b6626 100644 --- a/frontend/src/ts/controllers/analytics-controller.ts +++ b/frontend/src/ts/controllers/analytics-controller.ts @@ -1,5 +1,9 @@ -import { Analytics as AnalyticsType, getAnalytics } from "firebase/analytics"; -import { logEvent, setAnalyticsCollectionEnabled } from "firebase/analytics"; +import { + Analytics as AnalyticsType, + getAnalytics, + logEvent, + setAnalyticsCollectionEnabled, +} from "firebase/analytics"; import { app as firebaseApp } from "../firebase"; export let Analytics: AnalyticsType; diff --git a/frontend/src/ts/controllers/chart-controller.ts b/frontend/src/ts/controllers/chart-controller.ts index 90271b9c1..6777815b0 100644 --- a/frontend/src/ts/controllers/chart-controller.ts +++ b/frontend/src/ts/controllers/chart-controller.ts @@ -48,6 +48,7 @@ import * as ConfigEvent from "../observables/config-event"; import format from "date-fns/format"; import "chartjs-adapter-date-fns"; +// eslint-disable-next-line no-duplicate-imports -- need to ignore because eslint doesnt know what import type is import type { AnimationSpec, CartesianScaleOptions, @@ -59,6 +60,7 @@ import type { ScaleChartOptions, } from "chart.js"; +// eslint-disable-next-line no-duplicate-imports -- need to ignore because eslint doesnt know what import type is import type { AnnotationOptions, LabelOptions, diff --git a/frontend/src/ts/index.ts b/frontend/src/ts/index.ts index 07e05187a..50e4a086c 100644 --- a/frontend/src/ts/index.ts +++ b/frontend/src/ts/index.ts @@ -18,7 +18,6 @@ import "./test/caps-warning"; import "./popups/support-popup"; import "./popups/contact-popup"; import "./popups/version-popup"; -import "./popups/video-ad-popup"; import "./popups/edit-preset-popup"; import "./popups/simple-popups"; import "./controllers/input-controller"; diff --git a/frontend/src/ts/popups/mobile-test-config-popup.ts b/frontend/src/ts/popups/mobile-test-config-popup.ts index 518ca8434..15b3b4a2c 100644 --- a/frontend/src/ts/popups/mobile-test-config-popup.ts +++ b/frontend/src/ts/popups/mobile-test-config-popup.ts @@ -1,6 +1,5 @@ import * as TestLogic from "../test/test-logic"; -import Config from "../config"; -import * as UpdateConfig from "../config"; +import Config, * as UpdateConfig from "../config"; import * as ManualRestart from "../test/manual-restart-tracker"; import * as CustomWordAmountPopup from "./custom-word-amount-popup"; import * as CustomTestDurationPopup from "./custom-test-duration-popup"; diff --git a/frontend/src/ts/test/result.ts b/frontend/src/ts/test/result.ts index 675877fd0..84c51e0bc 100644 --- a/frontend/src/ts/test/result.ts +++ b/frontend/src/ts/test/result.ts @@ -19,6 +19,7 @@ import * as TestConfig from "./test-config"; import { Chart } from "chart.js"; import { Auth } from "../firebase"; +// eslint-disable-next-line no-duplicate-imports -- need to ignore because eslint doesnt know what import type is import type { PluginChartOptions, ScaleChartOptions } from "chart.js"; import type { AnnotationOptions } from "chartjs-plugin-annotation"; import Ape from "../ape";