nursery/noTanstackQueryRestDestructuring
nursery · since 2.6.3
No autofixRecommended
biome.json
{
"linter": {
"rules": {
"nursery": {
"noTanstackQueryRestDestructuring": "error"
}
}
}
}Disallow rest destructuring and object spread on TanStack Query results.
import { useQuery } from "@tanstack/react-query";
const { data, ...rest } = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });import { useQuery } from "@tanstack/react-query";
const query = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });
const { data, ...rest } = query;import { useQuery } from "@tanstack/react-query";
const query = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });
const result = { ...query, todos: query.data };import { useQueries, useQuery } from "@tanstack/react-query";
const { data, isPending } = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });
const query = useQuery({ queryKey: ["users"], queryFn: fetchUsers });
const users = query.data;
const [first, { data: posts }, ...others] = useQueries({
queries: [
{ queryKey: ["todos"], queryFn: fetchTodos },
{ queryKey: ["posts"], queryFn: fetchPosts },
{ queryKey: ["users"], queryFn: fetchUsers },
],
});<script>
import { createQuery } from "@tanstack/svelte-query";
const query = createQuery(() => ({ queryKey: ["todos"], queryFn: fetchTodos }));
</script>
<p>{query.data.length} todos</p>Examples from the Biome documentation.
ESLint does not have this rule.
Oxlint does not have this rule.
nursery/noTanstackQueryRestDestructuring
nursery · since 2.6.3
{
"linter": {
"rules": {
"nursery": {
"noTanstackQueryRestDestructuring": "error"
}
}
}
}Disallow Tailwind CSS utility classes that Tailwind CSS only keeps for backward compatibility.
Disallow using the result of a TanStack Query hook as a React hook dependency.
Disallow the leading ! important modifier in Tailwind CSS classes.
Disallow TanStack Query functions that don't return any data.
Disallow Tailwind CSS classes that set the same CSS properties on an element.