Rules
Relay Page Info

relay-page-info

  • Category: Schema
  • Rule name: @graphql-eslint/relay-page-info
  • Requires GraphQL Schema: true ℹ️
  • Requires GraphQL Operations: false ℹ️

Set of rules to follow Relay specification for PageInfo object.

  • PageInfo must be an Object type
  • PageInfo must contain fields hasPreviousPage and hasNextPage, that return non-null Boolean
  • PageInfo must contain fields startCursor and endCursor, that return either String or Scalar, which can be null if there are no results

Usage Examples

Correct

# eslint @graphql-eslint/relay-page-info: 'error'
 
type PageInfo {
  hasPreviousPage: Boolean!
  hasNextPage: Boolean!
  startCursor: String
  endCursor: String
}

Resources