selectionSetDepth
| Property | Value |
|---|---|
| Config name | selectionSetDepth |
| Default severity | — |
| Context | Document |
| In recommended | No |
What it checks
Section titled “What it checks”Limit selection set nesting depth.
Examples
Section titled “Examples”# ❌ Bad — too deeply nestedquery Deep { a { b { c { d { id } } } }}# ✅ Good — reasonable depthquery Shallow { user { posts { id } }}Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
maxDepth | number | — | Maximum allowed nesting depth. Required when the rule is enabled. |
ignore | string[] | [] | Field names that are skipped when counting depth. Useful for Relay connection wrappers like edges and node that add structural nesting without adding semantic depth. |
Configuration
Section titled “Configuration”extensions: graphql-analyzer: lint: rules: selectionSetDepth: [warn, { maxDepth: 3 }]
# Ignore Relay connection fields so edges/node don't count toward depth selectionSetDepth: - warn - maxDepth: 4 ignore: ["edges", "node"]