Skip to content

Commit

Permalink
Disable NoUnusedVariablesRule by default to relay
Browse files Browse the repository at this point in the history
  • Loading branch information
gtkatakura committed Mar 11, 2021
1 parent c465fed commit c99d1b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`*)
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ const envGraphQLValidatorNames = {
"KnownFragmentNames",
"NoUndefinedVariables",
"NoUnusedFragments",
"NoUnusedVariables",
// `graphql`@15
"KnownDirectivesRule",
"KnownFragmentNamesRule",
"NoUndefinedVariablesRule",
"NoUnusedFragmentsRule",
"NoUnusedVariablesRule",
// `graphql` < 14
"ProvidedNonNullArguments",
// `graphql`@14
Expand Down
11 changes: 11 additions & 0 deletions test/env/relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })),

Expand Down

0 comments on commit c99d1b3

Please sign in to comment.