relay-connection-types
- Category: 
Schema - Rule name: 
@graphql-eslint/relay-connection-types - Requires GraphQL Schema: 
falseℹ️ - Requires GraphQL Operations: 
falseℹ️ 
Set of rules to follow Relay specification for Connection types.
- Any type whose name ends in “Connection” is considered by spec to be a 
Connection type - Connection type must be an Object type
 - Connection type must contain a field 
edgesthat return a list type that wraps an edge type - Connection type must contain a field 
pageInfothat return a non-nullPageInfoObject type 
Usage Examples
Incorrect
# eslint @graphql-eslint/relay-connection-types: 'error'
 
type UserPayload { # should be an Object type with `Connection` suffix
  edges: UserEdge! # should return a list type
  pageInfo: PageInfo # should return a non-null `PageInfo` Object type
}Correct
# eslint @graphql-eslint/relay-connection-types: 'error'
 
type UserConnection {
  edges: [UserEdge]
  pageInfo: PageInfo!
}Resources
Last updated on