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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user