🎉 Welcome to the new GraphQL-ESLint website. Try new playground page →
Rules
Require Nullable Result in Root

require-nullable-result-in-root

💡 This rule provides suggestions (opens in a new tab)

  • Category: Schema
  • Rule name: @graphql-eslint/require-nullable-result-in-root
  • Requires GraphQL Schema: true ℹī¸
  • Requires GraphQL Operations: false ℹī¸

Require nullable fields in root types.

Usage Examples

Incorrect

# eslint @graphql-eslint/require-nullable-result-in-root: 'error'
 
type Query {
  user: User!
}

Correct

# eslint @graphql-eslint/require-nullable-result-in-root: 'error'
 
type Query {
  foo: User
  baz: [User]!
  bar: [User!]!
}

Resources