Skip to Content
🚧 This is WIP documentation for v4 of the plugin. For v3 click here.
ESLGraphQL-ESLint
Rulesrequire-nullable-result-in-root

require-nullable-result-in-root

💡 This rule provides suggestions

  • 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

Last updated on