@graphql-eslint/eslint-plugin
Version:
GraphQL plugin for ESLint
87 lines (63 loc) • 1.8 kB
Markdown
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
enables this rule.
💡 This rule provides
[](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
- Category: `Operations`
- Rule name: `@graphql-eslint/selection-set-depth`
- Requires GraphQL Schema: `false` [ℹ️](../../README.md
- Requires GraphQL Operations: `true`
[ℹ️](../../README.md
Limit the complexity of the GraphQL operations solely by their depth. Based on
[](https://npmjs.com/package/graphql-depth-limit).
```graphql
query deep2 {
viewer {
albums {
title
}
}
}
```
```graphql
query deep2 {
viewer {
albums {
title
}
}
}
```
```graphql
query deep2 {
viewer {
albums {
title
}
}
}
```
The schema defines the following properties:
The object is an array with all elements of the type `string`.
Additional restrictions:
- Minimum items: `1`
- Unique items: `true`
- [Rule source](../../packages/plugin/src/rules/selection-set-depth.ts)
- [Test source](../../packages/plugin/tests/selection-set-depth.spec.ts)