It would be interesting to provide a set of Rubocop cops in the repo that people can optionally enable in their own rubocop.yml to do checks on their schema.
Some example checks:
clientMutationId fielddeletedId fieldinput argument on mutationsFeel free to add more ideas.
cc @xuorig @Willianvdv @brandonblack
Edit: Rubocop might not be a silver bullet here since in some cases we might have to run the Ruby code, for instance detecting N+1s with static code analysis might not be feasible.
cc @gjtorikian @josh
Nice. I started working on some graphql-client specific cops already. https://github.com/github/graphql-client/tree/master/lib/rubocop/cop/graphql Would be rad to have some basic ones here as well.
We don't have a cop for this (we use tests) but "has a description" would be grand, as well as conventions for resolve styling (-> {...} vs do ... end).
What do you think about a linter that checks if the name of a mutation starts with capital letter?
So:
# Good
AddCommentMutation = GraphQL::Relay::Mutation.define do
name "AddComment"
end
# Bad
AddCommentMutation = GraphQL::Relay::Mutation.define do
name "addComment"
end
Also relevant: https://github.com/cjoudrey/graphql-schema-linter
I have no plans to work on this but I would welcome suggestions here or in another issue if someone else wants to do it!
I've implemented some _graphql-ruby_ checks in rubocop-graphql, would be happy to hear back ideas and feedback
Most helpful comment
Also relevant: https://github.com/cjoudrey/graphql-schema-linter