useInputName (GraphQL)
Language GraphQL
Summary
Section titled “Summary”- Rule available since:
v2.3.14 - Diagnostic Category:
lint/style/useInputName - This rule isn’t recommended, so you need to enable it.
- This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
@graphql-eslint/input-name
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "style": { "useInputName": "error" } } }}Description
Section titled “Description”Require mutation arguments to be named input.
A consistent argument name makes mutations predictable for schema users and client tools.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”type Mutation { SetMessage(message: InputMessage): String}code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Unexpected input name, expected the input name "message" to be named "input".
1 │ type Mutation {
> 2 │ SetMessage(message: InputMessage): String
│ ^^^^^^^^^^^^^^^^^^^^^
3 │ }
4 │
ℹ Using the same name for all input parameters will make your schemas easier to consume and more predictable.
type Mutation { SetMessage(input: SetMessageInput): String}Options
Section titled “Options”checkInputType
Section titled “checkInputType”Optionally requires the input type to be named <mutation name>Input, so schema readers can
identify its related mutation.
"off"does not check the type name;"loose"checks the name without regard to letter case;"strict"requires matching letter case.
Defaults to "off".
{ "linter": { "rules": { "style": { "useInputName": { "level": "on", "options": { "checkInputType": "loose" } } } } }}type Mutation { SetMessage(input: InputMessage): String}code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Unexpected input type name, expected the input type name "InputMessage" to be named "SetMessageInput".
1 │ type Mutation {
> 2 │ SetMessage(input: InputMessage): String
│ ^^^^^^^^^^^^^^^^^^^
3 │ }
4 │
ℹ Using the name of the operation in the input type name will make it easier to find the operation that the input type belongs to.
type Mutation { SetMessage(input: setMessageInput): String}type Mutation { SetMessage(input: SetMessageInput): String}{ "linter": { "rules": { "style": { "useInputName": { "level": "on", "options": { "checkInputType": "strict" } } } } }}type Mutation { SetMessage(input: InputMessage): String}code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Unexpected input type name, expected the input type name "InputMessage" to be named "SetMessageInput".
1 │ type Mutation {
> 2 │ SetMessage(input: InputMessage): String
│ ^^^^^^^^^^^^^^^^^^^
3 │ }
4 │
ℹ Using the name of the operation in the input type name will make it easier to find the operation that the input type belongs to.
type Mutation { SetMessage(input: setMessageInput): String}code-block.graphql:2:14 lint/style/useInputName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Unexpected input type name, expected the input type name "setMessageInput" to be named "SetMessageInput".
1 │ type Mutation {
> 2 │ SetMessage(input: setMessageInput): String
│ ^^^^^^^^^^^^^^^^^^^^^^
3 │ }
4 │
ℹ Using the name of the operation in the input type name will make it easier to find the operation that the input type belongs to.
type Mutation { SetMessage(input: SetMessageInput): String}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.