# useBiomeTopLevelTypes

Rule `biome/useBiomeTopLevelTypes`. Require kind sets in Biome JS plugins to be created at the top level of the module.

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/useBiomeTopLevelTypes` | yes | no | group nursery, since 2.6.9 | [docs](https://biomejs.dev/linter/rules/use-biome-top-level-types/) |

## Code examples

### Incorrect: the rule reports this

```js
import { defineRule, nodeKinds } from "@biomejs/runtime/plugin";

export const rule = defineRule({
    run(node) {
        const CALLS = nodeKinds("JS_CALL_EXPRESSION", "JS_NEW_EXPRESSION");
        return CALLS.has(node.parent);
    },
});
```

```js
import { nodeKinds } from "@biomejs/runtime/plugin";

const CALLS = nodeKinds("JS_CALL_EXPRESSION", "JS_NEW_EXPRESSION");
const IMPORTS = nodeKinds("JS_IMPORT_CALL_EXPRESSION");

function isCallOrImport(node) {
    return CALLS.union(IMPORTS).has(node);
}
```

### Correct: the rule accepts this

```js
import { defineRule, nodeKinds } from "@biomejs/runtime/plugin";

const CALLS = nodeKinds("JS_CALL_EXPRESSION", "JS_NEW_EXPRESSION");
const CALLS_AND_IMPORTS = CALLS.union(nodeKinds("JS_IMPORT_CALL_EXPRESSION"));

export const rule = defineRule({
    run(node) {
        return CALLS_AND_IMPORTS.has(node.parent);
    },
});
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useBiomeTopLevelTypes": "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/useBiomeKindSets](https://lintradar.dev/rules/biome/useBiomeKindSets.md): Require kind sets instead of comparing kind names one by one in Biome JS plugins.
- [biome/useConsistentObjectKeys](https://lintradar.dev/rules/biome/useConsistentObjectKeys.md): Enforce JSON keys with consistent Unicode representation.
- [biome/useBiomeIgnoreFolder](https://lintradar.dev/rules/biome/useBiomeIgnoreFolder.md): Prefer folder exclusions that prevent Biome from scanning the folder.
- [biome/useConvexAccessControl](https://lintradar.dev/rules/biome/useConvexAccessControl.md): Require public Convex functions to call an access control function.
- [biome/noZeroLengthUnit](https://lintradar.dev/rules/biome/noZeroLengthUnit.md): Disallow units on zero lengths.
- [biome/useConvexArgsValidator](https://lintradar.dev/rules/biome/useConvexArgsValidator.md): Require an `args` validator in Convex queries, mutations, and actions.

---

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