no-one-place-fragments
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.
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.
query Q { me { ...UserFields } }
fragment UserFields on User { id }
Turn it off or change its severity
In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.graphql has the details.
commands:
lint:
graphql:
rules:
no-one-place-fragments: off