relay-arguments
- Category: Schema
- Rule name: @graphql-eslint/relay-arguments
- Requires GraphQL Schema: falseℹ️
- Requires GraphQL Operations: falseℹ️
Set of rules to follow Relay specification for Arguments.
- A field that returns a Connection type must include forward pagination arguments (firstandafter), backward pagination arguments (lastandbefore), or both
Forward pagination arguments
- firsttakes a non-negative integer
- aftertakes the Cursor type
Backward pagination arguments
- lasttakes a non-negative integer
- beforetakes the Cursor type
Usage Examples
Incorrect
# eslint @graphql-eslint/relay-arguments: 'error'
 
type User {
  posts: PostConnection
}Correct
# eslint @graphql-eslint/relay-arguments: 'error'
 
type User {
  posts(after: String, first: Int, before: String, last: Int): PostConnection
}Config Schema
The schema defines the following properties:
includeBoth (boolean)
Enforce including both forward and backward pagination arguments
Default: true