nursery/useTanstackQueryExhaustiveDependencies
nursery · since 2.6.9
Unsafe autofixRecommended
biome.json
{
"linter": {
"rules": {
"nursery": {
"useTanstackQueryExhaustiveDependencies": "error"
}
}
}
}Require query keys to include every value that the query function uses.
import { useQuery } from "@tanstack/react-query";
function Todo({ todoId }) {
const query = useQuery({
queryKey: ["todo"],
queryFn: () => fetchTodo(todoId),
});
}const todoQueries = {
detail: (id) => ({ queryKey: ["todo"], queryFn: () => fetchTodo(id) }),
};import { useQuery } from "@tanstack/react-query";
function Todo({ todoId }) {
const todos = useTodos();
const query = useQuery({
queryKey: ["todo", todoId],
queryFn: () => todos.getTodo(todoId),
});
}
const todoQueries = {
detail: (id) => ({ queryKey: ["todo", id], queryFn: () => fetchTodo(id) }),
};Examples from the Biome documentation.
ESLint does not have this rule.
Oxlint does not have this rule.
nursery/useTanstackQueryExhaustiveDependencies
nursery · since 2.6.9
{
"linter": {
"rules": {
"nursery": {
"useTanstackQueryExhaustiveDependencies": "error"
}
}
}
}Enforce the shorthand syntax for CSS variables in Tailwind CSS classes.
Enforce a consistent property order in the options of TanStack Query infinite query functions.
Enforce the shorthand syntax for Svelte bind:, class:, and style: directives.
Enforce that onMutate comes before onError and onSettled in the options of TanStack Query mutations.
Require keyed {#each} blocks in Svelte templates.
Require the TanStack Query QueryClient to be created once, not on every render.