Skip to content

fix(react,eslint-config): resolve false-positive lint warnings - #304

Open
ygd58 wants to merge 2 commits into
FhenixProtocol:masterfrom
ygd58:fix/eslint-config-false-positives
Open

fix(react,eslint-config): resolve false-positive lint warnings#304
ygd58 wants to merge 2 commits into
FhenixProtocol:masterfrom
ygd58:fix/eslint-config-false-positives

Conversation

@ygd58

@ygd58 ygd58 commented Aug 6, 2026

Copy link
Copy Markdown

Fixes several false-positive ESLint warnings in @cofhe/react by addressing their root cause in the shared @cofhe/eslint-config package rather than suppressing them file-by-file:

  • globalThis no-undefreact-internal.js's env only set browser: true, so ESLint did not recognize globalThis even though the package targets es2020+ at runtime. Added es2021: true.
  • Intentional while (true) polling loops flagged as no-constant-condition — two utilities (resolveReceiptBlockHash.ts, waitUntilRpcAwareAndReadContract.ts) use while (true) with an internal abort-signal check rather than a loop condition. Set checkLoops: false for this rule.
  • React no-redeclare in two test filesssr.test.tsx and QueryProvider.test.tsx had an unused import React from 'react'. The project uses the automatic JSX runtime (jsx: react-jsx), so the import was dead code, and it collided with the config's React: true global. Removed the unused import (verified React.* is never referenced in either file, and both files' tests still pass).
  • Unnecessary useMemo dependencyShieldPageV2.tsx listed token as a dependency of a useMemo whose body never references it.

Warnings in @cofhe/react go from 9 to 1. The remaining warning (TransactionActionType's intentional dual type/value declaration being flagged by the base no-redeclare rule) needs @typescript-eslint's type-aware version of the rule, which is a bigger, separate change — left as a possible follow-up to keep this PR scoped and low-risk.

Verified locally: pnpm lint, pnpm check:types, pnpm check:formatting, and the two affected test files (vitest run) all pass.

- react-internal.js: add es2021 to env so globalThis is recognized
  (globalThis is already used at runtime and in the ts lib target,
  ESLint's env just wasn't configured to know about it).
- react-internal.js: set no-constant-condition's checkLoops to false
  so intentional `while (true)` polling loops (with internal
  abort-signal checks) aren't flagged.
- ssr.test.tsx / QueryProvider.test.tsx: remove unused
  `import React from 'react'` - the project uses the automatic JSX
  runtime (jsx: react-jsx) so this import isn't needed, and React.*
  is never referenced in either file. Combined with the config's
  `React: true` global, the unused import was also triggering a
  spurious no-redeclare warning.
- ShieldPageV2.tsx: remove unused `token` dependency from a useMemo
  whose body never references it.

Reduces @cofhe/react lint warnings from 9 to 1 (the remaining
warning, TransactionActionType's dual type/value declaration being
flagged by the base no-redeclare rule, needs @typescript-eslint's
plugin-aware version of the rule and is left as a follow-up to keep
this change scoped).

Verified: pnpm lint, pnpm check:types, pnpm check:formatting, and
the affected test files all pass.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

@ygd58 is attempting to deploy a commit to the Fhenix Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f4d904f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cofhe/eslint-config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant