Skip to content

fix(eslint-plugin-query): flag rest destructuring from custom hooks#10708

Closed
raashish1601 wants to merge 1 commit into
TanStack:mainfrom
raashish1601:codex/fix-no-rest-destructuring-custom-hooks
Closed

fix(eslint-plugin-query): flag rest destructuring from custom hooks#10708
raashish1601 wants to merge 1 commit into
TanStack:mainfrom
raashish1601:codex/fix-no-rest-destructuring-custom-hooks

Conversation

@raashish1601
Copy link
Copy Markdown
Contributor

@raashish1601 raashish1601 commented May 14, 2026

Summary

Fixes #8951.

authored-by: codex

The no-rest-destructuring rule previously only detected direct TanStack Query hook calls. This follows local function and variable references so custom hooks that directly return a TanStack Query result are handled too, including block-bodied arrow hooks and hooks declared after their component.

A non-TanStack custom hook case is covered to avoid reporting hooks from other packages.

Validation

  • corepack pnpm exec vitest run --globals packages/eslint-plugin-query/src/__tests__/no-rest-destructuring.test.ts PASS, 38 passed
  • corepack pnpm exec eslint --format stylish packages/eslint-plugin-query/src/rules/no-rest-destructuring/no-rest-destructuring.rule.ts packages/eslint-plugin-query/src/__tests__/no-rest-destructuring.test.ts PASS
  • corepack pnpm exec prettier --check "packages/eslint-plugin-query/src/rules/no-rest-destructuring/no-rest-destructuring.rule.ts" "packages/eslint-plugin-query/src/__tests__/no-rest-destructuring.test.ts" PASS
  • corepack pnpm exec tsc --project packages/eslint-plugin-query/tsconfig.prod.json --pretty false PASS
  • git diff --check PASS

Broader package scripts were also attempted and appear blocked by unrelated local workspace issues:

  • corepack pnpm --filter @tanstack/eslint-plugin-query test:lib -- --run --globals runs 1620 tests successfully but one existing no-void-query-fn case times out; Vitest also logs missing generated example tsconfigs such as .svelte-kit/tsconfig.json and .nuxt/tsconfig.json.
  • corepack pnpm --filter @tanstack/eslint-plugin-query test:eslint exits with SyntaxError: Unexpected token '.' before linting the changed files; direct ESLint on the changed files passes.
  • corepack pnpm --filter @tanstack/eslint-plugin-query build compiles JS and TSC successfully, then the DTS phase fails resolving ajv/dist/core through ajv-draft-04/@microsoft/api-extractor in this local install.

@TkDodo
Copy link
Copy Markdown
Collaborator

TkDodo commented May 22, 2026

not the fix we want. as the issue says, we want a separate recommended-typechecked preset

@TkDodo TkDodo closed this May 22, 2026
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.

[lint]: no-rest-destructuring does not report on custom hooks

2 participants