Skip to content

noUnusedVariables

PropertyValue
Config namenoUnusedVariables
Default severity
ContextDocument
In recommendedNo

Detects variables defined in an operation that are never referenced in the query body.

# ⚠️ Warning: Variable '$name' is never used
query GetUser($id: ID!, $name: String) {
user(id: $id) {
id
}
}
# ✅ Good — all variables used
query GetUser($id: ID!) {
user(id: $id) {
id
}
}
extensions:
graphql-analyzer:
lint:
rules:
noUnusedVariables: warn # or error, off