fix(react,eslint-config): resolve false-positive lint warnings - #304
Open
ygd58 wants to merge 2 commits into
Open
fix(react,eslint-config): resolve false-positive lint warnings#304ygd58 wants to merge 2 commits into
ygd58 wants to merge 2 commits into
Conversation
- 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.
|
@ygd58 is attempting to deploy a commit to the Fhenix Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: f4d904f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes several false-positive ESLint warnings in
@cofhe/reactby addressing their root cause in the shared@cofhe/eslint-configpackage rather than suppressing them file-by-file:globalThisno-undef —react-internal.js'senvonly setbrowser: true, so ESLint did not recognizeglobalThiseven though the package targetses2020+ at runtime. Addedes2021: true.while (true)polling loops flagged asno-constant-condition— two utilities (resolveReceiptBlockHash.ts,waitUntilRpcAwareAndReadContract.ts) usewhile (true)with an internal abort-signal check rather than a loop condition. SetcheckLoops: falsefor this rule.Reactno-redeclare in two test files —ssr.test.tsxandQueryProvider.test.tsxhad an unusedimport 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'sReact: trueglobal. Removed the unused import (verifiedReact.*is never referenced in either file, and both files' tests still pass).useMemodependency —ShieldPageV2.tsxlistedtokenas a dependency of auseMemowhose body never references it.Warnings in
@cofhe/reactgo from 9 to 1. The remaining warning (TransactionActionType's intentional dual type/value declaration being flagged by the baseno-redeclarerule) 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.