diff --git a/CHANGELOG.md b/CHANGELOG.md index b6fdc92e..39eb7fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### vNEXT -- _Nothing yet!_ +- Disable `NoUnusedVariables` validator by default into `relay` mode. [PR #298](https://github.com/apollographql/eslint-plugin-graphql/pull/298) by [gtkatakura](https://github.com/gtkatakura) ### v4.0.0 diff --git a/README.md b/README.md index a85a642a..4007c7b0 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ The full list of available validators is: - `NoFragmentCycles` - `NoUndefinedVariables` (*disabled by default in `relay`*) - `NoUnusedFragments` (*disabled by default in all envs*) - - `NoUnusedVariables` + - `NoUnusedVariables` (*disabled by default in `relay`*) - `OverlappingFieldsCanBeMerged` - `PossibleFragmentSpreads` - `ProvidedRequiredArguments` (*disabled by default in `relay`*) diff --git a/src/index.js b/src/index.js index 144db0b6..267f53b7 100644 --- a/src/index.js +++ b/src/index.js @@ -49,11 +49,13 @@ const envGraphQLValidatorNames = { "KnownFragmentNames", "NoUndefinedVariables", "NoUnusedFragments", + "NoUnusedVariables", // `graphql`@15 "KnownDirectivesRule", "KnownFragmentNamesRule", "NoUndefinedVariablesRule", "NoUnusedFragmentsRule", + "NoUnusedVariablesRule", // `graphql` < 14 "ProvidedNonNullArguments", // `graphql`@14 diff --git a/test/env/relay.js b/test/env/relay.js index 214c134a..0597a99b 100644 --- a/test/env/relay.js +++ b/test/env/relay.js @@ -97,6 +97,17 @@ ruleTester.run('relay', rule, { events } }\` + `, + ` + Relay.QL\` + query StoresListQuery( + $count: Int + $cursor: String + $search: String + ) { + ...StoresList_stores + } + \` ` ].map((code) => ({ options, parser, code })),