From 4e5c99aafeadc2ea6dd785f093beaed4ea41583f Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 20 Nov 2024 09:57:16 +0530 Subject: [PATCH] Prune --- web/packages/shared/components/OverflowMenu/context.tsx | 1 + web/packages/shared/eslint.config.mjs | 8 -------- web/packages/shared/network/HTTPService.ts | 8 ++------ web/packages/shared/network/cast.ts | 3 +-- web/packages/shared/storage/localStorage/index.ts | 2 ++ web/packages/shared/themes/mui-theme.d.ts | 2 +- web/packages/shared/user/index.ts | 2 +- 7 files changed, 8 insertions(+), 18 deletions(-) diff --git a/web/packages/shared/components/OverflowMenu/context.tsx b/web/packages/shared/components/OverflowMenu/context.tsx index 79e289852e..2908703e3d 100644 --- a/web/packages/shared/components/OverflowMenu/context.tsx +++ b/web/packages/shared/components/OverflowMenu/context.tsx @@ -1,5 +1,6 @@ import { createContext } from "react"; export const OverflowMenuContext = createContext({ + // eslint-disable-next-line @typescript-eslint/no-empty-function close: () => {}, }); diff --git a/web/packages/shared/eslint.config.mjs b/web/packages/shared/eslint.config.mjs index 5897b2d378..d074d7e3c8 100644 --- a/web/packages/shared/eslint.config.mjs +++ b/web/packages/shared/eslint.config.mjs @@ -22,16 +22,8 @@ export default [ "@typescript-eslint/no-floating-promises": "off", "@typescript-eslint/no-unsafe-enum-comparison": "off", "@typescript-eslint/no-unnecessary-type-assertion": "off", - "@typescript-eslint/array-type": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-unnecessary-template-expression": "off", - "@typescript-eslint/consistent-indexed-object-style": "off", "@typescript-eslint/prefer-promise-reject-errors": "off", - "@typescript-eslint/no-useless-constructor": "off", "react-hooks/exhaustive-deps": "off", - /** TODO: New during eslint 8=>9 migration */ - "@typescript-eslint/no-unused-expressions": "off", - "@typescript-eslint/no-unused-vars": "off", }, }, ]; diff --git a/web/packages/shared/network/HTTPService.ts b/web/packages/shared/network/HTTPService.ts index 42124af65f..474728de08 100644 --- a/web/packages/shared/network/HTTPService.ts +++ b/web/packages/shared/network/HTTPService.ts @@ -2,13 +2,9 @@ import log from "@/base/log"; import axios, { type AxiosRequestConfig, type AxiosResponse } from "axios"; import { ApiError, isApiErrorResponse } from "../error"; -interface IHTTPHeaders { - [headerKey: string]: any; -} +type IHTTPHeaders = Record; -interface IQueryPrams { - [paramName: string]: any; -} +type IQueryPrams = Record; /** * Service to manage all HTTP calls. diff --git a/web/packages/shared/network/cast.ts b/web/packages/shared/network/cast.ts index b1b1ae7099..226696371f 100644 --- a/web/packages/shared/network/cast.ts +++ b/web/packages/shared/network/cast.ts @@ -5,8 +5,6 @@ import { getToken } from "../storage/localStorage/helpers"; import HTTPService from "./HTTPService"; class CastGateway { - constructor() {} - public async getCastData(code: string): Promise { let resp; try { @@ -78,6 +76,7 @@ class CastGateway { await HTTPService.post( await apiURL("/cast/cast-data/"), { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-template-expression deviceCode: `${code}`, encPayload: castPayload, collectionID: collectionID, diff --git a/web/packages/shared/storage/localStorage/index.ts b/web/packages/shared/storage/localStorage/index.ts index 31553908f1..83c3379930 100644 --- a/web/packages/shared/storage/localStorage/index.ts +++ b/web/packages/shared/storage/localStorage/index.ts @@ -75,6 +75,7 @@ export const migrateKVToken = async (user: unknown) => { typeof oldLSUser.token == "string" && !(await getKVS("token")); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions user && typeof user == "object" && "id" in user && @@ -82,6 +83,7 @@ export const migrateKVToken = async (user: unknown) => { ? await setKV("userID", user.id) : await removeKV("userID"); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions user && typeof user == "object" && "token" in user && diff --git a/web/packages/shared/themes/mui-theme.d.ts b/web/packages/shared/themes/mui-theme.d.ts index 639ee286b2..e852b6b309 100644 --- a/web/packages/shared/themes/mui-theme.d.ts +++ b/web/packages/shared/themes/mui-theme.d.ts @@ -200,6 +200,6 @@ declare module "@mui/material/styles" { faint: number; } - type AvatarColors = Array; + type AvatarColors = string[]; } export {}; diff --git a/web/packages/shared/user/index.ts b/web/packages/shared/user/index.ts index d23370f2c0..a5a4a79070 100644 --- a/web/packages/shared/user/index.ts +++ b/web/packages/shared/user/index.ts @@ -16,7 +16,7 @@ export const getActualKey = async () => { encryptionKeyAttributes.key, ); return key; - } catch (e) { + } catch { throw new Error(CustomError.KEY_MISSING); } };