graphql-eslint
graphql-eslint copied to clipboard
Rule for checking name of input of a mutation end with "Input" only at top level
Allow
type Mutation {
createEmployee(input: EmployeeInput)
}
input EmployeeInput {
id: String,
details: EmployeeDetails
}
input EmployeeDetails {
name: String
}
This rule is what are you looking for? https://the-guild.dev/graphql/eslint/rules/input-name
No @B2o5T, the rule that you pointed out is checking for all occurrences of inputs. We want to check it only for top level input which is defined within mutation in parenthesis. If you see in the example, our input is nested in which EmployeeDetails is also an input but we don't want to apply this rule on EmployeeDetails but want to apply on the top level input which is EmployeeInput.
EmployeeInput
- id
- details
- name
@B2o5T, do you have plan to implement this?
@dimaMachina , also the rule is checking for <mutationName>Input, it would be good if rule can be configured for <anyName>Input but check that input name ends with Input. Any plans to implement this?
@gituserjava accepted, maybe via a new option for an existing rule?
yes I think we can add an option to existing rule.