Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix false positive case for
no-unused-variables
rule when variable …
…used in a fragment (#653)
- Loading branch information
Dimitri POSTOLOV
committed
Oct 20, 2021
1 parent
ed6644b
commit f713823
Showing
8 changed files
with
147 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-eslint/eslint-plugin': minor | ||
--- | ||
|
||
fix false positive case for `no-unused-variables` rule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fragment UserFields on User { | ||
firstName | ||
posts(limit: $limit, offset: $offset) { | ||
id | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#import UserFields from './no-unused-variables-imported.gql' | ||
|
||
query User($limit: Int!, $offset: Int!) { | ||
user { | ||
id | ||
...UserFields | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { join } from 'path'; | ||
import { GraphQLRuleTester, rules } from '../src'; | ||
|
||
const ruleTester = new GraphQLRuleTester(); | ||
|
||
ruleTester.runGraphQLTests('no-unused-variables', rules['no-unused-variables'], { | ||
valid: [ | ||
{ | ||
filename: join(__dirname, 'mocks/no-unused-variables.gql'), | ||
code: ruleTester.fromMockFile('no-unused-variables.gql'), | ||
parserOptions: { | ||
schema: join(__dirname, 'mocks/user-schema.graphql'), | ||
}, | ||
}, | ||
], | ||
invalid: [], | ||
}); |