🎉 Welcome to the new GraphQL-ESLint website. Try new playground page →
Input Name


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

  • Category: Schema
  • Rule name: @graphql-eslint/input-name
  • Requires GraphQL Schema: false ℹī¸
  • Requires GraphQL Operations: false ℹī¸

Require mutation argument to be always called "input" and input type to be called Mutation name + "Input". Using the same name for all input parameters will make your schemas easier to consume and more predictable. Using the same name as mutation for InputType will make it easier to find mutations that InputType belongs to.

Usage Examples


# eslint @graphql-eslint/input-name: ['error', { checkInputType: true }]
type Mutation {
  SetMessage(message: InputMessage): String

Correct (with checkInputType)

# eslint @graphql-eslint/input-name: ['error', { checkInputType: true }]
type Mutation {
  SetMessage(input: SetMessageInput): String

Correct (without checkInputType)

# eslint @graphql-eslint/input-name: ['error', { checkInputType: false }]
type Mutation {
  SetMessage(input: AnyInputTypeName): String

Config Schema

The schema defines the following properties:

checkInputType (boolean)

Check that the input type name follows the convention <mutationName>Input

Default: false

caseSensitiveInputType (boolean)

Allow for case discrepancies in the input type name

Default: true

checkQueries (boolean)

Apply the rule to Queries

Default: false

checkMutations (boolean)

Apply the rule to Mutations

Default: true