Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule for checking name of input of a mutation end with "Input" only at top level #1928

Open
gituserjava opened this issue Oct 13, 2023 · 6 comments
Labels
help wanted Extra attention is needed new rule

Comments

@gituserjava
Copy link

gituserjava commented Oct 13, 2023

Allow

type Mutation {
createEmployee(input: EmployeeInput)
}

input EmployeeInput {
id: String,
details: EmployeeDetails
}

input EmployeeDetails {
name: String
}

@gituserjava gituserjava changed the title Rule for checking name of input of a mutation end with "Input" Rule for checking name of input of a mutation end with "Input" only at top level Oct 13, 2023
@dimaMachina
Copy link
Collaborator

This rule is what are you looking for? https://the-guild.dev/graphql/eslint/rules/input-name

@gituserjava
Copy link
Author

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

@gituserjava
Copy link
Author

@B2o5T, do you have plan to implement this?

@gituserjava
Copy link
Author

@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?

@dimaMachina
Copy link
Collaborator

@gituserjava accepted, maybe via a new option for an existing rule?

@dimaMachina dimaMachina added help wanted Extra attention is needed new rule labels Dec 10, 2023
@gituserjava
Copy link
Author

yes I think we can add an option to existing rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed new rule
Development

No branches or pull requests

2 participants