npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codelaw/rules-tanstack-query

v0.4.3

Published

codelaw's TanStack Query rules, from @tanstack/eslint-plugin-query (SR-RULE-PACKS)

Readme

@codelaw/rules-tanstack-query

codelaw's TanStack Query rules — one of codelaw's first-party rule packs (SR-RULE-PACKS). It ships on npm only, as @codelaw/rules-tanstack-query: TanStack Query is a JavaScript library.

# codelaw.toml
extends = ["codelaw:js/recommended", "codelaw:react/recommended", "codelaw:tanstack-query/recommended"]
preview = true   # every rule is `preview` until a corpus run promotes it

codelaw init adds it when package.json depends on @tanstack/react-query or react-query.

Presets

| preset | rules | ported from | |---|---|---| | tanstack-query/recommended | 13 | @tanstack/eslint-plugin-query 5.104.5 recommended (all 7), at its severities, and the 6 rules from TanStack Query v5's guides below |

Every rule is reimplemented, not vendored: the matchers, messages and docs are written fresh, and each rule's ported_from: names the source rule. The rules read the option objects TanStack Query's hooks take, on codelaw's semantic model (native: rules, like react/exhaustive-deps). A rule that follows a hook (no-rest-destructuring, no-unstable-deps, stable-query-client) checks that it is imported from a @tanstack/*-query package, as upstream does.

| rule | fix | checks | |---|---|---| | tanstack-query/exhaustive-deps | suggest | the query key names every value the query function reads | | tanstack-query/stable-query-client | suggest | new QueryClient() is not made on every render | | tanstack-query/no-rest-destructuring | manual | a query result is not rest-destructured or spread | | tanstack-query/no-unstable-deps | manual | a query hook's whole result is not a React hook dependency | | tanstack-query/no-void-query-fn | manual | a queryFn returns its data | | tanstack-query/infinite-query-property-order | auto | queryFn before getPreviousPageParam / getNextPageParam | | tanstack-query/mutation-property-order | auto | onMutate before onError / onSettled |

Six more rules come from TanStack Query v5's own guides — Migrating to TanStack Query v5, Query Keys, Updates from Mutation Responses and Suspense — where a guide states a rule a matcher can decide without types (W-42). Each rule page quotes the guide's words.

| rule | fix | checks | |---|---|---| | tanstack-query/no-renamed-v4-options | auto | gcTime and throwOnError, not v4's cacheTime and useErrorBoundary | | tanstack-query/no-removed-v4-options | manual | no onSuccess / onError / onSettled, keepPreviousData, isDataEqual or context on a query | | tanstack-query/object-syntax | suggest | one options object, not v4's positional (key, fn, options) | | tanstack-query/array-query-key | suggest | a queryKey is an array | | tanstack-query/no-mutating-set-query-data | manual | a setQueryData updater doesn't change the cached data in place | | tanstack-query/no-unsupported-suspense-options | suggest | no enabled, placeholderData or throwOnError on a suspense query |

How the ports differ

Every rule matches its source's documented behaviour on the source's own examples. Where codelaw differs, the rule's ## Differences from the source section says so. The larger ones:

| rule | difference | |---|---| | tanstack-query/no-void-query-fn | upstream asks the TypeScript type checker; codelaw reports a queryFn written in place whose body cannot return a value | | tanstack-query/no-rest-destructuring | upstream also finds a query result by its type under typed linting; codelaw follows direct hook calls only | | tanstack-query/exhaustive-deps | allowlist.types matches the type names in the value's own annotation; nothing is inferred | | the two *-property-order rules | the reordering is offered only when every moved option is a function, a method or a name |

Not ported, and why

| rule | why | |---|---| | @tanstack/query/prefer-query-options | not in recommended (it is recommended-strict's only addition), which is what this pack ports | | a returned invalidateQueries in a mutation callback (W-42 candidate) | Invalidations from Mutations says what returning the promise does ("makes sure the data is updated before the mutation is entirely complete") and that "you can wire up your invalidations … using any of the callbacks"; it describes a choice, not a rule |