Skip to content

selectionSetDepth

PropertyValue
Config nameselectionSetDepth
Default severity
ContextDocument
In recommendedNo

Limit selection set nesting depth.

# ❌ Bad — too deeply nested
query Deep {
a {
b {
c {
d {
id
}
}
}
}
}
# ✅ Good — reasonable depth
query Shallow {
user {
posts {
id
}
}
}
OptionTypeDefaultDescription
maxDepthnumberMaximum allowed nesting depth. Required when the rule is enabled.
ignorestring[][]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"]