graphql-eslint icon indicating copy to clipboard operation
graphql-eslint copied to clipboard

Rule to require example and format

Open gituserjava opened this issue 2 years ago • 1 comments

I believe there should be a rule to check for an example for each field in types and Inputs. Do you have any plans to add rule for example and format where ever applicable? Please let me know.

type User {

"""
Unique ID of user
example : 1234
"""
id: ID!

"""
Email address of user
example : [email protected]
"""
email: String!

"""
Date when joined
example : 10-10-2020
format : MM-dd-yyyy
"""
joinedDate: Date!

}

gituserjava avatar Oct 19 '23 02:10 gituserjava

For me, this is a perfect example for user's custom rule, you can just copy graphql-eslint’s require-description rule source code and adapt it to your need, via String.includes('example :') call

I don't plan to add this rule to the official codebase

dimaMachina avatar Oct 19 '23 04:10 dimaMachina