no-anonymous-operations
What it does
Section titled “What it does”Reports an operation without a name ({ a }, query { a }).
Why it matters
Section titled “Why it matters”Servers, logs, traces and caches identify an operation by its name. An anonymous one shows up as nothing in the query log, so it cannot be told from the others when something is slow or fails, and a persisted-query store has nothing to key it on.
To fix, name the operation: query GetA { a }.
Example
Section titled “Example”query Named { a }{ b }query { c }mutation ($x: Int) { d }subscription S @live { e }Configuration
Section titled “Configuration”graphql: lint: rules: no-anonymous-operations: warn # off (default), warn, errorEnabled by the presets: graphql/graphql-eslint-recommended.
Suppress one line with sudsy-disable-next-line no-anonymous-operations in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| graphql-eslint | no-anonymous-operations |
full |