dimaMachina / graphql-eslint

ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL tools.
https://the-guild.dev/graphql/eslint
MIT License
798 stars 104 forks source link

Rule to mandate input of a mutation as required #1929

Open gituserjava opened 1 year ago

gituserjava commented 1 year ago

Allow

type Mutation {
  createEmployee(input: EmployeeInput!)
}

Disallow

type Mutation {
  createEmployee(input: EmployeeInput)
}
dimaMachina commented 1 year ago

Why do you think this rule should be part of graphql-eslint?

gituserjava commented 1 year ago

@B2o5T, sorry there was a typo in my original example, I fixed it now.

Additional context is that we want to enforce all mutations have non-null Input. If we don't have exclamation mark the input becomes optional and we do not want optional inputs.

gituserjava commented 1 year ago

Will you be planning to add this rule?

gituserjava commented 11 months ago

@dimaMachina , could you please let me know if you have any plans to implement this rule?

dimaMachina commented 10 months ago

@gituserjava This rule is accepted, if you want you can work on it and send a PR

gituserjava commented 10 months ago

I forked the repository and will explore on this based on my availability.

Quick question, which command should I use to run the test and see the result? For example, I want to test "input-name.spec.ts".

dimaMachina commented 9 months ago

vitest input-name.spec.ts