Skip to content

selectionSetDepth

Property Value
Config name selectionSetDepth
Default severity
Context Document
In recommended No

Limit selection set nesting depth.

# ❌ Bad — too deeply nested
query Deep {
a {
b {
c {
d {
id
}
}
}
}
}
# ✅ Good — reasonable depth
query Shallow {
user {
posts {
id
}
}
}
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.
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"]