useInputName
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 argument to be always called “input”
Using the same name for all input parameters will make your schemas easier to consume and more predictable.
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”With 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": { "style": { "useInputName": { "options": { "checkInputType": "loose" } } } } }}type Mutation { SetMessage(input: InputMessage): String}type Mutation { SetMessage(input: setMessageInput): String}type Mutation { SetMessage(input: SetMessageInput): String}{ "linter": { "rules": { "style": { "useInputName": { "options": { "checkInputType": "strict" } } } } }}type Mutation { SetMessage(input: InputMessage): String}type Mutation { SetMessage(input: setMessageInput): String}type Mutation { SetMessage(input: SetMessageInput): String}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.