Add @tanstack/eslint-plugin-query and update @typescript-eslint/eslint-plugin#2125
Add @tanstack/eslint-plugin-query and update @typescript-eslint/eslint-plugin#2125jeesunikim wants to merge 8 commits into
@tanstack/eslint-plugin-query and update @typescript-eslint/eslint-plugin#2125Conversation
…eslint Add @tanstack/eslint-plugin-query as a devDependency. It requires @typescript-eslint/utils ^8.58.1, which would otherwise pull a second @typescript-eslint tree (8.62) alongside the existing 8.43 used by eslint-config-next. Align the family on a single 8.62.0 version by bumping @typescript-eslint/eslint-plugin and adding a matching parser, so the lockfile resolves to one tree instead of two. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Enable plugin:@tanstack/query/recommended in the ESLint config and fix the 19 exhaustive-deps violations it surfaces. Each affected hook read values in its queryFn (most commonly headers, plus url/passphrase/asset/count inputs) that were absent from its queryKey, so distinct inputs could collide on one cache entry and return stale data. Add the missing values to every queryKey. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fix the "arrowParens:" key (stray colon meant Prettier silently ignored it) and rename the deprecated jsxBracketSameLine to bracketSameLine. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates the linting toolchain (adds TanStack Query ESLint rules and bumps @typescript-eslint/*) and adjusts React Query queryKeys across the codebase so cached results correctly vary by inputs like headers, URLs, and other request parameters.
Changes:
- Add
@tanstack/eslint-plugin-queryand enableplugin:@tanstack/query/recommendedin ESLint config. - Upgrade
@typescript-eslint/eslint-pluginand add@typescript-eslint/parser. - Update multiple React Query hooks’
queryKeydefinitions to include additional dependencies (notablyheaders), plus fix Prettier config keys.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/query/useWasmGitHubAttestation.ts | Includes headers in queryKey to prevent cache collisions across header changes. |
| src/query/useWasmBinaryFromRpc.ts | Includes headers in queryKey for correct caching of RPC wasm binary fetches. |
| src/query/useRpcHealthCheckUntilReady.ts | Includes headers in queryKey so health check results vary by request headers. |
| src/query/useLatestTxn.ts | Adds headers to queryKey so latest-tx queries are keyed by network/header context. |
| src/query/useLatestLedger.ts | Keys latest-ledger query by rpcUrl + headers instead of a global key. |
| src/query/useHorizonHealthCheckUntilReady.ts | Includes headers in queryKey for Horizon health polling correctness. |
| src/query/useGetRpcTxs.ts | Keys RPC tx list by rpcUrl, startLedger, and headers. |
| src/query/useGetRpcTxDetails.ts | Keys RPC tx detail query by rpcUrl, tx, and headers. |
| src/query/useGetContractDataFromRpcById.ts | Expands queryKey inputs to better reflect parameters that affect contract data lookup. |
| src/query/useFriendBot.ts | Expands queryKey to include network context and headers for Friendbot funding requests. |
| src/query/useFetchRpcTxDetails.ts | Includes headers in queryKey for JSON-RPC fetch correctness. |
| src/query/useEndpoint.ts | Expands queryKey to include requestUrl and headers so endpoint responses aren’t cross-cached. |
| src/query/useCheckTxSignatures.ts | Keys signature check by XDR/network inputs plus headers. |
| src/query/useBuildVerification.ts | Includes headers in queryKey for build verification fetching. |
| src/query/useBuildRpcTransaction.ts | Expands queryKey inputs (but currently misses rpcUrl, causing a cache bug). |
| src/query/useAddTrustline.ts | Expands queryKey inputs to include asset/network/header context. |
| src/query/useAccountSequenceNumber.ts | Keys by account + horizonUrl + headers to avoid cross-network cache reuse. |
| src/query/useAccountInfo.ts | Keys by account + horizonUrl + headers. |
| src/query/external/useSEContractStorage.ts | Includes totalEntriesCount in queryKey to keep cache aligned with expected fetch behavior. |
| package.json | Adds TanStack Query ESLint plugin; upgrades @typescript-eslint/* deps. |
| .eslintrc.json | Enables plugin:@tanstack/query/recommended. |
| .prettierrc.json | Fixes Prettier option keys (arrowParens, bracketSameLine). |
| pnpm-lock.yaml | Lockfile updates for the added/updated lint dependencies. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c773ffcbd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Preview is available here: |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Preview is available here: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e730383490
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Preview is available here: |
1 similar comment
|
Preview is available here: |
|
|
||
| const txsQuery = useGetRpcTxs({ | ||
| const { | ||
| refetch: refetchTxs, |
There was a problem hiding this comment.
the object returned from the query hook is not referentially stable. the official doc recommends to destructure the return value of the query hook and pass them into dep array instead.
|
Preview is available here: |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Preview is available here: |
| const errorElement = isError ? ( | ||
| <Alert variant="error" placement="inline"> | ||
| {txsQuery.error.message} | ||
| {error?.message} | ||
| </Alert> | ||
| ) : null; |
There was a problem hiding this comment.
To be safe, should we me checking for the error.message instead of isError?
| const errorElement = isError ? ( | |
| <Alert variant="error" placement="inline"> | |
| {txsQuery.error.message} | |
| {error?.message} | |
| </Alert> | |
| ) : null; | |
| const errorElement = error?.message ? ( | |
| <Alert variant="error" placement="inline"> | |
| {error.message} | |
| </Alert> | |
| ) : null; |
| }) => { | ||
| const query = useQuery({ | ||
| queryKey: ["accountInfo", publicKey], | ||
| queryKey: ["accountInfo", publicKey, horizonUrl, headers], |
There was a problem hiding this comment.
Is headers a string or an object? Just want to make sure the query won't be triggered too often.
No description provided.