Skip to content

Frontend ESLint errors: 159 issues across 20 files #313

@Mosas2000

Description

@Mosas2000

Summary

During project health check, running npm run lint in the frontend directory revealed 159 errors and 4 warnings across 20 files.

Categories of Errors

Critical Issues (Production Code)

  1. Undefined variables in utility code

    • src/utils/stacks.js:134: getMainnetAddress is not defined
    • vite.config.js:96: __dirname is not defined (ES module context)
  2. Unused imports and variables (11 instances)

    • AdminDashboard.jsx: unused Icon
    • RecentTips.jsx: unused fetchTipMessages
    • SendTip.jsx: unused isContractPrincipal, recipientWarning
    • TelemetryDashboard.jsx: unused Icon
    • TipHistory.jsx: unused useMemo
    • TipContext.jsx: unused clearPageCache
    • contracts.js: 4 unused validation imports
  3. React Hooks violations

    • PlatformStats.jsx:36: setState called synchronously in useEffect
    • tx-status.jsx:97: setState called synchronously in useEffect
    • useFeedConnectionStatus.js:19: impure function Date.now called during render
    • ProfileManager.jsx:47: missing dependency in useEffect
    • useCachedData.js: ref cleanup and missing dependencies
  4. Fast refresh violations (6 instances)

    • Context files exporting non-components alongside contexts

Test File Issues (72 errors)

  • global is not defined in test files (needs eslint config for test environment)
  • process is not defined in Node.js scripts (needs eslint config for Node environment)
  • afterEach/beforeEach not defined in some test files

Reproduction

cd frontend
npm run lint

Expected Behavior

npm run lint should pass with no errors.

Proposed Fix

  1. Fix production code issues (undefined variables, unused imports, React hooks)
  2. Update ESLint config to recognize test globals (global, describe, it, etc.)
  3. Update ESLint config to recognize Node.js globals in scripts directory
  4. Refactor context files to separate hooks from context definitions

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions