@graphql-eslint/eslint-plugin 4.0.0-alpha.1 → 4.0.0-alpha.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. package/README.md +2 -0
  2. package/{esm/cache.d.mts → cjs/cache.d.cts} +1 -1
  3. package/cjs/cache.js +8 -36
  4. package/cjs/chunk-UIAXBAMD.js +8 -0
  5. package/cjs/configs/index.d.cts +24 -0
  6. package/cjs/configs/index.js +35 -38
  7. package/cjs/configs/operations-all.js +33 -26
  8. package/cjs/configs/operations-recommended.js +59 -52
  9. package/cjs/configs/schema-all.js +29 -22
  10. package/cjs/configs/schema-recommended.js +73 -66
  11. package/cjs/configs/schema-relay.js +17 -10
  12. package/cjs/documents.js +18 -38
  13. package/{esm/estree-converter/converter.d.mts → cjs/estree-converter/converter.d.cts} +1 -1
  14. package/cjs/estree-converter/converter.js +16 -30
  15. package/cjs/estree-converter/index.d.cts +8 -0
  16. package/cjs/estree-converter/index.js +3 -23
  17. package/cjs/estree-converter/types.js +1 -14
  18. package/{esm/estree-converter/utils.d.mts → cjs/estree-converter/utils.d.cts} +3 -3
  19. package/cjs/estree-converter/utils.js +22 -40
  20. package/{esm/graphql-config.d.mts → cjs/graphql-config.d.cts} +3 -3
  21. package/cjs/graphql-config.js +16 -42
  22. package/cjs/index.d.cts +186 -0
  23. package/cjs/index.js +24 -41
  24. package/cjs/meta.d.cts +3 -0
  25. package/cjs/meta.js +5 -0
  26. package/cjs/package.json +1 -0
  27. package/{esm/parser.d.mts → cjs/parser.d.cts} +11 -4
  28. package/cjs/parser.js +35 -46
  29. package/{esm/processor.d.mts → cjs/processor.d.cts} +4 -0
  30. package/cjs/processor.js +25 -34
  31. package/{esm/rules/alphabetize.d.mts → cjs/rules/alphabetize/index.d.cts} +4 -4
  32. package/cjs/rules/{alphabetize.js → alphabetize/index.js} +69 -77
  33. package/{esm/rules/description-style.d.mts → cjs/rules/description-style/index.d.cts} +3 -3
  34. package/cjs/rules/{description-style.js → description-style/index.js} +7 -27
  35. package/{esm/rules/graphql-js-validation.d.mts → cjs/rules/graphql-js-validation.d.cts} +3 -3
  36. package/cjs/rules/graphql-js-validation.js +93 -70
  37. package/cjs/rules/{index.d.ts → index.d.cts} +17 -15
  38. package/cjs/rules/index.js +74 -60
  39. package/cjs/rules/{input-name.d.ts → input-name/index.d.cts} +6 -4
  40. package/cjs/rules/{input-name.js → input-name/index.js} +10 -28
  41. package/cjs/rules/{lone-executable-definition.d.ts → lone-executable-definition/index.d.cts} +3 -3
  42. package/cjs/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +13 -32
  43. package/cjs/rules/{match-document-filename.d.ts → match-document-filename/index.d.cts} +4 -4
  44. package/cjs/rules/{match-document-filename.js → match-document-filename/index.js} +21 -35
  45. package/{esm/rules/naming-convention.d.mts → cjs/rules/naming-convention/index.d.cts} +6 -4
  46. package/cjs/rules/{naming-convention.js → naming-convention/index.js} +41 -54
  47. package/cjs/rules/no-anonymous-operations/index.d.cts +13 -0
  48. package/cjs/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +9 -28
  49. package/{esm/rules/no-deprecated.d.mts → cjs/rules/no-deprecated/index.d.cts} +3 -3
  50. package/cjs/rules/{no-deprecated.js → no-deprecated/index.js} +11 -30
  51. package/cjs/rules/no-duplicate-fields/index.d.cts +13 -0
  52. package/cjs/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +8 -28
  53. package/cjs/rules/{no-hashtag-description.d.ts → no-hashtag-description/index.d.cts} +3 -3
  54. package/cjs/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +11 -31
  55. package/cjs/rules/no-one-place-fragments/index.d.cts +13 -0
  56. package/cjs/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +11 -29
  57. package/cjs/rules/{no-root-type.d.ts → no-root-type/index.d.cts} +3 -3
  58. package/cjs/rules/{no-root-type.js → no-root-type/index.js} +9 -29
  59. package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +13 -0
  60. package/cjs/rules/no-scalar-result-type-on-mutation/index.js +69 -0
  61. package/cjs/rules/no-typename-prefix/index.d.cts +13 -0
  62. package/cjs/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +5 -25
  63. package/cjs/rules/no-unreachable-types/index.d.cts +13 -0
  64. package/cjs/rules/no-unreachable-types/index.js +155 -0
  65. package/cjs/rules/no-unused-fields/index.d.cts +34 -0
  66. package/cjs/rules/no-unused-fields/index.js +224 -0
  67. package/{esm/rules/relay-arguments.d.mts → cjs/rules/relay-arguments/index.d.cts} +3 -3
  68. package/cjs/rules/{relay-arguments.js → relay-arguments/index.js} +11 -30
  69. package/{esm/rules/relay-connection-types.d.mts → cjs/rules/relay-connection-types/index.d.cts} +3 -3
  70. package/cjs/rules/{relay-connection-types.js → relay-connection-types/index.js} +19 -40
  71. package/cjs/rules/{relay-edge-types.d.ts → relay-edge-types/index.d.cts} +6 -4
  72. package/cjs/rules/{relay-edge-types.js → relay-edge-types/index.js} +31 -44
  73. package/cjs/rules/relay-page-info/index.d.cts +13 -0
  74. package/cjs/rules/{relay-page-info.js → relay-page-info/index.js} +13 -31
  75. package/{esm/rules/require-deprecation-date.d.mts → cjs/rules/require-deprecation-date/index.d.cts} +3 -3
  76. package/cjs/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +13 -32
  77. package/cjs/rules/require-deprecation-reason/index.d.cts +13 -0
  78. package/cjs/rules/require-deprecation-reason/index.js +66 -0
  79. package/{esm/rules/require-description.d.mts → cjs/rules/require-description/index.d.cts} +3 -3
  80. package/cjs/rules/{require-description.js → require-description/index.js} +30 -44
  81. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +13 -0
  82. package/cjs/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +10 -29
  83. package/cjs/rules/require-import-fragment/index.d.cts +13 -0
  84. package/cjs/rules/{require-import-fragment.js → require-import-fragment/index.js} +16 -38
  85. package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +13 -0
  86. package/cjs/rules/require-nullable-fields-with-oneof/index.js +62 -0
  87. package/cjs/rules/require-nullable-result-in-root/index.d.cts +13 -0
  88. package/cjs/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +12 -31
  89. package/{esm/rules/require-selections.d.mts → cjs/rules/require-selections/index.d.cts} +3 -3
  90. package/cjs/rules/{require-selections.js → require-selections/index.js} +47 -45
  91. package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +13 -0
  92. package/cjs/rules/require-type-pattern-with-oneof/index.js +63 -0
  93. package/{esm/rules/selection-set-depth.d.mts → cjs/rules/selection-set-depth/index.d.cts} +3 -3
  94. package/cjs/rules/{selection-set-depth.js → selection-set-depth/index.js} +16 -42
  95. package/cjs/rules/{strict-id-in-types.d.ts → strict-id-in-types/index.d.cts} +6 -4
  96. package/cjs/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +26 -39
  97. package/cjs/rules/unique-enum-value-names/index.d.cts +13 -0
  98. package/cjs/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +10 -29
  99. package/{esm/rules/unique-fragment-name.d.mts → cjs/rules/unique-fragment-name/index.d.cts} +3 -3
  100. package/cjs/rules/unique-fragment-name/index.js +87 -0
  101. package/cjs/rules/unique-operation-name/index.d.cts +13 -0
  102. package/cjs/rules/{unique-operation-name.js → unique-operation-name/index.js} +7 -27
  103. package/{esm/schema.d.mts → cjs/schema.d.cts} +3 -3
  104. package/cjs/schema.js +11 -36
  105. package/cjs/siblings.js +17 -33
  106. package/{esm/types.d.mts → cjs/types.d.cts} +2 -2
  107. package/cjs/types.js +1 -14
  108. package/{esm/utils.d.mts → cjs/utils.d.cts} +5 -5
  109. package/cjs/utils.js +94 -115
  110. package/{cjs → esm}/cache.d.ts +1 -1
  111. package/esm/configs/index.d.ts +24 -0
  112. package/esm/configs/index.js +22 -1
  113. package/esm/configs/operations-all.js +1 -1
  114. package/esm/documents.js +8 -3
  115. package/{cjs → esm}/estree-converter/index.d.ts +2 -2
  116. package/{cjs → esm}/estree-converter/utils.d.ts +3 -3
  117. package/esm/graphql-config.js +1 -1
  118. package/esm/index.d.ts +186 -0
  119. package/esm/index.js +10 -4
  120. package/esm/meta.d.ts +3 -0
  121. package/esm/meta.js +5 -0
  122. package/{cjs → esm}/parser.d.ts +8 -1
  123. package/esm/parser.js +10 -1
  124. package/{cjs → esm}/processor.d.ts +4 -0
  125. package/esm/processor.js +5 -0
  126. package/{cjs/rules/alphabetize.d.ts → esm/rules/alphabetize/index.d.ts} +5 -5
  127. package/esm/rules/{alphabetize.js → alphabetize/index.js} +26 -10
  128. package/{cjs/rules/description-style.d.ts → esm/rules/description-style/index.d.ts} +3 -3
  129. package/esm/rules/{description-style.js → description-style/index.js} +2 -2
  130. package/esm/rules/{index.d.mts → index.d.ts} +11 -9
  131. package/esm/rules/index.js +34 -34
  132. package/esm/rules/{input-name.d.mts → input-name/index.d.ts} +6 -4
  133. package/esm/rules/{input-name.js → input-name/index.js} +1 -1
  134. package/esm/rules/{lone-executable-definition.d.mts → lone-executable-definition/index.d.ts} +3 -3
  135. package/esm/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +2 -2
  136. package/esm/rules/{match-document-filename.d.mts → match-document-filename/index.d.ts} +4 -4
  137. package/esm/rules/{match-document-filename.js → match-document-filename/index.js} +4 -4
  138. package/{cjs/rules/naming-convention.d.ts → esm/rules/naming-convention/index.d.ts} +6 -4
  139. package/esm/rules/{naming-convention.js → naming-convention/index.js} +2 -2
  140. package/{cjs/rules/no-one-place-fragments.d.ts → esm/rules/no-anonymous-operations/index.d.ts} +3 -3
  141. package/esm/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +2 -2
  142. package/{cjs/rules/no-deprecated.d.ts → esm/rules/no-deprecated/index.d.ts} +3 -3
  143. package/esm/rules/{no-deprecated.js → no-deprecated/index.js} +2 -2
  144. package/{cjs/rules/no-scalar-result-type-on-mutation.d.ts → esm/rules/no-duplicate-fields/index.d.ts} +3 -3
  145. package/esm/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +1 -1
  146. package/esm/rules/{no-hashtag-description.d.mts → no-hashtag-description/index.d.ts} +3 -3
  147. package/esm/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +2 -2
  148. package/{cjs/rules/no-anonymous-operations.d.ts → esm/rules/no-one-place-fragments/index.d.ts} +3 -3
  149. package/esm/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +2 -2
  150. package/esm/rules/{no-root-type.d.mts → no-root-type/index.d.ts} +3 -3
  151. package/esm/rules/{no-root-type.js → no-root-type/index.js} +2 -2
  152. package/{cjs/rules/no-duplicate-fields.d.ts → esm/rules/no-scalar-result-type-on-mutation/index.d.ts} +3 -3
  153. package/esm/rules/{no-scalar-result-type-on-mutation.js → no-scalar-result-type-on-mutation/index.js} +2 -2
  154. package/esm/rules/no-typename-prefix/index.d.ts +13 -0
  155. package/esm/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +1 -1
  156. package/esm/rules/no-unreachable-types/index.d.ts +13 -0
  157. package/esm/rules/{no-unreachable-types.js → no-unreachable-types/index.js} +8 -8
  158. package/esm/rules/no-unused-fields/index.d.ts +34 -0
  159. package/esm/rules/no-unused-fields/index.js +224 -0
  160. package/{cjs/rules/relay-arguments.d.ts → esm/rules/relay-arguments/index.d.ts} +3 -3
  161. package/esm/rules/{relay-arguments.js → relay-arguments/index.js} +2 -2
  162. package/{cjs/rules/relay-connection-types.d.ts → esm/rules/relay-connection-types/index.d.ts} +3 -3
  163. package/esm/rules/{relay-connection-types.js → relay-connection-types/index.js} +1 -1
  164. package/esm/rules/{relay-edge-types.d.mts → relay-edge-types/index.d.ts} +6 -4
  165. package/esm/rules/{relay-edge-types.js → relay-edge-types/index.js} +3 -3
  166. package/esm/rules/relay-page-info/index.d.ts +13 -0
  167. package/esm/rules/{relay-page-info.js → relay-page-info/index.js} +4 -4
  168. package/{cjs/rules/require-deprecation-date.d.ts → esm/rules/require-deprecation-date/index.d.ts} +3 -3
  169. package/esm/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +3 -3
  170. package/esm/rules/require-deprecation-reason/index.d.ts +13 -0
  171. package/esm/rules/{require-deprecation-reason.js → require-deprecation-reason/index.js} +3 -3
  172. package/{cjs/rules/require-description.d.ts → esm/rules/require-description/index.d.ts} +3 -3
  173. package/esm/rules/{require-description.js → require-description/index.js} +2 -2
  174. package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +13 -0
  175. package/esm/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +2 -2
  176. package/esm/rules/require-import-fragment/index.d.ts +13 -0
  177. package/esm/rules/{require-import-fragment.js → require-import-fragment/index.js} +9 -4
  178. package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +13 -0
  179. package/esm/rules/{require-nullable-fields-with-oneof.js → require-nullable-fields-with-oneof/index.js} +2 -2
  180. package/esm/rules/require-nullable-result-in-root/index.d.ts +13 -0
  181. package/esm/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +2 -2
  182. package/{cjs/rules/require-selections.d.ts → esm/rules/require-selections/index.d.ts} +3 -3
  183. package/esm/rules/{require-selections.js → require-selections/index.js} +13 -7
  184. package/esm/rules/require-type-pattern-with-oneof/index.d.ts +13 -0
  185. package/esm/rules/{require-type-pattern-with-oneof.js → require-type-pattern-with-oneof/index.js} +2 -2
  186. package/{cjs/rules/selection-set-depth.d.ts → esm/rules/selection-set-depth/index.d.ts} +3 -3
  187. package/esm/rules/{selection-set-depth.js → selection-set-depth/index.js} +3 -3
  188. package/esm/rules/{strict-id-in-types.d.mts → strict-id-in-types/index.d.ts} +6 -4
  189. package/esm/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +2 -2
  190. package/esm/rules/unique-enum-value-names/index.d.ts +13 -0
  191. package/esm/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +2 -2
  192. package/{cjs/rules/unique-fragment-name.d.ts → esm/rules/unique-fragment-name/index.d.ts} +3 -3
  193. package/esm/rules/{unique-fragment-name.js → unique-fragment-name/index.js} +3 -3
  194. package/esm/rules/unique-operation-name/index.d.ts +13 -0
  195. package/esm/rules/{unique-operation-name.js → unique-operation-name/index.js} +2 -2
  196. package/{cjs → esm}/utils.d.ts +2 -2
  197. package/esm/utils.js +39 -16
  198. package/{index.browser.mjs → index.browser.js} +352 -181
  199. package/package.json +7 -11
  200. package/cjs/configs/index.d.ts +0 -174
  201. package/cjs/flat-configs.d.ts +0 -307
  202. package/cjs/flat-configs.js +0 -55
  203. package/cjs/index.d.ts +0 -26
  204. package/cjs/rules/no-scalar-result-type-on-mutation.js +0 -88
  205. package/cjs/rules/no-typename-prefix.d.ts +0 -13
  206. package/cjs/rules/no-unreachable-types.d.ts +0 -13
  207. package/cjs/rules/no-unreachable-types.js +0 -176
  208. package/cjs/rules/no-unused-fields.d.ts +0 -13
  209. package/cjs/rules/no-unused-fields.js +0 -132
  210. package/cjs/rules/relay-page-info.d.ts +0 -13
  211. package/cjs/rules/require-deprecation-reason.d.ts +0 -13
  212. package/cjs/rules/require-deprecation-reason.js +0 -85
  213. package/cjs/rules/require-field-of-type-query-in-mutation-result.d.ts +0 -13
  214. package/cjs/rules/require-import-fragment.d.ts +0 -13
  215. package/cjs/rules/require-nullable-fields-with-oneof.d.ts +0 -13
  216. package/cjs/rules/require-nullable-fields-with-oneof.js +0 -81
  217. package/cjs/rules/require-nullable-result-in-root.d.ts +0 -13
  218. package/cjs/rules/require-type-pattern-with-oneof.d.ts +0 -13
  219. package/cjs/rules/require-type-pattern-with-oneof.js +0 -83
  220. package/cjs/rules/unique-enum-value-names.d.ts +0 -13
  221. package/cjs/rules/unique-fragment-name.js +0 -106
  222. package/cjs/rules/unique-operation-name.d.ts +0 -13
  223. package/esm/configs/index.d.mts +0 -174
  224. package/esm/estree-converter/index.d.mts +0 -8
  225. package/esm/flat-configs.d.mts +0 -307
  226. package/esm/flat-configs.js +0 -36
  227. package/esm/index.d.mts +0 -26
  228. package/esm/package.json +0 -1
  229. package/esm/rules/no-anonymous-operations.d.mts +0 -13
  230. package/esm/rules/no-duplicate-fields.d.mts +0 -13
  231. package/esm/rules/no-one-place-fragments.d.mts +0 -13
  232. package/esm/rules/no-scalar-result-type-on-mutation.d.mts +0 -13
  233. package/esm/rules/no-typename-prefix.d.mts +0 -13
  234. package/esm/rules/no-unreachable-types.d.mts +0 -13
  235. package/esm/rules/no-unused-fields.d.mts +0 -13
  236. package/esm/rules/no-unused-fields.js +0 -113
  237. package/esm/rules/relay-page-info.d.mts +0 -13
  238. package/esm/rules/require-deprecation-reason.d.mts +0 -13
  239. package/esm/rules/require-field-of-type-query-in-mutation-result.d.mts +0 -13
  240. package/esm/rules/require-import-fragment.d.mts +0 -13
  241. package/esm/rules/require-nullable-fields-with-oneof.d.mts +0 -13
  242. package/esm/rules/require-nullable-result-in-root.d.mts +0 -13
  243. package/esm/rules/require-type-pattern-with-oneof.d.mts +0 -13
  244. package/esm/rules/unique-enum-value-names.d.mts +0 -13
  245. package/esm/rules/unique-operation-name.d.mts +0 -13
  246. /package/cjs/configs/{operations-all.d.ts → operations-all.d.cts} +0 -0
  247. /package/cjs/configs/{operations-recommended.d.ts → operations-recommended.d.cts} +0 -0
  248. /package/cjs/configs/{schema-all.d.ts → schema-all.d.cts} +0 -0
  249. /package/cjs/configs/{schema-recommended.d.ts → schema-recommended.d.cts} +0 -0
  250. /package/cjs/configs/{schema-relay.d.ts → schema-relay.d.cts} +0 -0
  251. /package/cjs/{documents.d.ts → documents.d.cts} +0 -0
  252. /package/cjs/estree-converter/{types.d.ts → types.d.cts} +0 -0
  253. /package/cjs/{siblings.d.ts → siblings.d.cts} +0 -0
  254. /package/esm/configs/{operations-all.d.mts → operations-all.d.ts} +0 -0
  255. /package/esm/configs/{operations-recommended.d.mts → operations-recommended.d.ts} +0 -0
  256. /package/esm/configs/{schema-all.d.mts → schema-all.d.ts} +0 -0
  257. /package/esm/configs/{schema-recommended.d.mts → schema-recommended.d.ts} +0 -0
  258. /package/esm/configs/{schema-relay.d.mts → schema-relay.d.ts} +0 -0
  259. /package/esm/{documents.d.mts → documents.d.ts} +0 -0
  260. /package/{cjs → esm}/estree-converter/converter.d.ts +0 -0
  261. /package/esm/estree-converter/{types.d.mts → types.d.ts} +0 -0
  262. /package/{cjs → esm}/graphql-config.d.ts +0 -0
  263. /package/{cjs → esm}/rules/graphql-js-validation.d.ts +0 -0
  264. /package/{cjs → esm}/schema.d.ts +0 -0
  265. /package/esm/{siblings.d.mts → siblings.d.ts} +0 -0
  266. /package/{cjs → esm}/types.d.ts +0 -0
@@ -35,7 +35,7 @@ var require_operations_all = __commonJS({
35
35
  selections: ["OperationDefinition", "FragmentDefinition"],
36
36
  variables: !0,
37
37
  arguments: ["Field", "Directive"],
38
- groups: ["id", "*", "createdAt", "updatedAt"]
38
+ groups: ["...", "id", "*", "{"]
39
39
  }
40
40
  ],
41
41
  "@graphql-eslint/lone-executable-definition": "error",
@@ -237,10 +237,23 @@ var require_schema_relay = __commonJS({
237
237
  });
238
238
 
239
239
  // src/parser.ts
240
- import debugFactory from "debug";
240
+ import debugFactory2 from "debug";
241
241
  import { buildSchema, GraphQLError } from "graphql";
242
242
  import { parseGraphQLSDL } from "@graphql-tools/utils";
243
243
 
244
+ // src/cache.ts
245
+ import debugFactory from "debug";
246
+ var log = debugFactory("graphql-eslint:ModuleCache"), ModuleCache = class {
247
+ map = /* @__PURE__ */ new Map();
248
+ set(cacheKey, result) {
249
+ }
250
+ get(cacheKey, settings = {
251
+ lifetime: 10
252
+ /* seconds */
253
+ }) {
254
+ }
255
+ };
256
+
244
257
  // src/estree-converter/converter.ts
245
258
  import {
246
259
  Kind,
@@ -328,8 +341,8 @@ function convertLocation(location) {
328
341
  }
329
342
 
330
343
  // src/estree-converter/converter.ts
331
- function convertToESTree(node, schema15) {
332
- let typeInfo = schema15 && new TypeInfo(schema15), visitor = {
344
+ function convertToESTree(node, schema16) {
345
+ let typeInfo = schema16 && new TypeInfo(schema16), visitor = {
333
346
  leave(node2, key, parent) {
334
347
  let leadingComments = "description" in node2 && node2.description ? [
335
348
  {
@@ -374,6 +387,9 @@ function convertToESTree(node, schema15) {
374
387
  );
375
388
  }
376
389
 
390
+ // src/meta.ts
391
+ var version = process.env.VERSION;
392
+
377
393
  // src/siblings.ts
378
394
  import {
379
395
  Kind as Kind3,
@@ -392,12 +408,12 @@ function requireSiblingsOperations(ruleId, context) {
392
408
  return siblingOperations;
393
409
  }
394
410
  function requireGraphQLSchemaFromContext(ruleId, context) {
395
- let { schema: schema15 } = context.sourceCode.parserServices;
396
- if (!schema15)
411
+ let { schema: schema16 } = context.sourceCode.parserServices;
412
+ if (!schema16)
397
413
  throw new Error(
398
414
  `Rule \`${ruleId}\` requires graphql-config \`schema\` field to be set and loaded. See https://the-guild.dev/graphql/config/docs/user/schema for more info`
399
415
  );
400
- return schema15;
416
+ return schema16;
401
417
  }
402
418
  var chalk = {
403
419
  red: (str) => `\x1B[31m${str}\x1B[39m`,
@@ -411,7 +427,7 @@ var chalk = {
411
427
  // eslint-disable-next-line no-console
412
428
  console.warn(chalk.yellow("warning"), "[graphql-eslint]", ...args)
413
429
  )
414
- }, normalizePath = (path2) => (path2 || "").replace(/\\/g, "/"), VIRTUAL_DOCUMENT_REGEX = /\/\d+_document.graphql$/, CWD = process.cwd(), getTypeName = (node) => "type" in node ? getTypeName(node.type) : "name" in node && node.name ? node.name.value : "", TYPES_KINDS = [
430
+ }, slash = (path2) => path2.replaceAll("\\", "/"), VIRTUAL_DOCUMENT_REGEX = /[/\\]\d+_document.graphql$/, CWD = process.cwd(), getTypeName = (node) => "type" in node ? getTypeName(node.type) : "name" in node && node.name ? node.name.value : "", TYPES_KINDS = [
415
431
  Kind2.OBJECT_TYPE_DEFINITION,
416
432
  Kind2.INTERFACE_TYPE_DEFINITION,
417
433
  Kind2.ENUM_TYPE_DEFINITION,
@@ -460,26 +476,49 @@ function truthy(value) {
460
476
  return !!value;
461
477
  }
462
478
  var DisplayNodeNameMap = {
463
- [Kind2.OBJECT_TYPE_DEFINITION]: "type",
464
- [Kind2.OBJECT_TYPE_EXTENSION]: "type",
465
- [Kind2.INTERFACE_TYPE_DEFINITION]: "interface",
466
- [Kind2.INTERFACE_TYPE_EXTENSION]: "interface",
479
+ [Kind2.ARGUMENT]: "argument",
480
+ [Kind2.BOOLEAN]: "boolean",
481
+ [Kind2.DIRECTIVE_DEFINITION]: "directive",
482
+ [Kind2.DIRECTIVE]: "directive",
483
+ [Kind2.DOCUMENT]: "document",
467
484
  [Kind2.ENUM_TYPE_DEFINITION]: "enum",
468
485
  [Kind2.ENUM_TYPE_EXTENSION]: "enum",
469
- [Kind2.SCALAR_TYPE_DEFINITION]: "scalar",
486
+ [Kind2.ENUM_VALUE_DEFINITION]: "enum value",
487
+ [Kind2.ENUM]: "enum",
488
+ [Kind2.FIELD_DEFINITION]: "field",
489
+ [Kind2.FIELD]: "field",
490
+ [Kind2.FLOAT]: "float",
491
+ [Kind2.FRAGMENT_DEFINITION]: "fragment",
492
+ [Kind2.FRAGMENT_SPREAD]: "fragment spread",
493
+ [Kind2.INLINE_FRAGMENT]: "inline fragment",
470
494
  [Kind2.INPUT_OBJECT_TYPE_DEFINITION]: "input",
471
495
  [Kind2.INPUT_OBJECT_TYPE_EXTENSION]: "input",
472
- [Kind2.UNION_TYPE_DEFINITION]: "union",
473
- [Kind2.UNION_TYPE_EXTENSION]: "union",
474
- [Kind2.DIRECTIVE_DEFINITION]: "directive",
475
- [Kind2.FIELD_DEFINITION]: "field",
476
- [Kind2.ENUM_VALUE_DEFINITION]: "enum value",
477
496
  [Kind2.INPUT_VALUE_DEFINITION]: "input value",
478
- [Kind2.ARGUMENT]: "argument",
479
- [Kind2.VARIABLE]: "variable",
480
- [Kind2.FRAGMENT_DEFINITION]: "fragment",
497
+ [Kind2.INT]: "int",
498
+ [Kind2.INTERFACE_TYPE_DEFINITION]: "interface",
499
+ [Kind2.INTERFACE_TYPE_EXTENSION]: "interface",
500
+ [Kind2.LIST_TYPE]: "list type",
501
+ [Kind2.LIST]: "list",
502
+ [Kind2.NAME]: "name",
503
+ [Kind2.NAMED_TYPE]: "named type",
504
+ [Kind2.NON_NULL_TYPE]: "non-null type",
505
+ [Kind2.NULL]: "null",
506
+ [Kind2.OBJECT_FIELD]: "object field",
507
+ [Kind2.OBJECT_TYPE_DEFINITION]: "type",
508
+ [Kind2.OBJECT_TYPE_EXTENSION]: "type",
509
+ [Kind2.OBJECT]: "object",
481
510
  [Kind2.OPERATION_DEFINITION]: "operation",
482
- [Kind2.FIELD]: "field"
511
+ [Kind2.OPERATION_TYPE_DEFINITION]: "operation type",
512
+ [Kind2.SCALAR_TYPE_DEFINITION]: "scalar",
513
+ [Kind2.SCALAR_TYPE_EXTENSION]: "scalar",
514
+ [Kind2.SCHEMA_DEFINITION]: "schema",
515
+ [Kind2.SCHEMA_EXTENSION]: "schema",
516
+ [Kind2.SELECTION_SET]: "selection set",
517
+ [Kind2.STRING]: "string",
518
+ [Kind2.UNION_TYPE_DEFINITION]: "union",
519
+ [Kind2.UNION_TYPE_EXTENSION]: "union",
520
+ [Kind2.VARIABLE_DEFINITION]: "variable",
521
+ [Kind2.VARIABLE]: "variable"
483
522
  };
484
523
  function displayNodeName(node) {
485
524
  return `${node.kind === Kind2.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
@@ -575,7 +614,7 @@ function getSiblings(documents) {
575
614
  }
576
615
 
577
616
  // src/parser.ts
578
- var debug = debugFactory("graphql-eslint:parser");
617
+ var debug = debugFactory2("graphql-eslint:parser");
579
618
  debug("cwd %o", CWD);
580
619
  var LEGACY_PARSER_OPTIONS_KEYS = [
581
620
  "schema",
@@ -596,7 +635,7 @@ function parseForESLint(code, options) {
596
635
  `\`parserOptions.${key}\` was removed in graphql-eslint@4. Use physical graphql-config for setting schema and documents or \`parserOptions.graphQLConfig\` for programmatic usage.`
597
636
  );
598
637
  try {
599
- let { filePath } = options, { document } = parseGraphQLSDL(filePath, code, { noLocation: !1 }), project, schema15, documents;
638
+ let { filePath } = options, { document } = parseGraphQLSDL(filePath, code, { noLocation: !1 }), project, schema16, documents;
600
639
  documents = [
601
640
  parseGraphQLSDL(
602
641
  "operation.graphql",
@@ -605,14 +644,14 @@ function parseForESLint(code, options) {
605
644
  )
606
645
  ];
607
646
  try {
608
- schema15 = buildSchema(options.graphQLConfig.schema);
647
+ schema16 = buildSchema(options.graphQLConfig.schema);
609
648
  } catch (error) {
610
649
  throw error instanceof Error && (error.message = `Error while loading schema: ${error.message}`), error;
611
650
  }
612
- let rootTree = convertToESTree(document, schema15);
651
+ let rootTree = convertToESTree(document, schema16);
613
652
  return {
614
653
  services: {
615
- schema: schema15,
654
+ schema: schema16,
616
655
  siblingOperations: getSiblings(documents)
617
656
  },
618
657
  ast: {
@@ -640,8 +679,15 @@ function parseForESLint(code, options) {
640
679
  throw error;
641
680
  }
642
681
  }
682
+ var parser = {
683
+ parseForESLint,
684
+ meta: {
685
+ name: "@graphql-eslint/parser",
686
+ version
687
+ }
688
+ };
643
689
 
644
- // src/rules/alphabetize.ts
690
+ // src/rules/alphabetize/index.ts
645
691
  import {
646
692
  Kind as Kind4
647
693
  } from "graphql";
@@ -703,7 +749,14 @@ var RULE_ID = "alphabetize", fieldsEnum = [
703
749
  groups: {
704
750
  ...ARRAY_DEFAULT_OPTIONS,
705
751
  minItems: 2,
706
- description: "Custom order group. Example: `['id', '*', 'createdAt', 'updatedAt']` where `*` says for everything else."
752
+ description: [
753
+ "Order group. Example: `['...', 'id', '*', '{']` where:",
754
+ "- `...` stands for fragment spreads",
755
+ "- `id` stands for field with name `id`",
756
+ "- `*` stands for everything else",
757
+ "- `{` stands for fields `selection set`"
758
+ ].join(`
759
+ `)
707
760
  }
708
761
  }
709
762
  }
@@ -825,7 +878,7 @@ var RULE_ID = "alphabetize", fieldsEnum = [
825
878
  selections: selectionsEnum,
826
879
  variables: !0,
827
880
  arguments: [Kind4.FIELD, Kind4.DIRECTIVE],
828
- groups: ["id", "*", "createdAt", "updatedAt"]
881
+ groups: ["...", "id", "*", "{"]
829
882
  }
830
883
  ]
831
884
  }
@@ -863,19 +916,17 @@ var RULE_ID = "alphabetize", fieldsEnum = [
863
916
  }
864
917
  function checkNodes(nodes = []) {
865
918
  for (let i = 1; i < nodes.length; i += 1) {
866
- let currNode = nodes[i], currName = "alias" in currNode && currNode.alias?.value || "name" in currNode && currNode.name?.value;
919
+ let currNode = nodes[i], currName = getName(currNode);
867
920
  if (!currName)
868
921
  continue;
869
- let prevNode = nodes[i - 1], prevName = "alias" in prevNode && prevNode.alias?.value || "name" in prevNode && prevNode.name?.value;
922
+ let prevNode = nodes[i - 1], prevName = getName(prevNode);
870
923
  if (prevName) {
871
924
  let compareResult = prevName.localeCompare(currName), { groups } = opts, shouldSortByGroup = !1;
872
925
  if (groups?.length) {
873
926
  if (!groups.includes("*"))
874
927
  throw new Error("`groups` option should contain `*` string.");
875
- let indexForPrev = groups.indexOf(prevName);
876
- indexForPrev === -1 && (indexForPrev = groups.indexOf("*"));
877
- let indexForCurr = groups.indexOf(currName);
878
- if (indexForCurr === -1 && (indexForCurr = groups.indexOf("*")), shouldSortByGroup = indexForPrev - indexForCurr > 0, indexForPrev < indexForCurr)
928
+ let indexForPrev = getIndex({ node: prevNode, groups }), indexForCurr = getIndex({ node: currNode, groups });
929
+ if (shouldSortByGroup = indexForPrev - indexForCurr > 0, indexForPrev < indexForCurr)
879
930
  continue;
880
931
  }
881
932
  if (!shouldSortByGroup && !(compareResult === 1) && (!(compareResult === 0) || !prevNode.kind.endsWith("Extension") || currNode.kind.endsWith("Extension")))
@@ -935,8 +986,19 @@ var RULE_ID = "alphabetize", fieldsEnum = [
935
986
  }), listeners;
936
987
  }
937
988
  };
989
+ function getIndex({
990
+ node,
991
+ groups
992
+ }) {
993
+ let index = groups.indexOf(getName(node));
994
+ return index === -1 && "selectionSet" in node && node.selectionSet && (index = groups.indexOf("{")), index === -1 && node.kind === Kind4.FRAGMENT_SPREAD && (index = groups.indexOf("...")), index === -1 && (index = groups.indexOf("*")), index;
995
+ }
996
+ function getName(node) {
997
+ return "alias" in node && node.alias?.value || //
998
+ "name" in node && node.name?.value || "";
999
+ }
938
1000
 
939
- // src/rules/description-style.ts
1001
+ // src/rules/description-style/index.ts
940
1002
  var schema2 = {
941
1003
  type: "array",
942
1004
  maxItems: 1,
@@ -1056,14 +1118,14 @@ import {
1056
1118
  import { validateSDL } from "graphql/validation/validate.js";
1057
1119
  function validateDocument({
1058
1120
  context,
1059
- schema: schema15 = null,
1121
+ schema: schema16 = null,
1060
1122
  documentNode,
1061
1123
  rule: rule35,
1062
1124
  hasDidYouMeanSuggestions
1063
1125
  }) {
1064
1126
  if (documentNode.definitions.length !== 0)
1065
1127
  try {
1066
- let validationErrors = schema15 ? validate(schema15, documentNode, [rule35]) : validateSDL(documentNode, null, [rule35]);
1128
+ let validationErrors = schema16 ? validate(schema16, documentNode, [rule35]) : validateSDL(documentNode, null, [rule35]);
1067
1129
  for (let error of validationErrors) {
1068
1130
  let { line, column } = error.locations[0], sourceCode = context.getSourceCode(), { tokens } = sourceCode.ast, token = tokens.find(
1069
1131
  (token2) => token2.loc.start.line === line && token2.loc.start.column === column - 1
@@ -1129,7 +1191,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1129
1191
  ruleId,
1130
1192
  rule: rule35,
1131
1193
  getDocumentNode,
1132
- schema: schema15 = [],
1194
+ schema: schema16 = [],
1133
1195
  hasDidYouMeanSuggestions
1134
1196
  }, docs) => ({
1135
1197
  [ruleId]: {
@@ -1142,16 +1204,16 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1142
1204
  description: `${docs.description}
1143
1205
  > This rule is a wrapper around a \`graphql-js\` validation function.`
1144
1206
  },
1145
- schema: schema15,
1207
+ schema: schema16,
1146
1208
  hasSuggestions: hasDidYouMeanSuggestions
1147
1209
  },
1148
1210
  create(context) {
1149
1211
  return {
1150
1212
  Document(node) {
1151
- let schema16 = docs.requiresSchema ? requireGraphQLSchemaFromContext(ruleId, context) : null, documentNode = getDocumentNode ? getDocumentNode({ ruleId, context, node: node.rawNode() }) : node.rawNode();
1213
+ let schema17 = docs.requiresSchema ? requireGraphQLSchemaFromContext(ruleId, context) : null, documentNode = getDocumentNode ? getDocumentNode({ ruleId, context, node: node.rawNode() }) : node.rawNode();
1152
1214
  validateDocument({
1153
1215
  context,
1154
- schema: schema16,
1216
+ schema: schema17,
1155
1217
  documentNode,
1156
1218
  rule: rule35,
1157
1219
  hasDidYouMeanSuggestions
@@ -1624,7 +1686,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1624
1686
  )
1625
1687
  );
1626
1688
 
1627
- // src/rules/input-name.ts
1689
+ // src/rules/input-name/index.ts
1628
1690
  import {
1629
1691
  Kind as Kind6
1630
1692
  } from "graphql";
@@ -1758,7 +1820,7 @@ Using the same name for all input parameters will make your schemas easier to co
1758
1820
  }
1759
1821
  };
1760
1822
 
1761
- // src/rules/lone-executable-definition.ts
1823
+ // src/rules/lone-executable-definition/index.ts
1762
1824
  import { OperationTypeNode as OperationTypeNode2 } from "graphql";
1763
1825
  var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...Object.values(OperationTypeNode2)], schema4 = {
1764
1826
  type: "array",
@@ -1840,8 +1902,8 @@ var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...O
1840
1902
  }
1841
1903
  };
1842
1904
 
1843
- // src/rules/match-document-filename.ts
1844
- import { basename, extname } from "path";
1905
+ // src/rules/match-document-filename/index.ts
1906
+ import { basename, extname } from "node:path";
1845
1907
  import { Kind as Kind7 } from "graphql";
1846
1908
  var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLES = [
1847
1909
  "camelCase",
@@ -2068,7 +2130,7 @@ var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLE
2068
2130
  }
2069
2131
  };
2070
2132
 
2071
- // src/rules/naming-convention.ts
2133
+ // src/rules/naming-convention/index.ts
2072
2134
  import { Kind as Kind8 } from "graphql";
2073
2135
  var KindToDisplayName = {
2074
2136
  // types
@@ -2462,7 +2524,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
2462
2524
  }
2463
2525
  };
2464
2526
 
2465
- // src/rules/no-anonymous-operations.ts
2527
+ // src/rules/no-anonymous-operations/index.ts
2466
2528
  import { Kind as Kind9 } from "graphql";
2467
2529
  var RULE_ID3 = "no-anonymous-operations", rule7 = {
2468
2530
  meta: {
@@ -2531,7 +2593,7 @@ var RULE_ID3 = "no-anonymous-operations", rule7 = {
2531
2593
  }
2532
2594
  };
2533
2595
 
2534
- // src/rules/no-deprecated.ts
2596
+ // src/rules/no-deprecated/index.ts
2535
2597
  import { Kind as Kind10 } from "graphql";
2536
2598
  var RULE_ID4 = "no-deprecated", rule8 = {
2537
2599
  meta: {
@@ -2652,7 +2714,7 @@ var RULE_ID4 = "no-deprecated", rule8 = {
2652
2714
  }
2653
2715
  };
2654
2716
 
2655
- // src/rules/no-duplicate-fields.ts
2717
+ // src/rules/no-duplicate-fields/index.ts
2656
2718
  import { Kind as Kind11 } from "graphql";
2657
2719
  var RULE_ID5 = "no-duplicate-fields", rule9 = {
2658
2720
  meta: {
@@ -2766,7 +2828,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
2766
2828
  }
2767
2829
  };
2768
2830
 
2769
- // src/rules/no-hashtag-description.ts
2831
+ // src/rules/no-hashtag-description/index.ts
2770
2832
  import { TokenKind as TokenKind2 } from "graphql";
2771
2833
  var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
2772
2834
  meta: {
@@ -2869,8 +2931,8 @@ var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
2869
2931
  }
2870
2932
  };
2871
2933
 
2872
- // src/rules/no-one-place-fragments.ts
2873
- import { relative } from "path";
2934
+ // src/rules/no-one-place-fragments/index.ts
2935
+ import { relative } from "node:path";
2874
2936
  import { visit as visit4 } from "graphql";
2875
2937
  var RULE_ID7 = "no-one-place-fragments", rule11 = {
2876
2938
  meta: {
@@ -2949,7 +3011,7 @@ var RULE_ID7 = "no-one-place-fragments", rule11 = {
2949
3011
  }
2950
3012
  };
2951
3013
 
2952
- // src/rules/no-root-type.ts
3014
+ // src/rules/no-root-type/index.ts
2953
3015
  var schema7 = {
2954
3016
  type: "array",
2955
3017
  minItems: 1,
@@ -3007,9 +3069,9 @@ var schema7 = {
3007
3069
  schema: schema7
3008
3070
  },
3009
3071
  create(context) {
3010
- let schema15 = requireGraphQLSchemaFromContext("no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
3011
- disallow.has("mutation") && schema15.getMutationType(),
3012
- disallow.has("subscription") && schema15.getSubscriptionType()
3072
+ let schema16 = requireGraphQLSchemaFromContext("no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
3073
+ disallow.has("mutation") && schema16.getMutationType(),
3074
+ disallow.has("subscription") && schema16.getSubscriptionType()
3013
3075
  ].filter(truthy).map((type) => type.name).join("|");
3014
3076
  return rootTypeNames ? {
3015
3077
  [`:matches(ObjectTypeDefinition, ObjectTypeExtension) > .name[value=/^(${rootTypeNames})$/]`](node) {
@@ -3029,7 +3091,7 @@ var schema7 = {
3029
3091
  }
3030
3092
  };
3031
3093
 
3032
- // src/rules/no-scalar-result-type-on-mutation.ts
3094
+ // src/rules/no-scalar-result-type-on-mutation/index.ts
3033
3095
  import { isScalarType, Kind as Kind12 } from "graphql";
3034
3096
  var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3035
3097
  meta: {
@@ -3068,13 +3130,13 @@ var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3068
3130
  schema: []
3069
3131
  },
3070
3132
  create(context) {
3071
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID8, context), mutationType = schema15.getMutationType();
3133
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID8, context), mutationType = schema16.getMutationType();
3072
3134
  return mutationType ? {
3073
3135
  [[
3074
3136
  `:matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=${mutationType.name}]`,
3075
3137
  "> FieldDefinition > .gqlType Name"
3076
3138
  ].join(" ")](node) {
3077
- let typeName = node.value, graphQLType = schema15.getType(typeName);
3139
+ let typeName = node.value, graphQLType = schema16.getType(typeName);
3078
3140
  if (isScalarType(graphQLType)) {
3079
3141
  let fieldDef = node.parent;
3080
3142
  for (; fieldDef.kind !== Kind12.FIELD_DEFINITION; )
@@ -3095,7 +3157,7 @@ var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3095
3157
  }
3096
3158
  };
3097
3159
 
3098
- // src/rules/no-typename-prefix.ts
3160
+ // src/rules/no-typename-prefix/index.ts
3099
3161
  var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
3100
3162
  meta: {
3101
3163
  type: "suggestion",
@@ -3164,7 +3226,7 @@ var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
3164
3226
  }
3165
3227
  };
3166
3228
 
3167
- // src/rules/no-unreachable-types.ts
3229
+ // src/rules/no-unreachable-types/index.ts
3168
3230
  import {
3169
3231
  DirectiveLocation,
3170
3232
  isInterfaceType,
@@ -3186,7 +3248,7 @@ var RULE_ID9 = "no-unreachable-types", KINDS = [
3186
3248
  Kind13.UNION_TYPE_EXTENSION,
3187
3249
  Kind13.ENUM_TYPE_DEFINITION,
3188
3250
  Kind13.ENUM_TYPE_EXTENSION
3189
- ], reachableTypesCache, RequestDirectiveLocations = /* @__PURE__ */ new Set([
3251
+ ], reachableTypesCache = new ModuleCache(), RequestDirectiveLocations = /* @__PURE__ */ new Set([
3190
3252
  DirectiveLocation.QUERY,
3191
3253
  DirectiveLocation.MUTATION,
3192
3254
  DirectiveLocation.SUBSCRIPTION,
@@ -3196,17 +3258,18 @@ var RULE_ID9 = "no-unreachable-types", KINDS = [
3196
3258
  DirectiveLocation.INLINE_FRAGMENT,
3197
3259
  DirectiveLocation.VARIABLE_DEFINITION
3198
3260
  ]);
3199
- function getReachableTypes(schema15) {
3200
- if (reachableTypesCache)
3201
- return reachableTypesCache;
3261
+ function getReachableTypes(schema16) {
3262
+ let cachedValue = reachableTypesCache.get(schema16);
3263
+ if (cachedValue)
3264
+ return cachedValue;
3202
3265
  let reachableTypes = /* @__PURE__ */ new Set(), collect = (node) => {
3203
3266
  let typeName = getTypeName(node);
3204
3267
  if (reachableTypes.has(typeName))
3205
3268
  return;
3206
3269
  reachableTypes.add(typeName);
3207
- let type = schema15.getType(typeName) || schema15.getDirective(typeName);
3270
+ let type = schema16.getType(typeName) || schema16.getDirective(typeName);
3208
3271
  if (isInterfaceType(type)) {
3209
- let { objects, interfaces } = schema15.getImplementations(type);
3272
+ let { objects, interfaces } = schema16.getImplementations(type);
3210
3273
  for (let { astNode } of [...objects, ...interfaces])
3211
3274
  visit5(astNode, visitor);
3212
3275
  } else type?.astNode && visit5(type.astNode, visitor);
@@ -3220,14 +3283,14 @@ function getReachableTypes(schema15) {
3220
3283
  NamedType: collect
3221
3284
  };
3222
3285
  for (let type of [
3223
- schema15,
3286
+ schema16,
3224
3287
  // visiting SchemaDefinition node
3225
- schema15.getQueryType(),
3226
- schema15.getMutationType(),
3227
- schema15.getSubscriptionType()
3288
+ schema16.getQueryType(),
3289
+ schema16.getMutationType(),
3290
+ schema16.getSubscriptionType()
3228
3291
  ])
3229
3292
  type?.astNode && visit5(type.astNode, visitor);
3230
- for (let node of schema15.getDirectives())
3293
+ for (let node of schema16.getDirectives())
3231
3294
  if (node.locations.some((location) => RequestDirectiveLocations.has(location))) {
3232
3295
  reachableTypes.add(node.name);
3233
3296
  for (let arg of node.args) {
@@ -3235,7 +3298,7 @@ function getReachableTypes(schema15) {
3235
3298
  argTypeName && reachableTypes.add(argTypeName);
3236
3299
  }
3237
3300
  }
3238
- return reachableTypesCache = reachableTypes, reachableTypesCache;
3301
+ return reachableTypesCache.set(schema16, reachableTypes), reachableTypes;
3239
3302
  }
3240
3303
  var rule15 = {
3241
3304
  meta: {
@@ -3288,7 +3351,7 @@ var rule15 = {
3288
3351
  hasSuggestions: !0
3289
3352
  },
3290
3353
  create(context) {
3291
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID9, context), reachableTypes = getReachableTypes(schema15);
3354
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID9, context), reachableTypes = getReachableTypes(schema16);
3292
3355
  return {
3293
3356
  [`:matches(${KINDS}) > .name`](node) {
3294
3357
  let typeName = node.value;
@@ -3314,13 +3377,107 @@ var rule15 = {
3314
3377
  }
3315
3378
  };
3316
3379
 
3317
- // src/rules/no-unused-fields.ts
3380
+ // src/rules/no-unused-fields/index.ts
3318
3381
  import { TypeInfo as TypeInfo2, visit as visit6, visitWithTypeInfo as visitWithTypeInfo2 } from "graphql";
3319
- var RULE_ID10 = "no-unused-fields", usedFieldsCache;
3320
- function getUsedFields(schema15, operations) {
3321
- if (usedFieldsCache)
3322
- return usedFieldsCache;
3323
- let usedFields = /* @__PURE__ */ Object.create(null), typeInfo = new TypeInfo2(schema15), visitor = visitWithTypeInfo2(typeInfo, {
3382
+ var RULE_ID10 = "no-unused-fields", RELAY_SCHEMA = (
3383
+ /* GraphQL */
3384
+ `
3385
+ # Root Query Type
3386
+ type Query {
3387
+ user: User
3388
+ }
3389
+
3390
+ # User Type
3391
+ type User {
3392
+ id: ID!
3393
+ name: String!
3394
+ friends(first: Int, after: String): FriendConnection!
3395
+ }
3396
+
3397
+ # FriendConnection Type (Relay Connection)
3398
+ type FriendConnection {
3399
+ edges: [FriendEdge]
3400
+ pageInfo: PageInfo!
3401
+ }
3402
+
3403
+ # FriendEdge Type
3404
+ type FriendEdge {
3405
+ cursor: String!
3406
+ node: Friend!
3407
+ }
3408
+
3409
+ # Friend Type
3410
+ type Friend {
3411
+ id: ID!
3412
+ name: String!
3413
+ }
3414
+
3415
+ # PageInfo Type (Relay Pagination)
3416
+ type PageInfo {
3417
+ hasPreviousPage: Boolean!
3418
+ hasNextPage: Boolean!
3419
+ startCursor: String
3420
+ endCursor: String
3421
+ }
3422
+ `
3423
+ ), RELAY_QUERY = (
3424
+ /* GraphQL */
3425
+ `
3426
+ query {
3427
+ user {
3428
+ id
3429
+ name
3430
+ friends(first: 10) {
3431
+ edges {
3432
+ node {
3433
+ id
3434
+ name
3435
+ }
3436
+ }
3437
+ }
3438
+ }
3439
+ }
3440
+ `
3441
+ ), RELAY_DEFAULT_IGNORED_FIELD_SELECTORS = [
3442
+ "[parent.name.value=PageInfo][name.value=/(endCursor|startCursor|hasNextPage|hasPreviousPage)/]",
3443
+ "[parent.name.value=/Edge$/][name.value=cursor]",
3444
+ "[parent.name.value=/Connection$/][name.value=pageInfo]"
3445
+ ], schema8 = {
3446
+ type: "array",
3447
+ maxItems: 1,
3448
+ items: {
3449
+ type: "object",
3450
+ additionalProperties: !1,
3451
+ properties: {
3452
+ ignoredFieldSelectors: {
3453
+ type: "array",
3454
+ uniqueItems: !0,
3455
+ minItems: 1,
3456
+ description: [
3457
+ "Fields that will be ignored and are allowed to be unused.",
3458
+ "",
3459
+ "E.g. The following selector will ignore all the relay pagination fields for every connection exposed in the schema:",
3460
+ "```json",
3461
+ JSON.stringify(RELAY_DEFAULT_IGNORED_FIELD_SELECTORS, null, 2),
3462
+ "```",
3463
+ "",
3464
+ "> These fields are defined by ESLint [`selectors`](https://eslint.org/docs/developer-guide/selectors).",
3465
+ "> Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector."
3466
+ ].join(`
3467
+ `),
3468
+ items: {
3469
+ type: "string",
3470
+ pattern: "^\\[(.+)]$"
3471
+ }
3472
+ }
3473
+ }
3474
+ }
3475
+ }, usedFieldsCache = new ModuleCache();
3476
+ function getUsedFields(schema16, operations) {
3477
+ let cachedValue = usedFieldsCache.get(schema16);
3478
+ if (cachedValue)
3479
+ return cachedValue;
3480
+ let usedFields = /* @__PURE__ */ Object.create(null), typeInfo = new TypeInfo2(schema16), visitor = visitWithTypeInfo2(typeInfo, {
3324
3481
  Field(node) {
3325
3482
  if (!typeInfo.getFieldDef())
3326
3483
  return !1;
@@ -3330,7 +3487,7 @@ function getUsedFields(schema15, operations) {
3330
3487
  }), allDocuments = [...operations.getOperations(), ...operations.getFragments()];
3331
3488
  for (let { document } of allDocuments)
3332
3489
  visit6(document, visitor);
3333
- return usedFieldsCache = usedFields, usedFieldsCache;
3490
+ return usedFieldsCache.set(schema16, usedFields), usedFields;
3334
3491
  }
3335
3492
  var rule16 = {
3336
3493
  meta: {
@@ -3392,17 +3549,34 @@ var rule16 = {
3392
3549
  }
3393
3550
  `
3394
3551
  )
3552
+ },
3553
+ {
3554
+ title: "Correct (ignoring fields)",
3555
+ usage: [{ ignoredFieldSelectors: RELAY_DEFAULT_IGNORED_FIELD_SELECTORS }],
3556
+ code: (
3557
+ /* GraphQL */
3558
+ `
3559
+ ### 1\uFE0F\u20E3 YOUR SCHEMA
3560
+ ${RELAY_SCHEMA}
3561
+
3562
+ ### 2\uFE0F\u20E3 YOUR QUERY
3563
+ ${RELAY_QUERY}
3564
+ `
3565
+ )
3395
3566
  }
3396
3567
  ]
3397
3568
  },
3398
3569
  type: "suggestion",
3399
- schema: [],
3570
+ schema: schema8,
3400
3571
  hasSuggestions: !0
3401
3572
  },
3402
3573
  create(context) {
3403
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID10, context), siblingsOperations = requireSiblingsOperations(RULE_ID10, context), usedFields = getUsedFields(schema15, siblingsOperations);
3574
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID10, context), siblingsOperations = requireSiblingsOperations(RULE_ID10, context), usedFields = getUsedFields(schema16, siblingsOperations), { ignoredFieldSelectors } = context.options[0] || {};
3404
3575
  return {
3405
- FieldDefinition(node) {
3576
+ [(ignoredFieldSelectors || []).reduce(
3577
+ (acc, selector2) => `${acc}:not(${selector2})`,
3578
+ "FieldDefinition"
3579
+ )](node) {
3406
3580
  let fieldName = node.name.value, parentTypeName = node.parent.name.value;
3407
3581
  usedFields[parentTypeName]?.has(fieldName) || context.report({
3408
3582
  node: node.name,
@@ -3423,9 +3597,9 @@ var rule16 = {
3423
3597
  }
3424
3598
  };
3425
3599
 
3426
- // src/rules/relay-arguments.ts
3600
+ // src/rules/relay-arguments/index.ts
3427
3601
  import { isScalarType as isScalarType2, Kind as Kind14 } from "graphql";
3428
- var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema8 = {
3602
+ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema9 = {
3429
3603
  type: "array",
3430
3604
  maxItems: 1,
3431
3605
  items: {
@@ -3491,10 +3665,10 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3491
3665
  messages: {
3492
3666
  [MISSING_ARGUMENTS]: "A field that returns a Connection type must include forward pagination arguments (`first` and `after`), backward pagination arguments (`last` and `before`), or both."
3493
3667
  },
3494
- schema: schema8
3668
+ schema: schema9
3495
3669
  },
3496
3670
  create(context) {
3497
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID11, context), { includeBoth = !0 } = context.options[0] || {};
3671
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID11, context), { includeBoth = !0 } = context.options[0] || {};
3498
3672
  return {
3499
3673
  "FieldDefinition > .gqlType Name[value=/Connection$/]"(node) {
3500
3674
  let fieldNode = node.parent;
@@ -3512,7 +3686,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3512
3686
  }
3513
3687
  function checkField(typeName, argumentName) {
3514
3688
  let argument = args[argumentName], hasArgument = !!argument, type = argument;
3515
- if (hasArgument && type.gqlType.kind === Kind14.NON_NULL_TYPE && (type = type.gqlType), !(hasArgument && type.gqlType.kind === Kind14.NAMED_TYPE && (type.gqlType.name.value === typeName || typeName === "String" && isScalarType2(schema15.getType(type.gqlType.name.value))))) {
3689
+ if (hasArgument && type.gqlType.kind === Kind14.NON_NULL_TYPE && (type = type.gqlType), !(hasArgument && type.gqlType.kind === Kind14.NAMED_TYPE && (type.gqlType.name.value === typeName || typeName === "String" && isScalarType2(schema16.getType(type.gqlType.name.value))))) {
3516
3690
  let returnType = typeName === "String" ? "String or Scalar" : typeName;
3517
3691
  context.report({
3518
3692
  node: (argument || fieldNode).name,
@@ -3526,7 +3700,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3526
3700
  }
3527
3701
  };
3528
3702
 
3529
- // src/rules/relay-connection-types.ts
3703
+ // src/rules/relay-connection-types/index.ts
3530
3704
  import { Kind as Kind15 } from "graphql";
3531
3705
  var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUST_CONTAIN_FIELD_EDGES", MUST_CONTAIN_FIELD_PAGE_INFO = "MUST_CONTAIN_FIELD_PAGE_INFO", MUST_HAVE_CONNECTION_SUFFIX = "MUST_HAVE_CONNECTION_SUFFIX", EDGES_FIELD_MUST_RETURN_LIST_TYPE = "EDGES_FIELD_MUST_RETURN_LIST_TYPE", PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE = "PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE", NON_OBJECT_TYPES = [
3532
3706
  Kind15.SCALAR_TYPE_DEFINITION,
@@ -3613,7 +3787,7 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
3613
3787
  }
3614
3788
  };
3615
3789
 
3616
- // src/rules/relay-edge-types.ts
3790
+ // src/rules/relay-edge-types/index.ts
3617
3791
  import {
3618
3792
  isObjectType as isObjectType2,
3619
3793
  isScalarType as isScalarType3,
@@ -3622,7 +3796,7 @@ import {
3622
3796
  } from "graphql";
3623
3797
  import { getDocumentNodeFromSchema } from "@graphql-tools/utils";
3624
3798
  var RULE_ID12 = "relay-edge-types", MESSAGE_MUST_BE_OBJECT_TYPE = "MESSAGE_MUST_BE_OBJECT_TYPE", MESSAGE_MISSING_EDGE_SUFFIX = "MESSAGE_MISSING_EDGE_SUFFIX", MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE = "MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE", MESSAGE_SHOULD_IMPLEMENTS_NODE = "MESSAGE_SHOULD_IMPLEMENTS_NODE", edgeTypesCache;
3625
- function getEdgeTypes(schema15) {
3799
+ function getEdgeTypes(schema16) {
3626
3800
  if (edgeTypesCache)
3627
3801
  return edgeTypesCache;
3628
3802
  let edgeTypes = /* @__PURE__ */ new Set(), visitor = {
@@ -3631,14 +3805,14 @@ function getEdgeTypes(schema15) {
3631
3805
  return;
3632
3806
  let edges = node.fields?.find((field) => field.name.value === "edges");
3633
3807
  if (edges) {
3634
- let edgesTypeName = getTypeName(edges), edgesType = schema15.getType(edgesTypeName);
3808
+ let edgesTypeName = getTypeName(edges), edgesType = schema16.getType(edgesTypeName);
3635
3809
  isObjectType2(edgesType) && edgeTypes.add(edgesTypeName);
3636
3810
  }
3637
3811
  }
3638
- }, astNode = getDocumentNodeFromSchema(schema15);
3812
+ }, astNode = getDocumentNodeFromSchema(schema16);
3639
3813
  return visit7(astNode, visitor), edgeTypesCache = edgeTypes, edgeTypesCache;
3640
3814
  }
3641
- var schema9 = {
3815
+ var schema10 = {
3642
3816
  type: "array",
3643
3817
  maxItems: 1,
3644
3818
  items: {
@@ -3704,10 +3878,10 @@ var schema9 = {
3704
3878
  [MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE]: "A list type should only wrap an edge type.",
3705
3879
  [MESSAGE_SHOULD_IMPLEMENTS_NODE]: "Edge type's field `node` must implement `Node` interface."
3706
3880
  },
3707
- schema: schema9
3881
+ schema: schema10
3708
3882
  },
3709
3883
  create(context) {
3710
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID12, context), edgeTypes = getEdgeTypes(schema15), options = {
3884
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID12, context), edgeTypes = getEdgeTypes(schema16), options = {
3711
3885
  withEdgeSuffix: !0,
3712
3886
  shouldImplementNode: !0,
3713
3887
  listTypeCanWrapOnlyEdgeType: !0,
@@ -3722,7 +3896,7 @@ var schema9 = {
3722
3896
  else if (!isNamedOrNonNullNamed(nodeField.gqlType))
3723
3897
  context.report({ node: nodeField.name, message: `Field \`node\` must ${message}` });
3724
3898
  else if (options.shouldImplementNode) {
3725
- let nodeReturnTypeName = getTypeName(nodeField.gqlType.rawNode()), type = schema15.getType(nodeReturnTypeName);
3899
+ let nodeReturnTypeName = getTypeName(nodeField.gqlType.rawNode()), type = schema16.getType(nodeReturnTypeName);
3726
3900
  if (!isObjectType2(type))
3727
3901
  return;
3728
3902
  type.astNode.interfaces?.some((n) => n.name.value === "Node") || context.report({ node: node.name, messageId: MESSAGE_SHOULD_IMPLEMENTS_NODE });
@@ -3737,10 +3911,10 @@ var schema9 = {
3737
3911
  return;
3738
3912
  }
3739
3913
  let typeName = getTypeName(cursorField.rawNode());
3740
- (!isNamedOrNonNullNamed(cursorField.gqlType) || typeName !== "String" && !isScalarType3(schema15.getType(typeName))) && context.report({ node: cursorField.name, message: `Field \`cursor\` must ${message}` });
3914
+ (!isNamedOrNonNullNamed(cursorField.gqlType) || typeName !== "String" && !isScalarType3(schema16.getType(typeName))) && context.report({ node: cursorField.name, message: `Field \`cursor\` must ${message}` });
3741
3915
  }, listeners = {
3742
3916
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/Connection$/] > FieldDefinition[name.value=edges] > .gqlType Name"(node) {
3743
- let type = schema15.getType(node.value);
3917
+ let type = schema16.getType(node.value);
3744
3918
  isObjectType2(type) || context.report({ node, messageId: MESSAGE_MUST_BE_OBJECT_TYPE });
3745
3919
  },
3746
3920
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)"(node) {
@@ -3757,7 +3931,7 @@ var schema9 = {
3757
3931
  }
3758
3932
  };
3759
3933
 
3760
- // src/rules/relay-page-info.ts
3934
+ // src/rules/relay-page-info/index.ts
3761
3935
  import { isScalarType as isScalarType4, Kind as Kind17 } from "graphql";
3762
3936
  var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", MESSAGE_MUST_BE_OBJECT_TYPE2 = "MESSAGE_MUST_BE_OBJECT_TYPE", notPageInfoTypesSelector = `:matches(${NON_OBJECT_TYPES})[name.value=PageInfo] > .name`, hasPageInfoChecked = !1, rule20 = {
3763
3937
  meta: {
@@ -3799,8 +3973,8 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3799
3973
  schema: []
3800
3974
  },
3801
3975
  create(context) {
3802
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID13, context);
3803
- return hasPageInfoChecked || (schema15.getType("PageInfo") || context.report({
3976
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID13, context);
3977
+ return hasPageInfoChecked || (schema16.getType("PageInfo") || context.report({
3804
3978
  loc: REPORT_ON_FIRST_CHARACTER,
3805
3979
  messageId: MESSAGE_MUST_EXIST
3806
3980
  }), hasPageInfoChecked = !0), {
@@ -3814,7 +3988,7 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3814
3988
  let field = fieldMap[fieldName], isAllowedType = !1;
3815
3989
  if (field) {
3816
3990
  let type = field.gqlType;
3817
- typeName === "Boolean" ? isAllowedType = type.kind === Kind17.NON_NULL_TYPE && type.gqlType.kind === Kind17.NAMED_TYPE && type.gqlType.name.value === "Boolean" : type.kind === Kind17.NAMED_TYPE && (isAllowedType = type.name.value === "String" || isScalarType4(schema15.getType(type.name.value)));
3991
+ typeName === "Boolean" ? isAllowedType = type.kind === Kind17.NON_NULL_TYPE && type.gqlType.kind === Kind17.NAMED_TYPE && type.gqlType.name.value === "Boolean" : type.kind === Kind17.NAMED_TYPE && (isAllowedType = type.name.value === "String" || isScalarType4(schema16.getType(type.name.value)));
3818
3992
  }
3819
3993
  if (!isAllowedType) {
3820
3994
  let returnType = typeName === "Boolean" ? "non-null Boolean" : "either String or Scalar, which can be null if there are no results";
@@ -3830,8 +4004,8 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3830
4004
  }
3831
4005
  };
3832
4006
 
3833
- // src/rules/require-deprecation-date.ts
3834
- var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIRE_DATE", MESSAGE_INVALID_FORMAT = "MESSAGE_INVALID_FORMAT", MESSAGE_INVALID_DATE = "MESSAGE_INVALID_DATE", MESSAGE_CAN_BE_REMOVED = "MESSAGE_CAN_BE_REMOVED", schema10 = {
4007
+ // src/rules/require-deprecation-date/index.ts
4008
+ var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIRE_DATE", MESSAGE_INVALID_FORMAT = "MESSAGE_INVALID_FORMAT", MESSAGE_INVALID_DATE = "MESSAGE_INVALID_DATE", MESSAGE_CAN_BE_REMOVED = "MESSAGE_CAN_BE_REMOVED", schema11 = {
3835
4009
  type: "array",
3836
4010
  maxItems: 1,
3837
4011
  items: {
@@ -3897,7 +4071,7 @@ var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIR
3897
4071
  [MESSAGE_INVALID_DATE]: 'Invalid "{{ deletionDate }}" deletion date for {{ nodeName }}',
3898
4072
  [MESSAGE_CAN_BE_REMOVED]: "{{ nodeName }} \u0441an be removed"
3899
4073
  },
3900
- schema: schema10
4074
+ schema: schema11
3901
4075
  },
3902
4076
  create(context) {
3903
4077
  return {
@@ -3955,7 +4129,7 @@ var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIR
3955
4129
  }
3956
4130
  };
3957
4131
 
3958
- // src/rules/require-deprecation-reason.ts
4132
+ // src/rules/require-deprecation-reason/index.ts
3959
4133
  var rule22 = {
3960
4134
  meta: {
3961
4135
  docs: {
@@ -4017,7 +4191,7 @@ var rule22 = {
4017
4191
  }
4018
4192
  };
4019
4193
 
4020
- // src/rules/require-description.ts
4194
+ // src/rules/require-description/index.ts
4021
4195
  import { Kind as Kind18, TokenKind as TokenKind3 } from "graphql";
4022
4196
  import { getRootTypeNames } from "@graphql-tools/utils";
4023
4197
  var RULE_ID14 = "require-description", ALLOWED_KINDS2 = [
@@ -4027,7 +4201,7 @@ var RULE_ID14 = "require-description", ALLOWED_KINDS2 = [
4027
4201
  Kind18.INPUT_VALUE_DEFINITION,
4028
4202
  Kind18.ENUM_VALUE_DEFINITION,
4029
4203
  Kind18.OPERATION_DEFINITION
4030
- ], schema11 = {
4204
+ ], schema12 = {
4031
4205
  type: "array",
4032
4206
  minItems: 1,
4033
4207
  maxItems: 1,
@@ -4135,14 +4309,14 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4135
4309
  messages: {
4136
4310
  [RULE_ID14]: "Description is required for {{ nodeName }}"
4137
4311
  },
4138
- schema: schema11
4312
+ schema: schema12
4139
4313
  },
4140
4314
  create(context) {
4141
4315
  let { types, rootField, ...restOptions } = context.options[0] || {}, kinds = new Set(types ? TYPES_KINDS : []);
4142
4316
  for (let [kind, isEnabled] of Object.entries(restOptions))
4143
4317
  isEnabled ? kinds.add(kind) : kinds.delete(kind);
4144
4318
  if (rootField) {
4145
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID14, context), rootTypeNames = getRootTypeNames(schema15);
4319
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID14, context), rootTypeNames = getRootTypeNames(schema16);
4146
4320
  kinds.add(
4147
4321
  `:matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/^(${[
4148
4322
  ...rootTypeNames
@@ -4172,7 +4346,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4172
4346
  }
4173
4347
  };
4174
4348
 
4175
- // src/rules/require-field-of-type-query-in-mutation-result.ts
4349
+ // src/rules/require-field-of-type-query-in-mutation-result/index.ts
4176
4350
  import { isObjectType as isObjectType3 } from "graphql";
4177
4351
  var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
4178
4352
  meta: {
@@ -4221,10 +4395,10 @@ var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
4221
4395
  schema: []
4222
4396
  },
4223
4397
  create(context) {
4224
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID15, context), mutationType = schema15.getMutationType(), queryType = schema15.getQueryType();
4398
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID15, context), mutationType = schema16.getMutationType(), queryType = schema16.getQueryType();
4225
4399
  return !mutationType || !queryType ? {} : {
4226
4400
  [`:matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=${mutationType.name}] > FieldDefinition > .gqlType Name`](node) {
4227
- let typeName = node.value, graphQLType = schema15.getType(typeName);
4401
+ let typeName = node.value, graphQLType = schema16.getType(typeName);
4228
4402
  if (isObjectType3(graphQLType)) {
4229
4403
  let { fields } = graphQLType.astNode;
4230
4404
  fields?.some((field) => getTypeName(field) === queryType.name) || context.report({
@@ -4237,8 +4411,8 @@ var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
4237
4411
  }
4238
4412
  };
4239
4413
 
4240
- // src/rules/require-import-fragment.ts
4241
- import path from "path";
4414
+ // src/rules/require-import-fragment/index.ts
4415
+ import path from "node:path";
4242
4416
  var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expression", rule25 = {
4243
4417
  meta: {
4244
4418
  type: "suggestion",
@@ -4323,7 +4497,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4323
4497
  ).test(comment.value)) continue;
4324
4498
  let extractedImportPath = comment.value.match(/(["'])((?:\1|.)*?)\1/)?.[2];
4325
4499
  if (!extractedImportPath) continue;
4326
- let importPath = path.join(path.dirname(filePath), extractedImportPath);
4500
+ let importPath = path.join(filePath, "..", extractedImportPath);
4327
4501
  if (fragmentsFromSiblings.some(
4328
4502
  (source) => source.filePath === importPath
4329
4503
  )) return;
@@ -4331,7 +4505,12 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4331
4505
  if (fragmentsFromSiblings.some(
4332
4506
  (source) => source.filePath === filePath
4333
4507
  )) return;
4334
- let suggestedFilePaths = fragmentsFromSiblings.length ? fragmentsFromSiblings.map((o) => path.relative(path.dirname(filePath), o.filePath)) : ["CHANGE_ME.graphql"];
4508
+ let suggestedFilePaths = fragmentsFromSiblings.length ? fragmentsFromSiblings.map(
4509
+ (o) => (
4510
+ // Use always forward slash for suggested import path
4511
+ slash(path.relative(path.dirname(filePath), o.filePath))
4512
+ )
4513
+ ) : ["CHANGE_ME.graphql"];
4335
4514
  context.report({
4336
4515
  node,
4337
4516
  messageId: RULE_ID16,
@@ -4351,7 +4530,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4351
4530
  }
4352
4531
  };
4353
4532
 
4354
- // src/rules/require-nullable-fields-with-oneof.ts
4533
+ // src/rules/require-nullable-fields-with-oneof/index.ts
4355
4534
  import { Kind as Kind19 } from "graphql";
4356
4535
  var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4357
4536
  meta: {
@@ -4410,7 +4589,7 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4410
4589
  }
4411
4590
  };
4412
4591
 
4413
- // src/rules/require-nullable-result-in-root.ts
4592
+ // src/rules/require-nullable-result-in-root/index.ts
4414
4593
  import { Kind as Kind20 } from "graphql";
4415
4594
  var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4416
4595
  meta: {
@@ -4454,8 +4633,8 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4454
4633
  schema: []
4455
4634
  },
4456
4635
  create(context) {
4457
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID18, context), rootTypeNames = new Set(
4458
- [schema15.getQueryType(), schema15.getMutationType()].filter(truthy).map((type) => type.name)
4636
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID18, context), rootTypeNames = new Set(
4637
+ [schema16.getQueryType(), schema16.getMutationType()].filter(truthy).map((type) => type.name)
4459
4638
  ), sourceCode = context.getSourceCode();
4460
4639
  return {
4461
4640
  "ObjectTypeDefinition,ObjectTypeExtension"(node) {
@@ -4463,7 +4642,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4463
4642
  for (let field of node.fields || []) {
4464
4643
  if (field.gqlType.type !== Kind20.NON_NULL_TYPE || field.gqlType.gqlType.type !== Kind20.NAMED_TYPE)
4465
4644
  continue;
4466
- let name = field.gqlType.gqlType.name.value, type = schema15.getType(name), resultType = type?.astNode ? getNodeName(type.astNode) : type?.name;
4645
+ let name = field.gqlType.gqlType.name.value, type = schema16.getType(name), resultType = type?.astNode ? getNodeName(type.astNode) : type?.name;
4467
4646
  context.report({
4468
4647
  node: field.gqlType,
4469
4648
  messageId: RULE_ID18,
@@ -4487,7 +4666,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4487
4666
  }
4488
4667
  };
4489
4668
 
4490
- // src/rules/require-selections.ts
4669
+ // src/rules/require-selections/index.ts
4491
4670
  import {
4492
4671
  GraphQLInterfaceType,
4493
4672
  GraphQLObjectType,
@@ -4498,7 +4677,7 @@ import {
4498
4677
  visitWithTypeInfo as visitWithTypeInfo3
4499
4678
  } from "graphql";
4500
4679
  import { asArray } from "@graphql-tools/utils";
4501
- var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema12 = {
4680
+ var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema13 = {
4502
4681
  definitions: {
4503
4682
  asString: {
4504
4683
  type: "string"
@@ -4583,10 +4762,10 @@ var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema12 = {
4583
4762
  [RULE_ID19]: `Field{{ pluralSuffix }} {{ fieldName }} must be selected when it's available on a type.
4584
4763
  Include it in your selection set{{ addition }}.`
4585
4764
  },
4586
- schema: schema12
4765
+ schema: schema13
4587
4766
  },
4588
4767
  create(context) {
4589
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID19, context), siblings = requireSiblingsOperations(RULE_ID19, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo3(schema15);
4768
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID19, context), siblings = requireSiblingsOperations(RULE_ID19, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo3(schema16);
4590
4769
  function checkFragments(node) {
4591
4770
  for (let selection of node.selections) {
4592
4771
  if (selection.kind !== Kind21.FRAGMENT_SPREAD)
@@ -4613,13 +4792,19 @@ Include it in your selection set{{ addition }}.`
4613
4792
  let rawType = getBaseType(type);
4614
4793
  if (rawType instanceof GraphQLObjectType || rawType instanceof GraphQLInterfaceType)
4615
4794
  checkFields(rawType);
4616
- else if (rawType instanceof GraphQLUnionType) {
4617
- for (let selection of node.selections)
4795
+ else if (rawType instanceof GraphQLUnionType)
4796
+ for (let selection of node.selections) {
4797
+ let types = rawType.getTypes();
4618
4798
  if (selection.kind === Kind21.INLINE_FRAGMENT) {
4619
- let t = rawType.getTypes().find((t2) => t2.name === selection.typeCondition.name.value);
4799
+ let t = types.find((t2) => t2.name === selection.typeCondition.name.value);
4620
4800
  t && checkFields(t);
4801
+ } else if (selection.kind === Kind21.FRAGMENT_SPREAD) {
4802
+ let [foundSpread] = siblings.getFragment(selection.name.value);
4803
+ if (!foundSpread) return;
4804
+ let fragmentSpread = foundSpread.document, t = fragmentSpread.typeCondition.name.value === rawType.name ? rawType : types.find((t2) => t2.name === fragmentSpread.typeCondition.name.value);
4805
+ checkedFragmentSpreads.add(fragmentSpread.name.value), checkSelections(fragmentSpread.selectionSet, t, loc, parent, checkedFragmentSpreads);
4621
4806
  }
4622
- }
4807
+ }
4623
4808
  function checkFields(rawType2) {
4624
4809
  let fields = rawType2.getFields();
4625
4810
  if (!idNames.some((name) => fields[name]))
@@ -4672,7 +4857,7 @@ Include it in your selection set{{ addition }}.`
4672
4857
  }
4673
4858
  };
4674
4859
 
4675
- // src/rules/require-type-pattern-with-oneof.ts
4860
+ // src/rules/require-type-pattern-with-oneof/index.ts
4676
4861
  var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
4677
4862
  meta: {
4678
4863
  type: "suggestion",
@@ -4732,10 +4917,10 @@ var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
4732
4917
  }
4733
4918
  };
4734
4919
 
4735
- // src/rules/selection-set-depth.ts
4920
+ // src/rules/selection-set-depth/index.ts
4736
4921
  import { Kind as Kind22 } from "graphql";
4737
4922
  import depthLimit from "graphql-depth-limit";
4738
- var RULE_ID21 = "selection-set-depth", schema13 = {
4923
+ var RULE_ID21 = "selection-set-depth", schema14 = {
4739
4924
  type: "array",
4740
4925
  minItems: 1,
4741
4926
  maxItems: 1,
@@ -4803,7 +4988,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4803
4988
  recommended: !0,
4804
4989
  configOptions: [{ maxDepth: 7 }]
4805
4990
  },
4806
- schema: schema13
4991
+ schema: schema14
4807
4992
  },
4808
4993
  create(context) {
4809
4994
  let siblings = null;
@@ -4825,7 +5010,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4825
5010
  checkFn({
4826
5011
  getDocument: () => document,
4827
5012
  reportError(error) {
4828
- let { line, column } = error.locations[0], token = context.getAncestors()[0].tokens.find(
5013
+ let { line, column } = error.locations[0], token = context.sourceCode.getAncestors(node)[0].tokens.find(
4829
5014
  (token2) => token2.loc.start.line === line && token2.loc.start.column === column - 1
4830
5015
  );
4831
5016
  context.report({
@@ -4862,9 +5047,9 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4862
5047
  }
4863
5048
  };
4864
5049
 
4865
- // src/rules/strict-id-in-types.ts
5050
+ // src/rules/strict-id-in-types/index.ts
4866
5051
  import { Kind as Kind23 } from "graphql";
4867
- var RULE_ID22 = "strict-id-in-types", schema14 = {
5052
+ var RULE_ID22 = "strict-id-in-types", schema15 = {
4868
5053
  type: "array",
4869
5054
  maxItems: 1,
4870
5055
  items: {
@@ -4972,7 +5157,7 @@ var RULE_ID22 = "strict-id-in-types", schema14 = {
4972
5157
  }
4973
5158
  ]
4974
5159
  },
4975
- schema: schema14
5160
+ schema: schema15
4976
5161
  },
4977
5162
  create(context) {
4978
5163
  let options = {
@@ -4980,12 +5165,12 @@ var RULE_ID22 = "strict-id-in-types", schema14 = {
4980
5165
  acceptedIdTypes: ["ID"],
4981
5166
  exceptions: {},
4982
5167
  ...context.options[0]
4983
- }, schema15 = requireGraphQLSchemaFromContext(RULE_ID22, context);
5168
+ }, schema16 = requireGraphQLSchemaFromContext(RULE_ID22, context);
4984
5169
  return {
4985
5170
  [`ObjectTypeDefinition[name.value!=/^(${[
4986
- schema15.getQueryType(),
4987
- schema15.getMutationType(),
4988
- schema15.getSubscriptionType()
5171
+ schema16.getQueryType(),
5172
+ schema16.getMutationType(),
5173
+ schema16.getSubscriptionType()
4989
5174
  ].filter(truthy).map((type) => type.name).join("|")})$/]`](node) {
4990
5175
  let typeName = node.name.value;
4991
5176
  if (options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix)))
@@ -5007,7 +5192,7 @@ Accepted type${pluralTypesSuffix}: ${englishJoinWords(options.acceptedIdTypes)}.
5007
5192
  }
5008
5193
  };
5009
5194
 
5010
- // src/rules/unique-enum-value-names.ts
5195
+ // src/rules/unique-enum-value-names/index.ts
5011
5196
  import { Kind as Kind24 } from "graphql";
5012
5197
  var rule32 = {
5013
5198
  meta: {
@@ -5076,12 +5261,12 @@ var rule32 = {
5076
5261
  }
5077
5262
  };
5078
5263
 
5079
- // src/rules/unique-fragment-name.ts
5080
- import { relative as relative2 } from "path";
5264
+ // src/rules/unique-fragment-name/index.ts
5265
+ import { relative as relative2 } from "node:path";
5081
5266
  import { Kind as Kind25 } from "graphql";
5082
5267
  var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
5083
5268
  let documentName = node.name.value, siblings = requireSiblingsOperations(ruleId, context), siblingDocuments = node.kind === Kind25.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName), filepath = context.filename, conflictingDocuments = siblingDocuments.filter((f) => {
5084
- let isSameName = f.document.name?.value === documentName, isSamePath = normalizePath(f.filePath) === normalizePath(filepath);
5269
+ let isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
5085
5270
  return isSameName && !isSamePath;
5086
5271
  });
5087
5272
  conflictingDocuments.length > 0 && context.report({
@@ -5159,7 +5344,7 @@ var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
5159
5344
  }
5160
5345
  };
5161
5346
 
5162
- // src/rules/unique-operation-name.ts
5347
+ // src/rules/unique-operation-name/index.ts
5163
5348
  var RULE_ID24 = "unique-operation-name", rule34 = {
5164
5349
  meta: {
5165
5350
  type: "suggestion",
@@ -5269,50 +5454,36 @@ var rules = {
5269
5454
  };
5270
5455
 
5271
5456
  // src/configs/index.ts
5272
- var import_operations_all = __toESM(require_operations_all()), import_operations_recommended = __toESM(require_operations_recommended()), import_schema_all = __toESM(require_schema_all()), import_schema_recommended = __toESM(require_schema_recommended()), import_schema_relay = __toESM(require_schema_relay()), configs = {
5457
+ var import_operations_all = __toESM(require_operations_all(), 1), import_operations_recommended = __toESM(require_operations_recommended(), 1), import_schema_all = __toESM(require_schema_all(), 1), import_schema_recommended = __toESM(require_schema_recommended(), 1), import_schema_relay = __toESM(require_schema_relay(), 1), configs = {
5273
5458
  "schema-recommended": import_schema_recommended.default,
5274
5459
  "schema-all": import_schema_all.default,
5275
5460
  "schema-relay": import_schema_relay.default,
5276
5461
  "operations-recommended": import_operations_recommended.default,
5277
- "operations-all": import_operations_all.default
5278
- };
5279
-
5280
- // src/flat-configs.ts
5281
- var languageOptions = {
5282
- parser: { parseForESLint }
5283
- }, flatConfigs = {
5284
- "operations-all": {
5285
- languageOptions,
5462
+ "operations-all": import_operations_all.default,
5463
+ "flat/schema-recommended": {
5464
+ rules: import_schema_recommended.default.rules
5465
+ },
5466
+ "flat/schema-all": {
5286
5467
  rules: {
5287
- ...configs["operations-recommended"].rules,
5288
- ...configs["operations-all"].rules
5468
+ ...import_schema_recommended.default.rules,
5469
+ ...import_schema_all.default.rules
5289
5470
  }
5290
5471
  },
5291
- "operations-recommended": {
5292
- languageOptions,
5293
- rules: configs["operations-recommended"].rules
5472
+ "flat/schema-relay": {
5473
+ rules: import_schema_relay.default.rules
5294
5474
  },
5295
- "schema-relay": {
5296
- languageOptions,
5297
- rules: configs["schema-relay"].rules
5475
+ "flat/operations-recommended": {
5476
+ rules: import_operations_recommended.default.rules
5298
5477
  },
5299
- "schema-all": {
5300
- languageOptions,
5478
+ "flat/operations-all": {
5301
5479
  rules: {
5302
- ...configs["schema-recommended"].rules,
5303
- ...configs["schema-all"].rules
5480
+ ...import_operations_recommended.default.rules,
5481
+ ...import_operations_all.default.rules
5304
5482
  }
5305
- },
5306
- "schema-recommended": {
5307
- languageOptions,
5308
- rules: configs["schema-recommended"].rules
5309
5483
  }
5310
5484
  };
5311
5485
  export {
5312
5486
  configs,
5313
- flatConfigs,
5314
- parseForESLint,
5315
- requireGraphQLSchemaFromContext,
5316
- requireSiblingsOperations,
5487
+ parser,
5317
5488
  rules
5318
5489
  };