Query Docs
Guides & Concepts
- Important Defaults
- Queries
- Query Keys
- Query Functions
- Network Mode
- Parallel Queries
- Dependent Queries
- Background Fetching Indicators
- Window Focus Refetching
- Disabling/Pausing Queries
- Query Retries
- Paginated Queries
- Infinite Queries
- Initial Query Data
- Placeholder Query Data
- Prefetching
- Mutations
- Query Invalidation
- Invalidation from Mutations
- Updates from Mutation Responses
- Optimistic Updates
- Query Cancellation
- Scroll Restoration
- Filters
- SSR & Next.js
- Caching
- Default Query Fn
- Suspense
- Custom Logger
- Testing
- Does this replace [Redux, MobX, etc]?
- Migrating to React Query 3
- Migrating to React Query 4
ESLint
AI/LLM: This documentation page is available in plain markdown format at/query/v4/docs/eslint/no-deprecated-options.md
ESLint
Disallowing deprecated options
This rule warns about deprecated useQuery options which will be removed in TanStack Query v5.
Rule Details#
Examples of incorrect code for this rule:
tsx
/* eslint "@tanstack/query/no-deprecated-options": "error" */
useQuery({
queryKey: ['todo', todoId],
queryFn: () => api.getTodo(todoId),
onSuccess: () => {},
})
useQuery({
queryKey: ['todo', todoId],
queryFn: () => api.getTodo(todoId),
onError: () => {},
})
useQuery({
queryKey: ['todo', todoId],
queryFn: () => api.getTodo(todoId),
onSettled: () => {},
})
useQuery({
queryKey: ['todo', todoId],
queryFn: () => api.getTodo(todoId),
isDataEqual: (oldData, newData) => customCheck(oldData, newData),
})Examples of correct code for this rule:
tsx
useQuery({
queryKey: ['todo', todoId],
queryFn: () => api.getTodo(todoId),
})
useQuery({
queryKey: ['todo', todoId],
queryFn: () => api.getTodo(todoId),
structuralSharing: (oldData, newData) =>
customCheck(oldData, newData)
? oldData
: replaceEqualDeep(oldData, newData),
})When Not To Use It#
If you don't plan to upgrade to TanStack Query v5, then you will not need this rule.
Attributes#
- ✅ Recommended
- 🔧 Fixable