fix: resolve ESLint warnings and errors in web frontend

Fixed all linting issues reported by ESLint:

Errors fixed:
- InitializeUsdtModal.tsx: Removed unused imports (ASSET_IDS, ASSET_CONFIGS)

Warnings fixed:
- DashboardContext.tsx: Wrapped fetchProfile and fetchScoresAndTikis in useCallback
- PolkadotContext.tsx: Added eslint-disable for api cleanup (initialization pattern)
- WalletContext.tsx: Added updateBalance to useEffect dependencies
- WebSocketContext.tsx: Moved ENDPOINTS constant outside component
- useForum.ts: Added eslint-disable for mount-only effect
- Dashboard.tsx: Wrapped fetchProfile and fetchScoresAndTikis in useCallback
- ProfileSettings.tsx: Wrapped loadProfile in useCallback (also fixed missing data destructuring)
- CitizensIssues.tsx: Added eslint-disable for complex fetch pattern

All React Hook exhaustive-deps warnings resolved with proper useCallback wrapping
or appropriate eslint-disable comments where patterns are intentional.
This commit is contained in:
Claude
2025-11-21 12:53:41 +00:00
parent cd684d4865
commit 49c6b6f5f7
9 changed files with 53 additions and 52 deletions
+8 -8
View File
@@ -17,6 +17,13 @@ interface WebSocketContextType {
const WebSocketContext = createContext<WebSocketContextType | null>(null);
const ENDPOINTS = [
'ws://localhost:8082', // Local Vite dev server
'ws://127.0.0.1:9944', // Local development node (primary)
'ws://localhost:9944', // Local development node (alternative)
'wss://ws.pezkuwichain.io', // Production WebSocket (fallback)
];
export const useWebSocket = () => {
const context = useContext(WebSocketContext);
if (!context) {
@@ -31,18 +38,11 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
const reconnectTimeout = useRef<NodeJS.Timeout>();
const eventListeners = useRef<Map<string, Set<(data: Record<string, unknown>) => void>>>(new Map());
const { toast } = useToast();
// Connection state management
const currentEndpoint = useRef<string>('');
const hasShownFinalError = useRef(false);
const connectionAttempts = useRef(0);
const ENDPOINTS = [
'ws://localhost:8082', // Local Vite dev server
'ws://127.0.0.1:9944', // Local development node (primary)
'ws://localhost:9944', // Local development node (alternative)
'wss://ws.pezkuwichain.io', // Production WebSocket (fallback)
];
const connect = useCallback((endpointIndex: number = 0) => {
// If we've tried all endpoints, show error once and stop