- #1540
afea5fe
Thanks @louisscruz! - [naming-convention]: add new optionsrequiredPrefixes
,requiredSuffixes
-
#1467
12f802c
Thanks @B2o5T! - fixrequire-id-when-available
check unions as well -
#1469
6b4e20c
Thanks @B2o5T! - fixno-unreachable-types
ignore types from directive arguments with request locations
- #1443
9916d8d
Thanks @FloEdelmann! - Add newrequire-import-fragment
rule that reports fragments which were not imported via an import expression.
-
#1386
c5fb2dc
Thanks @B2o5T! - The new version no longer crashes on VSCode-ESLint, when schema/siblings contain validation errors, also, GraphQL-ESLint now hasstrict: true
intsconfig.json
and extends@typescript-eslint
recommended config 🚀P.S. GraphQL-ESLint now has its own website, all documentation moved here. Also, it contains a new fancy playground page 💅 for both schema/operations testing https://the-guild.dev/graphql/eslint/play
- #1346
f031f56
Thanks @B2o5T! - report errors on first character for*.vue
/*.svelte
code, due graphql-tag-pluck limitation we can't know right location
-
#1344
8e40946
Thanks @B2o5T! - dependencies updates:- Added dependency
tslib@^2.4.1
↗︎ (todependencies
)
- Added dependency
-
#1344
8e40946
Thanks @B2o5T! - fixschema-all
/operations-all
configs error - ESLint couldn't find the config "./configs/base" addtslib
to dependencies
-
#1335
2e4dfa0
Thanks @B2o5T! - support new ESLint flat config system, exportflatConfigs
-
#1330
bab45cc
Thanks @B2o5T! - add new rulerequire-nullable-fields-with-oneof
-
#1331
0f7afa5
Thanks @B2o5T! - add new rulerequire-type-pattern-with-oneof
-
#1144
43e2861
Thanks @TuvalSimha! - Add new optiongroups
toalphabetize
rule -
#1303
c6d5bb7
Thanks @tshedor! - [require-description] addrootField
option for only field definitions withinQuery
,Mutation
, andSubscription
root types -
#1141
b1f2730
Thanks @TuvalSimha! - add new optionprefix
formatch-document-filename
rule -
#1314
a4f885a
Thanks @B2o5T! - add ESLint suggestions for followinggraphql-js
rules:fields-on-correct-type
known-argument-names
known-type-names
possible-type-extension
scalar-leafs
value-literals-of-correct-type
-
#1316
1f21fc8
Thanks @FloEdelmann! - feat: addlone-executable-definition
to require all queries, mutations, subscriptions and fragments to be located in separate files -
#1338
fedec34
Thanks @B2o5T! - updategraphql-config
to v4.4.0 that no longer requirestypescript
to be installed -
#1334
abcfc14
Thanks @B2o5T! - add new ruleno-one-place-fragments
- #1338
fedec34
Thanks @B2o5T! - dependencies updates:- Updated dependency
graphql-config@^4.4.0
↗︎ (from^4.3.6
, independencies
)
- Updated dependency
-
#1240
6a27f2a
Thanks @renovate! - dependencies updates:- Updated dependency
@graphql-tools/utils@^9.0.0
↗︎ (from^8.12.0
, independencies
)
- Updated dependency
-
#1251
cf659f3
Thanks @B2o5T! - fix increased memory usage for ESLint CLI
- #1222
cf59b0a
Thanks @B2o5T! - feat: reload schema/documents cache (only for current project) in VSCode
-
#1201
ba26511
Thanks @B2o5T! - dependencies updates:- Updated dependency
graphql-config@^4.3.6
↗︎ (from^4.3.5
, independencies
)
- Updated dependency
-
#1198
2886adf
Thanks @B2o5T! - fix passing pluck config viagraphql-config#extensions
field renameextensions.graphqlTagPluck
toextensions.pluckConfig
fix performance regression while usingprocessor: '@graphql-eslint/graphql'
- #1170
0b8acdc
Thanks @B2o5T! - fix race condition of loadingloadGraphQLConfig()
whenprocessor.preprocess()
can be called beforeparseForESLint()
-
#1168
9bc4e1b
Thanks @B2o5T! - return code as-is inpreprocess
in case of parsing error, sort eslint/graphql-eslint errors inpostprocess
by line/column -
#1165
eab5492
Thanks @B2o5T! - fix race condition ofloadGraphQLConfig()
-
#1167
2f6c02f
Thanks @B2o5T! - makeRuleDocsInfo
type optional
-
#1156
6ac42cf
Thanks @JimmyPaolini! - Using configuration options forgraphql-tag-pluck
throughgraphql-config
Allow setup customglobalGqlIdentifierName
,modules.identifier
andgqlMagicComment
-
#1163
0d3fe5b
Thanks @B2o5T! - improveRuleDocsInfo
type, setdescription
andurl
as required fields
- b6de7ff: fix(GraphQLRuleTester): provide output field for
GraphQLInvalidTestCase
type
- 39ab684: fix(alphabetize): should not fail when selection is aliased
- 712a8fe: fix(selection-set-depth): fix
TypeError
from ESLint suggestions, don't provide suggestions for fragment that can be in a separate file - 01421ae: fix(no-unreachable-types): ignore directives with Request Definitions locations
- 5593891: fix(known-directives): support
ignoreClientDirectives
forOperationDefinition
- 8a3b584: fix broken report highlighting when processor is used
- daa04bb: feat: support select
id
field with an alias inrequire-id-when-available
rule - 2efc772: fix: processor should always return code string in preprocess method
- cf687a5: [relay-page-info]: allow nullable
startCursor
andendCursor
if there are no results
- 7251269: feat: new rule
relay-connection-types
- 7251269: feat: new rule
relay-edge-types
- 7251269: feat: new rule
relay-page-info
- 7251269: feat: new rule
relay-arguments
- 7251269: feat: new config
plugin:@graphql-eslint/relay
- 7251269: fix: adjust suggestion fix location for code-files
- edbec90: feat: update
graphql-config
to fix loading schema via url
- 4bcee4a: fix: surface the original error while loading schema in ESLint server
- 4bcee4a: fix: clarify error message for outdated version of
graphql
package - 3e821de: fix: allow single letter for snake_case and UPPER_CASE in
naming-convention
rule
Special thanks to @connorjs
- 56d6ff3: [known-fragment-names]: fix when fragment used on interface and union
- 3fe3761: print debug information with
DEBUG
env variable, exampleDEBUG=graphql-eslint:* eslint .
- 9c575c6: feat: add
definitions
option foralphabetize
rule - bcbda42: feat: add suggestions for
require-id-when-available
,require-deprecation-date
,no-deprecated
andno-scalar-result-type-on-mutation
rules - 1f697f0: feat: add suggestions for
no-duplicate-fields
,no-hashtag-description
andselection-set-depth
rules - db22ba5: feat: add suggestions for
no-typename-prefix
,no-root-type
,no-case-insensitive-enum-values-duplicates
rules - b04a8d5: feat: add
ignoreClientDirectives
option forknown-directives
rule - 63c5c78: feat: add suggestions for
description-style
,input-name
andno-anonymous-operations
rules
- 58b5bfd: fix: false negative case when nested fragments used in
require-id-when-available
rule - 2cbaa60: fix: check nested selections in fragments in
require-id-when-available
rule - d9386ad: fix autofix sort for variables in
alphabetize
rule
- 0da135f: feat: add new option
OperationDefinition
inrequire-description
rule - 1729313: feat: add autofix for
alphabetize
rule and change sort order to lexicographic - d9bdbd3: feat: add new style
matchDocumentStyle
formatch-document-filename
rule
- 7a5ebe0: fix error in
no-unreachable-types
rule on graphql@16.3.0 - af22d9d: chore: clarify report message for
require-description
rule - 1729313: fix ESTree parser, convert
loc.column
to 0-based column number
- 6f8c3b6: fix: find graphqlrc files relative to linted file
- 624d604: fix: ignore root types in
strict-id-in-types
rule
- cc9a561: feat: ignore fragments in
require-id-when-available
rule
- 75ec7d1: fix false positive case in
possible-type-extension
rule when schema is separate into multiple files
- b4c5d55: feat: add new option ignorePattern for
naming-convention
rule - f20f7de: feat: remove the need of
#import
comments in favor ofparserOptions.operations
- 2c73cb7: feat: add suggestions for
naming-convention
rule - 11b3af6: feat: support multiple id field names in
require-id-when-available
rule
- 503dd9f: fix error report location for
graphql-js
rules - 9378d24: Fix exports in package.json for react-native projects
- 37c1579: feat: convert fix to suggestions in
no-unreachable-types
andno-unused-fields
rules
- 988e445: fix: ignore operations and fragments in
no-hashtag-description
rule
- 32ec2cb: fix: ignore arguments in
require-field-of-type-query-in-mutation-result
rule - 5a259ce: chore: remove
unique-enum-value-names
rule from recommended config - 36d5334: fix: ignore arguments in
no-scalar-result-type-on-mutation
rule
-
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
andall
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) development
If 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 styleblock
. -
a69f0be: ❗ BREAKING CHANGE ❗
feat: remove
query
option inno-root-type
as it's impossible to have write-only schema. -
a69f0be: ❗ BREAKING CHANGE ❗
- rename
avoid
prefix in rules tono
. - remove
avoid-operation-name-prefix
andno-operation-name-suffix
All rules that had a
avoid
prefix now have ano
prefix.Rules
avoid-operation-name-prefix
andno-operation-name-suffix
were removed because the same things can be validated bynaming-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"] } } ] }
- rename
-
a69f0be: ❗ BREAKING CHANGE ❗
feat: add new options for
naming-convention
ruleOptions for
naming-convention
are changed. New optiontypes
includes the following kinds:ObjectTypeDefinition
InterfaceTypeDefinition
EnumTypeDefinition
ScalarTypeDefinition
InputObjectTypeDefinition
UnionTypeDefinition
Added new options:
Argument
DirectiveDefinition
VariableDefinition
Option
QueryDefinition
was removed in favor ofAST
specific selectorFieldDefinition[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
ruleOptions for
require-description
are changed. New optiontypes
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 } ] }
- 64c302c: feat: add new rule
no-root-type
- c837c99: fix false positive case in
no-unreachable-types
rule when directive on root schema is used - 1914d6a: fix false positive case in
known-fragment-names
when import nested fragment
- 4c29de7: fix: make works graphql-eslint in yarn berry
- dc29c27: update graphql-js peer dependency range
- 81fae5a: GraphQL v16 support
- 86b3709: fix error report for
no-unused-fields
andno-unreachable-types
rule - cf3cc4f: fix error report for
require-deprecation-reason
andrequire-field-of-type-query-in-mutation-result
rule - 578b890: fix error report for
require-deprecation-date
rule - ebab010: fix error report for
alphabetize
rule - 7dacfe5: fix error report for
avoid-scalar-result-type-on-mutation
rule - f712780: fix error report for
unique-fragment-name
andunique-operation-name
rule - d081fcc: fix error report for
selection-set-depth
rule and forgraphql-js
rules - 46f03f7: fix error report for
description-style
rule - b36a32c: fix error report for
strict-id-in-types
andnaming-convention
rule - 7aa8157: fix error report for
input-name
rule - a285de3: fix error report for
require-deprecation-reason
andrequire-field-of-type-query-in-mutation-result
rule - ced6789: fix error report for
no-deprecated
rule
- 98b6bcb: fix: adjust report location for
no-operation-name-suffix
rule - 1bacedd: fix: adjust report location for
no-anonymous-operations
rule - c42cee5: fix: adjust report location for
avoid-typename-prefix
rule - eb4a851: fix: adjust report location for
require-description
rule
- f2a6635: add new rule
require-field-of-type-query-in-mutation-result
- 44a6c73: fix false negative case for
no-undefined-variables
rule - ed6644b: feat: support ESLint 8
- f713823: fix false positive case for
no-unused-variables
rule - c7a8b33: add new rule
alphabetize
- 1dd2f43: feat: add recommended and all configs
- 1dd2f43: add new rule require-deprecation-date
- 1dd2f43: add new rule avoid-scalar-result-type-on-mutation
- c6886ba: [New rule] Compare operation/fragment name to the file name
- 2032a66: fix
no-unreachable-types
rule when interface implementing other interface
- c6886ba: NEW PLUGIN: Compare operation/fragment name to the file name
- 7b12bbf: fix(no-hashtag-description): allow hashtag comments between fields and arguments
- 403b946: enhance(eslint-plugin): refactor the parts using tools
- 0fb8d51: Update range of graphql-config and graphql-tools to fix documents loading issues
- 17014ee: Drop support for Node 10, update to latest graphql-tools
- c0b12a5: fix(siblings): return virtual path for code files instead of real path
- 3701b2a: use
graphql-config
even there is nographql-config
consmiconfig file - 44f0d73: fix false negative cases for
no-unreachable-types
rule - 5065482: fix caching for
no-unreachable-types
andno-unused-fields
rules - 5e8ebd8: add tests for schema loaders
- 34b4300: fix(graphql-config): pass real filepath to
gqlConfig.getProjectForFile
- ca8b521: fix: code filepath in unique-fragment-name and unique-operation-name rules
- e7d8496: fix: documents in graphql-config can be null
- f428d46: feat: improve generate-docs and types
- 5a7e9a7: fix comments in files that contains import comments
- 4348dcc: update eslint, various improvements
- 01ade2e: fix unique-fragment-name and no-unused-fragments rule
- a44d426: support #import in known-fragment-names rule
- 85d842e: add
no-unused-fields
rule - 6b5b90b: graphql-js migrate to .ts, fix links
- f0560b0: Fix for missing exports for testkit
- 1d85025: fix: allow anonymous operations for naming-convention rule
- a92267b: fixes for graphql-js rules issues
- 45acfde: Fix console.warn typo in selection-set-depth rule
- 533d123: Fix issues with Windows paths
-
14211d6: feat: remove
prettier
rule, add related docsSince prettier itself support now linting GraphQL code and syntax, we removed the need for this rule from this package.
For more information, see:
-
61251e7: BREAKING CHANGE: Remove deprecated rule
validate-against-schema
.If you are using
validate-against-schema
, please remove it and specify the exact rules that you need.As a drop-in replacement for the whole set of rules we had in
validate-against-schema
, you can use this:
"@graphql-eslint/executable-definitions": "error",
"@graphql-eslint/fields-on-correct-type": "error",
"@graphql-eslint/fragments-on-composite-type": "error",
"@graphql-eslint/known-argument-names": "error",
"@graphql-eslint/known-directives": "error",
"@graphql-eslint/known-fragment-names": "error",
"@graphql-eslint/known-type-names": "error",
"@graphql-eslint/lone-anonymous-operation": "error",
"@graphql-eslint/lone-schema-definition": "error",
"@graphql-eslint/no-fragment-cycles": "error",
"@graphql-eslint/no-undefined-variables": "error",
"@graphql-eslint/no-unused-fragments": "error",
"@graphql-eslint/no-unused-variables": "error",
"@graphql-eslint/overlapping-fields-can-be-merged": "error",
"@graphql-eslint/possible-fragment-spread": "error",
"@graphql-eslint/possible-type-extension": "error",
"@graphql-eslint/provided-required-arguments": "error",
"@graphql-eslint/scalar-leafs": "error",
"@graphql-eslint/one-field-subscriptions": "error",
"@graphql-eslint/unique-argument-names": "error",
"@graphql-eslint/unique-directive-names": "error",
"@graphql-eslint/unique-directive-names-per-location": "error",
"@graphql-eslint/unique-enum-value-names": "error",
"@graphql-eslint/unique-field-definition-names": "error",
"@graphql-eslint/unique-input-field-names": "error",
"@graphql-eslint/unique-operation-types": "error",
"@graphql-eslint/unique-type-names": "error",
"@graphql-eslint/unique-variable-names": "error",
"@graphql-eslint/value-literals-of-correct-type": "error",
"@graphql-eslint/variables-are-input-types": "error",
"@graphql-eslint/variables-in-allowed-position": "error"
- 61251e7: Bump dependencies and update minimum Node version to
v12
- 63dc00a: NEW RULE: avoid-typename-prefix
-
9a40163: Fix issues with
avoid-operation-name-prefix
and error with caseSensitive -
1257d51: fix: original file should not be considered as file block
Related #88
ESLint supports
text
directly, no need to use the hacky way. See https://github.com/eslint/eslint/blob/master/lib/linter/linter.js#L1298Related
eslint-plugin-prettier
's issue hae been fixed at prettier/eslint-plugin-prettier#401 -
6d4a356: Fix loadSiblings file location
-
388a0bf: Support OperationDefinition in naming-convention rule
-
5ff184b: Fix issues with
lone-schema-definition
rule -
7a04e1e: Added support for direcrives in
no-unreachable-types
rule -
ef8d776: Fix errors always thrown with unique-type-names rule
- beb3b14: Support possible types in no-unreachable-types rule
- 4693f27: [New rule] strict-id-in-types: use this to enforce output types to have a unique indentifier field unless being in exceptions
- 46742f0: no-hashtag-description allows eslint directives
- 77eafd2: no-unreachable-types pass if type implements reachable interface
- 13fd2fa: Fix compatibility issues with graphql v14
- 5b35139: Add options to input-name rule.
- 46d759e: [naming-convention] Add forbiddenPrefixes and forbiddenSuffixes options. Add QueryDefinition which targets queries ( may break existing config if FieldDefinition is used )
- 619d9eb: fix for
no-unreachable-types
does not recognize implemented interfaces - 2f6313b: Fix issues with built artifact containing parts of graphql-js library
- 80f9090: Fix missing "no-unreachable-types"
- a5e1e6e: Fix issues with processor parsing errors breaking the eslint execution
- 5e1bbe6: NEW RULE: avoid-duplicate-fields
- b093f88: NEW RULE: selection-set-depth
- 2df9134: NEW RULE: no-hashtag-description
- 625f083: New rule: no-unreachable-types
- 174a66f: [naming-convention] Allow each definition to take either a strng or object. Object can take the following keys: style (naming style), prefix (value must have prefix) and suffix (value must have suffix)
- d3ff768: NEW RULE: no-deprecated
- 63cecdd: Added code file compatibility for graphql-config projects
- 0094548: Load graphql config file only once
- e26a5d4: Fix issues with loading schemas from code-files
- e6edc88: Added prefix to error thrown by the parser
- 1594288: Improve error messages for parserServices
- 4942b58: Optimisation of sibling operations loading (cache by project)
- 2df9134: Fixed missing
loc
property when rawNode is called on Document node - a57d4f5: fix(naming-convention): fix issues with numeric values
- e9d1d53: NEW RULE: unique-operation-name
- e9d1d53: Port all graphql-js validation rules to standalone rules
- e9d1d53: New rule: unique-fragment-name
- e9d1d53: Fix issues with AST converter and root Document causing to invalid ASTs when rawNode is called
- e9d1d53: Fix issue with siblings operations and getOperation method
- 937b322: test release
- 937b322: Allow to load siblings operations
- 937b322: feature(processor): apply processor automatically on code files
- 937b322: Fix processor compatibility with other plugins
- 937b322: Better integration of siblings operations and graphql-config
- 937b322: fix(parser): better performance, make sure schema is loaded and cached
- 937b322: fix(parser): better support for graphql-config intergration and project detection
- c9bbdbe: Added
supportsAutofix
to the processor. Fixes can be applied in JS,TS files now.
- 0fe0f68: Fix a bug in the input-name rule to make sure it only checks fields on the Mutation type
- 0dab062: [require-id-when-available] fix for inline fragments on interfaces (#139)
- 52a98df: Ignore NoUnusedFragmentsRule validation for fragments operations
- 52a98df: Improve error reported from validate-against-schema (added the rule name to the error)
- 80e922c: Improved
validate-against-schema
rule configuration (allow to customize rules)
- 80e922c: Fix issues with
.rawNode()
values
- 2b87cb1: Fix compatibility with GraphQL v14
- da77db6: Fix
schemaOptions
support
- 9f0ab04: Fixes README and missing docs in published package
- 3838852: Initial minor release from this repo.
- 5809bdc: Fixes for docs and package publish