ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL tools.
MIT License
Bot releases are visible (Hide)
Published by github-actions[bot] almost 3 years ago
no-unreachable-types
and no-unused-fields
rulesno-hashtag-description
rulePublished by github-actions[bot] almost 3 years ago
require-field-of-type-query-in-mutation-result
ruleunique-enum-value-names
rule from recommended configno-scalar-result-type-on-mutation
rulePublished by github-actions[bot] almost 3 years ago
a69f0be: ❗ BREAKING CHANGE ❗
Split recommended
config to 2 modes: "schema" and "operations".
This was done in order to use
recommended
andall
configs inschema-only
projects where it is not possible to provide operations.
recommended
and all
configs were divided to 4 configs:
schema-recommended
- enables recommended rules for schema (SDL) developmentschema-all
- enables all rules for schema (SDL) developmentoperations-recommended
- enables recommended rules for consuming GraphQL (operations) developmentoperations-all
- enables all rules for consuming GraphQL (operations) developmentIf you are migrating from v2 where recommended
was introduced, please change the following:
{
"overrides": [
{
"files": ["*.js"],
"processor": "@graphql-eslint/graphql"
},
{
"files": ["*.graphql"],
- "extends": "plugin:@graphql-eslint/recommended"
+ "extends": "plugin:@graphql-eslint/schema-recommended"
}
]
}
If you are in a project that develops the GraphQL schema, you'll need
schema
rules.
If you are in a project that develops GraphQL operations (query/mutation/subscription), you'll need
operations
rules.
If you are in a monorepo project, you probably need both sets of rules.
a69f0be: ❗ BREAKING CHANGE ❗
feat: description-style
now have default description style block
.
a69f0be: ❗ BREAKING CHANGE ❗
feat: remove query
option in no-root-type
as it's impossible to have write-only schema.
a69f0be: ❗ BREAKING CHANGE ❗
avoid
prefix in rules to no
.avoid-operation-name-prefix
and no-operation-name-suffix
All rules that had a avoid
prefix now have a no
prefix.
Rules avoid-operation-name-prefix
and no-operation-name-suffix
were removed because the same things can be validated by naming-convention
rule.
{
"@graphql-eslint/avoid-operation-name-prefix": [
"error",
{
"keywords": ["Query", "Mutation", "Subscription", "Get"]
}
],
"@graphql-eslint/no-operation-name-suffix": "error"
}
{
"@graphql-eslint/naming-convention": [
"error",
{
"OperationDefinition": {
"style": "PascalCase",
"forbiddenPrefixes": ["Query", "Mutation", "Subscription", "Get"],
"forbiddenSuffixes": ["Query", "Mutation", "Subscription"]
}
}
]
}
a69f0be: ❗ BREAKING CHANGE ❗
feat: add new options for naming-convention
rule
Options for naming-convention
are changed. New option types
includes the following kinds:
ObjectTypeDefinition
InterfaceTypeDefinition
EnumTypeDefinition
ScalarTypeDefinition
InputObjectTypeDefinition
UnionTypeDefinition
Added new options:
Argument
DirectiveDefinition
VariableDefinition
Option QueryDefinition
was removed in favor of AST
specific selector FieldDefinition[parent.name.value=Query]
.
{
"@graphql-eslint/naming-convention": [
"error",
{
"ObjectTypeDefinition": "PascalCase",
"InterfaceTypeDefinition": "PascalCase",
"EnumTypeDefinition": "PascalCase",
"ScalarTypeDefinition": "PascalCase",
"InputObjectTypeDefinition": "PascalCase",
"UnionTypeDefinition": "PascalCase",
"FieldDefinition": "camelCase",
"InputValueDefinition": "camelCase",
"QueryDefinition": {
"forbiddenPrefixes": ["get"]
},
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
}
]
}
{
"@graphql-eslint/naming-convention": [
"error",
{
"types": "PascalCase",
"FieldDefinition": "camelCase",
"InputValueDefinition": "camelCase",
"FieldDefinition[parent.name.value=Query]": {
"forbiddenPrefixes": ["get"]
},
"allowLeadingUnderscore": true,
"allowTrailingUnderscore": true
}
]
}
a69f0be: ❗ BREAKING CHANGE ❗
feat: add new options for require-description
rule
Options for require-description
are changed. New option types
includes the following kinds:
ObjectTypeDefinition
InterfaceTypeDefinition
EnumTypeDefinition
ScalarTypeDefinition
(new in v3)InputObjectTypeDefinition
UnionTypeDefinition
{
"@graphql-eslint/require-description": [
"error",
{
"on": [
"ObjectTypeDefinition",
"InterfaceTypeDefinition",
"EnumTypeDefinition",
"InputObjectTypeDefinition",
"UnionTypeDefinition",
"FieldDefinition",
"InputValueDefinition",
"EnumValueDefinition",
"DirectiveDefinition"
]
}
]
}
{
"@graphql-eslint/require-description": [
"error",
{
"types": true,
"FieldDefinition": true,
"InputValueDefinition": true,
"EnumValueDefinition": true,
"DirectiveDefinition": true
}
]
}
Published by github-actions[bot] almost 3 years ago
no-root-type
no-unreachable-types
rule when directive on root schema is usedknown-fragment-names
when import nested fragmentPublished by github-actions[bot] almost 3 years ago
Published by github-actions[bot] almost 3 years ago
Published by github-actions[bot] almost 3 years ago
no-unused-fields
and no-unreachable-types
rulerequire-deprecation-reason
and require-field-of-type-query-in-mutation-result
rulerequire-deprecation-date
rulealphabetize
ruleavoid-scalar-result-type-on-mutation
ruleunique-fragment-name
and unique-operation-name
ruleselection-set-depth
rule and for graphql-js
rulesdescription-style
rulestrict-id-in-types
and naming-convention
ruleinput-name
rulerequire-deprecation-reason
and require-field-of-type-query-in-mutation-result
ruleno-deprecated
rulePublished by github-actions[bot] almost 3 years ago
no-operation-name-suffix
ruleno-anonymous-operations
ruleavoid-typename-prefix
rulerequire-description
rulePublished by github-actions[bot] almost 3 years ago
require-field-of-type-query-in-mutation-result
no-undefined-variables
ruleno-unused-variables
rulealphabetize
Published by github-actions[bot] about 3 years ago
Published by github-actions[bot] about 3 years ago
no-unreachable-types
rule when interface implementing other interfacePublished by github-actions[bot] about 3 years ago
Published by github-actions[bot] about 3 years ago
Published by github-actions[bot] about 3 years ago
graphql-config
even there is no graphql-config
consmiconfig fileno-unreachable-types
ruleno-unreachable-types
and no-unused-fields
rulesPublished by github-actions[bot] over 3 years ago
gqlConfig.getProjectForFile
Published by github-actions[bot] over 3 years ago
Published by github-actions[bot] over 3 years ago
Published by github-actions[bot] over 3 years ago
Published by github-actions[bot] over 3 years ago
Published by github-actions[bot] over 3 years ago
no-unused-fields
rule