Documentation
¶
Index ¶
- Variables
- func AvailableRulesWithDescription() string
- type LintErrorWithMetadata
- type LintErrorsWithMetadata
- func ArgumentsHaveDescription(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func EnumValuesAreAllCaps(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func EnumValuesHaveDescriptions(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func FieldsAreCamelCased(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func FieldsHaveDescription(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func RelayConnectionArgumentsSpec(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func RelayConnectionTypesSpec(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func TypesAreCapitalized(schema *ast.SchemaDocument) LintErrorsWithMetadata
- func TypesHaveDescription(schema *ast.SchemaDocument) LintErrorsWithMetadata
- type LintRule
- type LintRuleFunc
- type LintRuleMetadata
Constants ¶
This section is empty.
Variables ¶
var AllTheRules = []LintRuleMetadata{ { typeDesc, "type-desc checks whether all the types defined have description", TypesHaveDescription, }, { argsDesc, "args-desc checks whether arguments have description", ArgumentsHaveDescription, }, { fieldDesc, "field-desc checks whether fields have description", FieldsHaveDescription, }, { enumCaps, "enum-caps checks whether Enum values are all UPPER_CASE", EnumValuesAreAllCaps, }, { enumDesc, "enum-desc checks whether Enum values have description", EnumValuesHaveDescriptions, }, { fieldCamel, "field-camel checks whether fields defined are all camelCase", FieldsAreCamelCased, }, { typeCaps, "type-caps checks whether types defined are Capitalized", TypesAreCapitalized, }, { relayConnType, "relay-conn-type checks if Connection Types follow the Relay Cursor Connections Specification", RelayConnectionTypesSpec, }, { relayConnArgs, "relay-conn-args checks if Connection Args follow of the Relay Cursor Connections Specification", RelayConnectionArgumentsSpec, }, }
AllTheRules is a list of all the lint rules available
Functions ¶
func AvailableRulesWithDescription ¶
func AvailableRulesWithDescription() string
AvailableRulesWithDescription returns the comma separated list of rules with description
Types ¶
type LintErrorWithMetadata ¶
LintErrorWithMetadata represent a lint error. It stores metadata such as Rule for which error happened, position and actual error.
type LintErrorsWithMetadata ¶
type LintErrorsWithMetadata []LintErrorWithMetadata
LintErrorsWithMetadata represent collection of lint errors.
func ArgumentsHaveDescription ¶
func ArgumentsHaveDescription(schema *ast.SchemaDocument) LintErrorsWithMetadata
ArgumentsHaveDescription checks whether arguments have description
func EnumValuesAreAllCaps ¶
func EnumValuesAreAllCaps(schema *ast.SchemaDocument) LintErrorsWithMetadata
EnumValuesAreAllCaps checks whether Enum values are all UPPER_CASE
func EnumValuesHaveDescriptions ¶
func EnumValuesHaveDescriptions(schema *ast.SchemaDocument) LintErrorsWithMetadata
EnumValuesHaveDescriptions checks whether Enum values have description
func FieldsAreCamelCased ¶
func FieldsAreCamelCased(schema *ast.SchemaDocument) LintErrorsWithMetadata
FieldsAreCamelCased checks whether fields defined are all camelCase
func FieldsHaveDescription ¶
func FieldsHaveDescription(schema *ast.SchemaDocument) LintErrorsWithMetadata
FieldsHaveDescription checks whether fields have description
func RelayConnectionArgumentsSpec ¶
func RelayConnectionArgumentsSpec(schema *ast.SchemaDocument) LintErrorsWithMetadata
RelayConnectionArgumentsSpec will validate the schema adheres to section 4 (Arguments) of the Relay Cursor Connections Specification. See https://relay.dev/graphql/connections.htm#sec-Arguments and https://relay.dev/graphql/connections.htm
func RelayConnectionTypesSpec ¶
func RelayConnectionTypesSpec(schema *ast.SchemaDocument) LintErrorsWithMetadata
RelayConnectionTypesSpec will validate the schema adheres to section 2 (Connection Types) of the Relay Cursor Connections Specification. See https://relay.dev/graphql/connections.htm#sec-Connection-Types and https://relay.dev/graphql/connections.htm
func TypesAreCapitalized ¶
func TypesAreCapitalized(schema *ast.SchemaDocument) LintErrorsWithMetadata
TypesAreCapitalized checks whether types defined are Capitalized
func TypesHaveDescription ¶
func TypesHaveDescription(schema *ast.SchemaDocument) LintErrorsWithMetadata
TypesHaveDescription checks whether all the types defined have description
func (LintErrorsWithMetadata) GetSortedErrors ¶
func (e LintErrorsWithMetadata) GetSortedErrors() []LintErrorWithMetadata
GetSortedErrors returns sorted list of errors with metadata. Sorting is done for Line-Column position for lint error
func (LintErrorsWithMetadata) Len ¶
func (e LintErrorsWithMetadata) Len() int
func (LintErrorsWithMetadata) Less ¶
func (e LintErrorsWithMetadata) Less(i, j int) bool
Less returns true if position at which error[i] occurred is before error[j]
func (LintErrorsWithMetadata) Swap ¶
func (e LintErrorsWithMetadata) Swap(i, j int)
Swap swaps values in error list for two given indices
type LintRuleFunc ¶
type LintRuleFunc = func(schema *ast.SchemaDocument) LintErrorsWithMetadata
LintRuleFunc is a short-form for the function signature for every lint Rule function should have
type LintRuleMetadata ¶
type LintRuleMetadata struct {
Name LintRule
RuleFunction LintRuleFunc
// contains filtered or unexported fields
}
LintRuleMetadata holds information for a given lint Rule