src/content/docs/linter/rules/use-input-name.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="GraphQL" icon="seti:graphql"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.3.14` - Diagnostic Category: [`lint/nursery/useInputName`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - Sources: - Same as [`@graphql-eslint/input-name`](https://the-guild.dev/graphql/eslint/rules/input-name){
"linter": {
"rules": {
"nursery": {
"useInputName": "error"
}
}
}
}
Require mutation argument to be always called "input"
Using the same name for all input parameters will make your schemas easier to consume and more predictable.
type Mutation {
SetMessage(message: InputMessage): String
}
type Mutation {
SetMessage(input: SetMessageInput): String
}
checkInputTypeWith the option checkInputType on, the input type name requires to be called <mutation name>Input.
This can either be "loose" (case-insensitive) or "strict" (case-sensitive).
Using the name of the mutation in the input type name will make it easier to find the mutation that the input type belongs to.
Default "off"
{
"linter": {
"rules": {
"nursery": {
"useInputName": {
"options": {
"checkInputType": "loose"
}
}
}
}
}
}
type Mutation {
SetMessage(input: InputMessage): String
}
type Mutation {
SetMessage(input: setMessageInput): String
}
type Mutation {
SetMessage(input: SetMessageInput): String
}
{
"linter": {
"rules": {
"nursery": {
"useInputName": {
"options": {
"checkInputType": "strict"
}
}
}
}
}
}
type Mutation {
SetMessage(input: InputMessage): String
}
type Mutation {
SetMessage(input: setMessageInput): String
}
type Mutation {
SetMessage(input: SetMessageInput): String
}