# useLoneExecutableDefinition

Rule `biome/useLoneExecutableDefinition`. Require one executable GraphQL definition per file.

- Source: biome
- Technologies: GraphQL
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1555 by reach, #59 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `style/useLoneExecutableDefinition` | no | no | group style, since 2.3.12 | [docs](https://biomejs.dev/linter/rules/use-lone-executable-definition/) |

## Code examples

### Incorrect: the rule reports this

```graphql
query Foo {
  id
}

fragment Bar on Baz {
  id
}
```

```graphql
query Foo {
  id
}

mutation ($name: String!) {
  createUser {
    id
  }
}
```

```graphql
query Foo {
  id
}

query Bar {
  id
}
```

### Correct: the rule accepts this

```graphql
query Foo {
  id
}
```

```graphql
fragment Bar on Baz {
  id
}
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useLoneExecutableDefinition": "error"
      }
    }
  }
}
```

## Presets that enable it

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

## Related rules

- [biome/useInputName](https://lintradar.dev/rules/biome/useInputName.md): Require mutation arguments to be named `input`.
- [biome/useNodeAssertStrict](https://lintradar.dev/rules/biome/useNodeAssertStrict.md): Prefer `node:assert/strict` over `node:assert`.
- [biome/useGraphqlNamingConvention](https://lintradar.dev/rules/biome/useGraphqlNamingConvention.md): Require uppercase names for GraphQL enum values.
- [biome/useRequiredScripts](https://lintradar.dev/rules/biome/useRequiredScripts.md): Require configured scripts in `package.json`.
- [biome/useConsistentGraphqlDescriptions](https://lintradar.dev/rules/biome/useConsistentGraphqlDescriptions.md): Require one description style throughout a GraphQL schema.
- [biome/useSimplifiedLogicExpression](https://lintradar.dev/rules/biome/useSimplifiedLogicExpression.md): Discard redundant terms from logical expressions.

---

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