...
1- name: uses all variables
2 rule: NoUnusedVariables
3 schema: 0
4 query: |2-
5
6 query ($a: String, $b: String, $c: String) {
7 field(a: $a, b: $b, c: $c)
8 }
9
10 errors: []
11- name: uses all variables deeply
12 rule: NoUnusedVariables
13 schema: 0
14 query: |2-
15
16 query Foo($a: String, $b: String, $c: String) {
17 field(a: $a) {
18 field(b: $b) {
19 field(c: $c)
20 }
21 }
22 }
23
24 errors: []
25- name: uses all variables deeply in inline fragments
26 rule: NoUnusedVariables
27 schema: 0
28 query: |2-
29
30 query Foo($a: String, $b: String, $c: String) {
31 ... on Type {
32 field(a: $a) {
33 field(b: $b) {
34 ... on Type {
35 field(c: $c)
36 }
37 }
38 }
39 }
40 }
41
42 errors: []
43- name: uses all variables in fragments
44 rule: NoUnusedVariables
45 schema: 0
46 query: |2-
47
48 query Foo($a: String, $b: String, $c: String) {
49 ...FragA
50 }
51 fragment FragA on Type {
52 field(a: $a) {
53 ...FragB
54 }
55 }
56 fragment FragB on Type {
57 field(b: $b) {
58 ...FragC
59 }
60 }
61 fragment FragC on Type {
62 field(c: $c)
63 }
64
65 errors: []
66- name: variable used by fragment in multiple operations
67 rule: NoUnusedVariables
68 schema: 0
69 query: |2-
70
71 query Foo($a: String) {
72 ...FragA
73 }
74 query Bar($b: String) {
75 ...FragB
76 }
77 fragment FragA on Type {
78 field(a: $a)
79 }
80 fragment FragB on Type {
81 field(b: $b)
82 }
83
84 errors: []
85- name: variable used by recursive fragment
86 rule: NoUnusedVariables
87 schema: 0
88 query: |2-
89
90 query Foo($a: String) {
91 ...FragA
92 }
93 fragment FragA on Type {
94 field(a: $a) {
95 ...FragA
96 }
97 }
98
99 errors: []
100- name: variable not used
101 rule: NoUnusedVariables
102 schema: 0
103 query: |2-
104
105 query ($a: String, $b: String, $c: String) {
106 field(a: $a, b: $b)
107 }
108
109 errors:
110 - message: Variable "$c" is never used.
111 locations:
112 - {line: 2, column: 38}
113- name: multiple variables not used
114 rule: NoUnusedVariables
115 schema: 0
116 query: |2-
117
118 query Foo($a: String, $b: String, $c: String) {
119 field(b: $b)
120 }
121
122 errors:
123 - message: Variable "$a" is never used in operation "Foo".
124 locations:
125 - {line: 2, column: 17}
126 - message: Variable "$c" is never used in operation "Foo".
127 locations:
128 - {line: 2, column: 41}
129- name: variable not used in fragments
130 rule: NoUnusedVariables
131 schema: 0
132 query: |2-
133
134 query Foo($a: String, $b: String, $c: String) {
135 ...FragA
136 }
137 fragment FragA on Type {
138 field(a: $a) {
139 ...FragB
140 }
141 }
142 fragment FragB on Type {
143 field(b: $b) {
144 ...FragC
145 }
146 }
147 fragment FragC on Type {
148 field
149 }
150
151 errors:
152 - message: Variable "$c" is never used in operation "Foo".
153 locations:
154 - {line: 2, column: 41}
155- name: multiple variables not used in fragments
156 rule: NoUnusedVariables
157 schema: 0
158 query: |2-
159
160 query Foo($a: String, $b: String, $c: String) {
161 ...FragA
162 }
163 fragment FragA on Type {
164 field {
165 ...FragB
166 }
167 }
168 fragment FragB on Type {
169 field(b: $b) {
170 ...FragC
171 }
172 }
173 fragment FragC on Type {
174 field
175 }
176
177 errors:
178 - message: Variable "$a" is never used in operation "Foo".
179 locations:
180 - {line: 2, column: 17}
181 - message: Variable "$c" is never used in operation "Foo".
182 locations:
183 - {line: 2, column: 41}
184- name: variable not used by unreferenced fragment
185 rule: NoUnusedVariables
186 schema: 0
187 query: |2-
188
189 query Foo($b: String) {
190 ...FragA
191 }
192 fragment FragA on Type {
193 field(a: $a)
194 }
195 fragment FragB on Type {
196 field(b: $b)
197 }
198
199 errors:
200 - message: Variable "$b" is never used in operation "Foo".
201 locations:
202 - {line: 2, column: 17}
203- name: variable not used by fragment used by other operation
204 rule: NoUnusedVariables
205 schema: 0
206 query: |2-
207
208 query Foo($b: String) {
209 ...FragA
210 }
211 query Bar($a: String) {
212 ...FragB
213 }
214 fragment FragA on Type {
215 field(a: $a)
216 }
217 fragment FragB on Type {
218 field(b: $b)
219 }
220
221 errors:
222 - message: Variable "$b" is never used in operation "Foo".
223 locations:
224 - {line: 2, column: 17}
225 - message: Variable "$a" is never used in operation "Bar".
226 locations:
227 - {line: 5, column: 17}
View as plain text