Merged in chore/eslint9 (pull request #2029)

chore: Update to ESLint 9

* wip: apply codemod and upgrade swc plugin

* Update eslint to 9 in scandic-web

apply code mod to config
fix existing lint issues

* Remove uneccessary fixupConfigRules

* Update eslint to 9 in design-system

* Add lint turbo dependency

* Move redis-api to eslint and prettier instead of biome

* Simplify eslint configs

* Clean up

* Apply linting


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-06-03 14:26:44 +00:00
parent 91278feb40
commit dd4ef527df
37 changed files with 858 additions and 497 deletions
+10 -10
View File
@@ -1,11 +1,11 @@
import * as Sentry from "@sentry/bun";
import { Elysia, t } from "elysia";
import { redis } from "@/services/redis";
import { ModelValidationError } from "@/errors/ModelValidationError";
import { redis } from "@/services/redis";
import { loggerModule } from "@/utils/logger";
import { truncate } from "@/utils/truncate";
import { timeout } from "@/utils/timeout";
import { truncate } from "@/utils/truncate";
const MIN_LENGTH = 1;
@@ -42,7 +42,7 @@ export const cacheRoutes = new Elysia({ prefix: "/cache" })
{
query: QUERY_TYPE,
response: { 200: t.Object({ data: t.Any() }), 404: t.String() },
}
},
)
.put(
"/",
@@ -52,7 +52,7 @@ export const cacheRoutes = new Elysia({ prefix: "/cache" })
if (!body.ttl || body.ttl < 0) {
cacheRouteLogger.warn(
`PUT /cache ${key} with ttl=${body.ttl}, will not cache the data`
`PUT /cache ${key} with ttl=${body.ttl}, will not cache the data`,
);
return status("Bad Request", "ttl is required");
}
@@ -66,14 +66,14 @@ export const cacheRoutes = new Elysia({ prefix: "/cache" })
body: t.Object({ data: t.Any(), ttl: t.Number() }),
query: QUERY_TYPE,
response: { 204: t.Undefined(), 400: t.String() },
}
},
)
.delete(
"/",
async ({ query: { key, fuzzy } }) => {
key = validateKey(key);
cacheRouteLogger.debug(
`DELETE /cache ${key} ${fuzzy ? "fuzzy" : ""}`
`DELETE /cache ${key} ${fuzzy ? "fuzzy" : ""}`,
);
const deletedKeys: number = fuzzy
? await deleteWithPattern(`*${key}*`)
@@ -91,7 +91,7 @@ export const cacheRoutes = new Elysia({ prefix: "/cache" })
200: t.Object({ deletedKeys: t.Number() }),
400: t.String(),
},
}
},
);
function validateKey(key: string) {
@@ -99,7 +99,7 @@ function validateKey(key: string) {
if (parsedKey.length < MIN_LENGTH) {
throw new ModelValidationError(
"Key has to be at least 1 character long"
"Key has to be at least 1 character long",
);
}
@@ -122,7 +122,7 @@ async function deleteWithPattern(pattern: string) {
"MATCH",
pattern,
"COUNT",
SCAN_SIZE
SCAN_SIZE,
);
cursor = newCursor;
+3 -1
View File
@@ -1,7 +1,9 @@
import { Elysia } from "elysia";
import { cacheRoutes } from "./cache";
import { apiKeyMiddleware } from "@/middleware/apiKeyMiddleware";
import { cacheRoutes } from "./cache";
export const apiRoutes = new Elysia({ prefix: "/api" })
.guard({ beforeHandle: apiKeyMiddleware })
.use(cacheRoutes);
+3 -3
View File
@@ -1,8 +1,8 @@
import Elysia, { t } from "elysia";
import { redis } from "@/services/redis";
import { baseLogger, loggerModule } from "@/utils/logger";
import { env } from "@/env";
import { redis } from "@/services/redis";
import { baseLogger } from "@/utils/logger";
const healthLogger = baseLogger.child({
module: "health",
@@ -52,5 +52,5 @@ export const healthRoutes = new Elysia().get(
duration: t.String(),
}),
},
}
},
);