# no-one-place-fragments

Source: https://api-genie.dev/docs/linter/graphql/rules/no-one-place-fragments

A rule of the GraphQL linter, which reads GraphQL schemas and operations. Since 0.9.0. In the rulesets: All at error.

This rule checks that fragments are spread more than once in the document.

## Rule details

A fragment spread once adds indirection without reuse; its selections are better inlined.

The rule applies to operations and fragments. An `# apigenie-lint-disable no-one-place-fragments`
comment on a node turns it off for the node and everything nested in it; at the top of the file,
separated from the first definition by a blank line, the comment turns it off for the whole file.

## Examples

**Good**.

```graphql
query Q { a: user(id: 1) { ...UserFields } b: user(id: 2) { ...UserFields } }
fragment UserFields on User { id }
```

**Bad**. The linter reports `Fragment 'UserFields' is spread only once; inline its selections`.

```graphql
query Q { me { ...UserFields } }
fragment UserFields on User { id }
```
