# noTanstackQueryRestDestructuring

Rule `biome/noTanstackQueryRestDestructuring`. Disallow rest destructuring and object spread on TanStack Query results.

- Source: biome
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #560 by reach, #195 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/noTanstackQueryRestDestructuring` | yes | no | group nursery, since 2.6.3 | [docs](https://biomejs.dev/linter/rules/no-tanstack-query-rest-destructuring/) |

## Code examples

### Incorrect: the rule reports this

```js
import { useQuery } from "@tanstack/react-query";

const { data, ...rest } = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });
```

```js
import { useQuery } from "@tanstack/react-query";

const query = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });
const { data, ...rest } = query;
```

```js
import { useQuery } from "@tanstack/react-query";

const query = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });
const result = { ...query, todos: query.data };
```

### Correct: the rule accepts this

```js
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 },
    ],
});
```

```svelte
<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.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noTanstackQueryRestDestructuring": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [biome/noTailwindLegacyUtilities](https://lintradar.dev/rules/biome/noTailwindLegacyUtilities.md): Disallow Tailwind CSS utility classes that Tailwind CSS only keeps for backward compatibility.
- [biome/noTanstackQueryUnstableDeps](https://lintradar.dev/rules/biome/noTanstackQueryUnstableDeps.md): Disallow using the result of a TanStack Query hook as a React hook dependency.
- [biome/noTailwindLegacyImportant](https://lintradar.dev/rules/biome/noTailwindLegacyImportant.md): Disallow the leading `!` important modifier in Tailwind CSS classes.
- [biome/noTanstackQueryVoidQueryFn](https://lintradar.dev/rules/biome/noTanstackQueryVoidQueryFn.md): Disallow TanStack Query functions that don't return any data.
- [biome/noTailwindConflictingClasses](https://lintradar.dev/rules/biome/noTailwindConflictingClasses.md): Disallow Tailwind CSS classes that set the same CSS properties on an element.
- [biome/noThisInStatic](https://lintradar.dev/rules/biome/noThisInStatic.md): Disallow `this` and `super` in `static` contexts.

---

Web page: https://lintradar.dev/rules/biome/noTanstackQueryRestDestructuring. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
