fix: resolve all eslint errors (set-state-in-effect, nested components, no-explicit-any)

- Wrap synchronous setState calls in useEffect with startTransition to avoid cascading renders
- Convert nested SortIcon components to renderSortIcon helper functions
- Replace all `any` types with proper interfaces (OverviewData, TrendPoint, RankItem)
- Remove unused formatTokens import in logs page
- Add no-any rule to CLAUDE.md
This commit is contained in:
2026-04-07 15:19:10 +08:00
parent 8b91aa3e97
commit 20a3d399d9
7 changed files with 62 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
"use client";
import { createContext, useContext, useState, useEffect, type ReactNode } from "react";
import { createContext, useContext, useState, useEffect, startTransition, type ReactNode } from "react";
export type Locale = "zh" | "en";
@@ -195,7 +195,9 @@ export function I18nProvider({ children }: { children: ReactNode }) {
useEffect(() => {
const saved = localStorage.getItem("locale") as Locale | null;
if (saved && (saved === "zh" || saved === "en")) setLocale(saved);
if (saved && (saved === "zh" || saved === "en")) {
startTransition(() => setLocale(saved));
}
}, []);
const handleSetLocale = (l: Locale) => {