📄 tanstack/query/v4/docs/eslint/no-deprecated-options

File: no-deprecated-options.md | Updated: 11/15/2025

Source: https://tanstack.com/query/v4/docs/eslint/no-deprecated-options



TanStack

Query v4v4

Search...

+ K

Auto

Log In

TanStack StartRC

Docs Examples GitHub Contributors

TanStack Router

Docs Examples GitHub Contributors

TanStack Query

Docs Examples GitHub Contributors

TanStack Table

Docs Examples Github Contributors

TanStack Formnew

Docs Examples Github Contributors

TanStack DBbeta

Docs Github Contributors

TanStack Virtual

Docs Examples Github Contributors

TanStack Paceralpha

Docs Examples Github Contributors

TanStack Storealpha

Docs Examples Github Contributors

TanStack Devtoolsalpha

Docs Github Contributors

More Libraries

Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide

Documentation

Framework

React logo

React

Version

v4

Search...

+ K

Menu

Getting Started

Guides & Concepts

Community Resources

API Reference

ESLint

Plugins

Examples

Framework

React logo

React

Version

v4

Menu

Getting Started

Guides & Concepts

Community Resources

API Reference

ESLint

Plugins

Examples

On this page

Disallowing deprecated options

Copy Markdown

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),
})


/* 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),
})


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
----------

  • [x] ✅ Recommended
  • [ ] 🔧 Fixable

Edit on GitHub

Exhaustive Deps

Prefer object syntax

Partners Become a Partner

Code RabbitCode Rabbit CloudflareCloudflare AG GridAG Grid NetlifyNetlify NeonNeon WorkOSWorkOS ClerkClerk ConvexConvex ElectricElectric SentrySentry PrismaPrisma StrapiStrapi UnkeyUnkey

[###### Want to Skip the Docs?

Query.gg - The Official React Query Course
\

“If you’re serious about *really* understanding React Query, there’s no better way than with query.gg”—Tanner Linsley

Learn More](https://query.gg/?s=tanstack)

You are currently reading v4 docs. Redirect to latest version?

Latest Hide

scarf analytics