From 7579d3865f9688730bf8a5387ad1a4836920aa0e Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 9 Jun 2026 08:19:38 +0800 Subject: [PATCH] eslint --- frontend/app/(main)/components/page.tsx | 4 ---- frontend/components/common/admin/files.tsx | 6 +++++- frontend/components/common/docs/api.tsx | 2 +- frontend/components/common/settings/info-tab.tsx | 4 ++-- frontend/components/common/settings/other-tab.tsx | 3 +-- frontend/components/common/settings/profile.tsx | 8 ++++---- .../components/common/settings/security-tab.tsx | 4 ++-- .../components/common/settings/system-settings.tsx | 2 +- frontend/components/common/settings/system-tab.tsx | 4 ++-- frontend/components/home/developer-section.tsx | 2 +- frontend/components/home/hero-section.tsx | 14 +------------- frontend/components/ui/image-crop.tsx | 11 ++++++----- frontend/lib/services/auth/auth.service.ts | 3 ++- frontend/lib/services/core/api-client.ts | 2 +- frontend/scripts/generate-themes.js | 1 + 15 files changed, 30 insertions(+), 40 deletions(-) diff --git a/frontend/app/(main)/components/page.tsx b/frontend/app/(main)/components/page.tsx index 06704944..56ad7f4f 100644 --- a/frontend/app/(main)/components/page.tsx +++ b/frontend/app/(main)/components/page.tsx @@ -13,20 +13,16 @@ import { import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Progress } from "@/components/ui/progress" -import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs" import { Coins, Gift, - Inbox, Layers, Shield, Info, ArrowRight, - Terminal, Activity, User, - ExternalLink, Code2, Copy, Check diff --git a/frontend/components/common/admin/files.tsx b/frontend/components/common/admin/files.tsx index 2e57e298..88731fa7 100644 --- a/frontend/components/common/admin/files.tsx +++ b/frontend/components/common/admin/files.tsx @@ -138,7 +138,11 @@ export function FilesMain() { const toggleSelect = (id: string) => { setSelectedIds((prev) => { const next = new Set(prev) - next.has(id) ? next.delete(id) : next.add(id) + if (next.has(id)) { + next.delete(id) + } else { + next.add(id) + } return next }) } diff --git a/frontend/components/common/docs/api.tsx b/frontend/components/common/docs/api.tsx index 950d4db5..a6fa7f33 100644 --- a/frontend/components/common/docs/api.tsx +++ b/frontend/components/common/docs/api.tsx @@ -40,7 +40,7 @@ export const apiSections: PolicySection[] = [ error_msg string - 错误信息。请求成功时为空字符串 `""`,失败时包含错误详情描述。 + 错误信息。请求成功时为空字符串 `""`,失败时包含错误详情描述。 data diff --git a/frontend/components/common/settings/info-tab.tsx b/frontend/components/common/settings/info-tab.tsx index f50be326..b3d3eb37 100644 --- a/frontend/components/common/settings/info-tab.tsx +++ b/frontend/components/common/settings/info-tab.tsx @@ -38,8 +38,8 @@ export function InfoTab({ systemConfigsLength, authSourcesLength }: InfoTabProps - - + }).dependencies?.next} /> + }).dependencies?.react} /> diff --git a/frontend/components/common/settings/other-tab.tsx b/frontend/components/common/settings/other-tab.tsx index a8777293..fb34dd49 100644 --- a/frontend/components/common/settings/other-tab.tsx +++ b/frontend/components/common/settings/other-tab.tsx @@ -53,10 +53,9 @@ const MENU_GROUPS = [ interface OtherTabProps { configs: Record - systemConfigsQuery: any } -export function OtherTab({ configs, systemConfigsQuery }: OtherTabProps) { +export function OtherTab({ configs }: OtherTabProps) { const queryClient = useQueryClient() const menuDisplayConfig = useMemo(() => { diff --git a/frontend/components/common/settings/profile.tsx b/frontend/components/common/settings/profile.tsx index 4128fc53..627d4b5d 100644 --- a/frontend/components/common/settings/profile.tsx +++ b/frontend/components/common/settings/profile.tsx @@ -92,7 +92,7 @@ export function ProfileMain() { }, [user, isEditDialogOpen]) const changePasswordMutation = useMutation({ - mutationFn: (req: any) => AuthService.changePassword(req), + mutationFn: AuthService.changePassword, onSuccess: () => { toast.success("密码修改成功") setOldPassword("") @@ -122,7 +122,7 @@ export function ProfileMain() { } const updateProfileMutation = useMutation({ - mutationFn: (req: any) => AuthService.updateProfile(req), + mutationFn: AuthService.updateProfile, onSuccess: () => { toast.success("个人信息修改成功") setIsEditDialogOpen(false) @@ -197,8 +197,8 @@ export function ProfileMain() { setIsCropDialogOpen(false) setCropFile(null) toast.success("头像上传成功,点击保存以生效") - } catch (err: any) { - toast.error(err.message || "上传头像失败") + } catch (err) { + toast.error((err as Error).message || "上传头像失败") } } diff --git a/frontend/components/common/settings/security-tab.tsx b/frontend/components/common/settings/security-tab.tsx index 8d10a5c9..4dabf956 100644 --- a/frontend/components/common/settings/security-tab.tsx +++ b/frontend/components/common/settings/security-tab.tsx @@ -1,7 +1,7 @@ "use client" import {useEffect, useState} from "react" -import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query" +import {useMutation, useQuery, useQueryClient, type UseQueryResult} from "@tanstack/react-query" import {Fingerprint, Globe, Loader2, Lock, Mail, Pencil, Plus, Settings, Shield, Trash2, UserPlus} from "lucide-react" import {Button} from "@/components/ui/button" @@ -55,7 +55,7 @@ const SECURITY_KEYS = [ interface SecurityTabProps { configs: Record - systemConfigsQuery: any + systemConfigsQuery: UseQueryResult } export function SecurityTab({ configs, systemConfigsQuery }: SecurityTabProps) { diff --git a/frontend/components/common/settings/system-settings.tsx b/frontend/components/common/settings/system-settings.tsx index 173016fd..4a1c018e 100644 --- a/frontend/components/common/settings/system-settings.tsx +++ b/frontend/components/common/settings/system-settings.tsx @@ -102,7 +102,7 @@ export function SystemSettingsMain() { - + - systemConfigsQuery: any + systemConfigsQuery: UseQueryResult } export function SystemTab({ configs, systemConfigsQuery }: SystemTabProps) { diff --git a/frontend/components/home/developer-section.tsx b/frontend/components/home/developer-section.tsx index d987b869..ac7e2527 100644 --- a/frontend/components/home/developer-section.tsx +++ b/frontend/components/home/developer-section.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { cn } from "@/lib/utils"; import { motion } from "motion/react"; import { Button } from "@/components/ui/button"; -import { Book, Check, Copy, Key, Terminal } from "lucide-react"; +import { Book, Check, Copy, Terminal } from "lucide-react"; export interface DeveloperSectionProps { className?: string; diff --git a/frontend/components/home/hero-section.tsx b/frontend/components/home/hero-section.tsx index 158d7a18..0174b89b 100644 --- a/frontend/components/home/hero-section.tsx +++ b/frontend/components/home/hero-section.tsx @@ -1,10 +1,9 @@ import * as React from "react"; import Link from "next/link"; import { motion } from "motion/react"; -import { ArrowRight, Zap, Shield, Globe, CreditCard, Wallet } from "lucide-react"; +import { ArrowRight, Zap, Shield, Globe, CreditCard } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; -import { CountingNumber } from "@/components/animate-ui/primitives/texts/counting-number"; export interface HeroSectionProps { className?: string; @@ -14,17 +13,6 @@ export interface HeroSectionProps { * Hero Section - 首页 Hero 展示 */ export const HeroSection = React.memo(function HeroSection({ className }: HeroSectionProps) { - const [balance, setBalance] = React.useState(12450.0); - const [income, setIncome] = React.useState(240.0); - - React.useEffect(() => { - const interval = setInterval(() => { - setBalance(Math.random() * (65123.45 - (-65)) + (-65)); - setIncome(Math.random() * (656.56 - (-65.65)) + (-65.65)); - }, 6565); - - return () => clearInterval(interval); - }, []); return (
diff --git a/frontend/components/ui/image-crop.tsx b/frontend/components/ui/image-crop.tsx index 112e1582..d5167353 100644 --- a/frontend/components/ui/image-crop.tsx +++ b/frontend/components/ui/image-crop.tsx @@ -228,6 +228,7 @@ export const ImageCropContent = ({ style, className }: ImageCropContentProps) => {...reactCropProps} > {imgSrc && ( + // eslint-disable-next-line @next/next/no-img-element crop + )}> {children} ) } return ( - ) @@ -293,14 +294,14 @@ export const ImageCropReset = ({ if (asChild) { return ( - + )}> {children} ) } return ( - ) @@ -330,7 +331,7 @@ export const Cropper = ({ onChange={onChange} onComplete={onComplete} onCrop={onCrop} - {...(props as any)} + {...(props as Omit)} > diff --git a/frontend/lib/services/auth/auth.service.ts b/frontend/lib/services/auth/auth.service.ts index 8e1575d6..704391e2 100644 --- a/frontend/lib/services/auth/auth.service.ts +++ b/frontend/lib/services/auth/auth.service.ts @@ -1,3 +1,4 @@ +import type { InternalAxiosRequestConfig } from 'axios'; import {BaseService} from '../core/base.service'; import type { AuthSource, @@ -105,7 +106,7 @@ export class AuthService extends BaseService { } static async login(request: LoginRequest, headers?: Record): Promise { - return this.post('/user/login', request, headers ? { headers } as any : undefined); + return this.post('/user/login', request, headers ? ({ headers } as unknown as InternalAxiosRequestConfig) : undefined); } static async register(request: RegisterRequest): Promise { diff --git a/frontend/lib/services/core/api-client.ts b/frontend/lib/services/core/api-client.ts index be8cda7d..8616c725 100644 --- a/frontend/lib/services/core/api-client.ts +++ b/frontend/lib/services/core/api-client.ts @@ -102,7 +102,7 @@ apiClient.interceptors.response.use( cancelTokens.delete(requestKey); pendingRequests.delete(requestKey); - const resData = response.data as any; + const resData = response.data as ApiError & ApiResponse; if (resData && resData.error_msg) { return Promise.reject(new ApiErrorBase(resData.error_msg)); } diff --git a/frontend/scripts/generate-themes.js b/frontend/scripts/generate-themes.js index 8146c4a5..a0638b56 100644 --- a/frontend/scripts/generate-themes.js +++ b/frontend/scripts/generate-themes.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-require-imports */ const fs = require('fs'); const path = require('path');