# no-one-place-fragments

Source: https://apigenie.pl/docs/linter/graphql/rules/no-one-place-fragments

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.

## Configuration

This rule has no options.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        no-one-place-fragments: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable no-one-place-fragments` comment on the node, or for a whole file with the comment at the top of the file, separated from the first definition by a blank line. It applies to operations and fragments.

## 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 }
```
