# noTanstackQueryVoidQueryFn

Rule `biome/noTanstackQueryVoidQueryFn`. Disallow TanStack Query functions that don't return any data.

- 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: #562 by reach, #197 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

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

useQuery({
    queryKey: ["todos"],
    queryFn: async () => {
        await fetch("/api/todos");
    },
});
```

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

useQuery({
    queryKey: ["todos"],
    queryFn: async () => {
        const response = await fetch("/api/todos");
        if (response.ok) {
            return response.json();
        }
    },
});
```

```ts
import { queryOptions } from "@tanstack/react-query";

async function refreshTodos(): Promise<void> {
    await fetch("/api/todos/refresh");
}

const options = queryOptions({
    queryKey: ["todos"],
    queryFn: refreshTodos,
});
```

### Correct: the rule accepts this

```ts
import { queryOptions, useQuery } from "@tanstack/react-query";

useQuery({
    queryKey: ["todos"],
    queryFn: async () => {
        const response = await fetch("/api/todos");
        return response.json();
    },
});

useQuery({
    queryKey: ["selected-todo"],
    queryFn: () => null,
});

async function countTodos(): Promise<number> {
    return 3;
}

const options = queryOptions({
    queryKey: ["todo-count"],
    queryFn: countTodos,
});
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noTanstackQueryVoidQueryFn": "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/noTanstackQueryUnstableDeps](https://lintradar.dev/rules/biome/noTanstackQueryUnstableDeps.md): Disallow using the result of a TanStack Query hook as a React hook dependency.
- [biome/noThisInStatic](https://lintradar.dev/rules/biome/noThisInStatic.md): Disallow `this` and `super` in `static` contexts.
- [biome/noTanstackQueryRestDestructuring](https://lintradar.dev/rules/biome/noTanstackQueryRestDestructuring.md): Disallow rest destructuring and object spread on TanStack Query results.
- [biome/noUnknownAtRules](https://lintradar.dev/rules/biome/noUnknownAtRules.md): Disallow unrecognized CSS at-rules.
- [biome/noTailwindLegacyUtilities](https://lintradar.dev/rules/biome/noTailwindLegacyUtilities.md): Disallow Tailwind CSS utility classes that Tailwind CSS only keeps for backward compatibility.
- [biome/noUnknownFunction](https://lintradar.dev/rules/biome/noUnknownFunction.md): Disallow unrecognized CSS value functions.

---

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