From c747f4548ed8e25cf3a37ba915aa17cc4d804d55 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 4 Jan 2025 18:31:20 +0800 Subject: [PATCH] :rotating_light: Fixes and disables eslint rules --- eslint.config.mjs | 27 ++++++++++++------- src/components/auth/SnLoginRouter.tsx | 2 +- .../api/well-known/openid-configuration.ts | 2 +- src/pages/flow/accounts/confirm.tsx | 2 +- src/pages/posts/index.tsx | 4 +-- src/pages/users/[name].tsx | 2 +- src/services/network.ts | 2 +- 7 files changed, 25 insertions(+), 16 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index c85fb67..90d5fac 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,16 +1,25 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { FlatCompat } from '@eslint/eslintrc' -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) const compat = new FlatCompat({ baseDirectory: __dirname, -}); +}) const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; + ...compat.extends('next/core-web-vitals', 'next/typescript'), + { + rules: { + '@typescript-eslint/no-explicit-any': 'off', + 'react-hooks/rules-of-hooks': 'off', + 'react-hooks/exhaustive-deps': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@next/next/no-img-element': 'off', + }, + }, +] -export default eslintConfig; +export default eslintConfig diff --git a/src/components/auth/SnLoginRouter.tsx b/src/components/auth/SnLoginRouter.tsx index cd83b9d..68f4ec3 100644 --- a/src/components/auth/SnLoginRouter.tsx +++ b/src/components/auth/SnLoginRouter.tsx @@ -18,7 +18,7 @@ export function SnLoginRouter({ factorList: SnAuthFactor[] onNext: (val: SnAuthFactor) => void }) { - const factorTypeIcons = [, ] + const factorTypeIcons = [, ] const factorTypeLabels = ['Password', 'Email verification code'] const [error, setError] = useState(null) diff --git a/src/pages/api/well-known/openid-configuration.ts b/src/pages/api/well-known/openid-configuration.ts index 35372ad..7cf2422 100644 --- a/src/pages/api/well-known/openid-configuration.ts +++ b/src/pages/api/well-known/openid-configuration.ts @@ -11,7 +11,7 @@ export default async function handler(_: NextApiRequest, res: NextApiResponse) { out['authorization_endpoint'] = siteUrl + '/auth/authorize' out['jwks_uri'] = siteUrl + '/.well-known/jwks' - for (let [k, v] of Object.entries(out)) { + for (const [k, v] of Object.entries(out)) { if (typeof v === 'string') { if (v.startsWith('https://id.solsynth.dev/api')) { out[k] = v.replace('https://id.solsynth.dev/api', solarNetworkApi + '/cgi/id') diff --git a/src/pages/flow/accounts/confirm.tsx b/src/pages/flow/accounts/confirm.tsx index 79bdff3..ea05301 100644 --- a/src/pages/flow/accounts/confirm.tsx +++ b/src/pages/flow/accounts/confirm.tsx @@ -61,7 +61,7 @@ export default function AccountConfirm() { className="animate__animated animate__flash animate__infinite" style={{ '--animate-duration': '3s' } as any} > - Hold on a moment, we're working on it... + Hold on a moment, we're working on it... )} diff --git a/src/pages/posts/index.tsx b/src/pages/posts/index.tsx index 86f0a58..05ea429 100644 --- a/src/pages/posts/index.tsx +++ b/src/pages/posts/index.tsx @@ -29,9 +29,9 @@ export const getServerSideProps = (async (context) => { }, }) - let posts: SnPostWithAttachments[] = resp.data as SnPostWithAttachments[] + const posts: SnPostWithAttachments[] = resp.data as SnPostWithAttachments[] for (let idx = 0; idx < posts.length; idx++) { - let post = posts[idx] + const post = posts[idx] if (post.body.content) { let processor: any = unified().use(remarkParse) if (post.type != 'article') { diff --git a/src/pages/users/[name].tsx b/src/pages/users/[name].tsx index fe20da2..015ee89 100644 --- a/src/pages/users/[name].tsx +++ b/src/pages/users/[name].tsx @@ -107,7 +107,7 @@ export default function UserProfile({ user, checkIn }: InferGetServerSidePropsTy {user.badges.map((b) => ( - + {SnAccountBadgeMapping[b.type].icon} {SnAccountBadgeMapping[b.type].name} diff --git a/src/services/network.ts b/src/services/network.ts index 098c7d5..1fa2267 100644 --- a/src/services/network.ts +++ b/src/services/network.ts @@ -4,7 +4,7 @@ import { hasCookie, getCookie, setCookie } from 'cookies-next/client' const baseURL = 'https://api.sn.solsynth.dev' -export let sni: AxiosInstance = (() => { +export const sni: AxiosInstance = (() => { const inst = axios.create({ baseURL, })