@graphql-eslint/eslint-plugin 4.0.0-alpha.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/cjs/cache.js +1 -2
  2. package/cjs/configs/index.d.cts +427 -10
  3. package/cjs/configs/index.js +1 -2
  4. package/cjs/configs/operations-all.d.cts +8 -8
  5. package/cjs/configs/operations-all.js +30 -33
  6. package/cjs/configs/operations-recommended.d.cts +35 -35
  7. package/cjs/configs/operations-recommended.js +56 -59
  8. package/cjs/configs/schema-all.d.cts +12 -12
  9. package/cjs/configs/schema-all.js +26 -29
  10. package/cjs/configs/schema-recommended.d.cts +23 -23
  11. package/cjs/configs/schema-recommended.js +70 -73
  12. package/cjs/configs/schema-relay.d.cts +5 -5
  13. package/cjs/configs/schema-relay.js +14 -17
  14. package/cjs/documents.js +8 -4
  15. package/cjs/estree-converter/converter.js +1 -2
  16. package/cjs/estree-converter/utils.js +1 -2
  17. package/cjs/graphql-config.d.cts +6 -1
  18. package/cjs/graphql-config.js +9 -3
  19. package/cjs/index.d.cts +436 -16
  20. package/cjs/index.js +2 -3
  21. package/cjs/meta.js +1 -2
  22. package/cjs/parser.js +2 -6
  23. package/cjs/processor.js +5 -2
  24. package/cjs/rules/alphabetize/index.js +1 -2
  25. package/cjs/rules/description-style/index.js +1 -2
  26. package/cjs/rules/graphql-js-validation.js +4 -5
  27. package/cjs/rules/index.d.cts +6 -4
  28. package/cjs/rules/index.js +1 -2
  29. package/cjs/rules/input-name/index.js +1 -2
  30. package/cjs/rules/lone-executable-definition/index.js +1 -2
  31. package/cjs/rules/match-document-filename/index.js +1 -2
  32. package/cjs/rules/naming-convention/index.js +4 -3
  33. package/cjs/rules/no-anonymous-operations/index.js +1 -2
  34. package/cjs/rules/no-deprecated/index.js +20 -8
  35. package/cjs/rules/no-duplicate-fields/index.js +1 -2
  36. package/cjs/rules/no-hashtag-description/index.js +1 -2
  37. package/cjs/rules/no-one-place-fragments/index.js +2 -3
  38. package/cjs/rules/no-root-type/index.js +2 -3
  39. package/cjs/rules/no-scalar-result-type-on-mutation/index.js +2 -3
  40. package/cjs/rules/no-typename-prefix/index.js +1 -2
  41. package/cjs/rules/no-unreachable-types/index.js +4 -6
  42. package/cjs/rules/no-unused-fields/index.d.cts +24 -3
  43. package/cjs/rules/no-unused-fields/index.js +119 -10
  44. package/cjs/rules/relay-arguments/index.js +2 -3
  45. package/cjs/rules/relay-connection-types/index.js +1 -2
  46. package/cjs/rules/relay-edge-types/index.js +2 -3
  47. package/cjs/rules/relay-page-info/index.js +2 -3
  48. package/cjs/rules/require-deprecation-date/index.js +1 -2
  49. package/cjs/rules/require-deprecation-reason/index.js +1 -2
  50. package/cjs/rules/require-description/index.js +2 -8
  51. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.js +2 -3
  52. package/cjs/rules/require-import-fragment/index.js +9 -5
  53. package/cjs/rules/require-nullable-fields-with-oneof/index.js +1 -2
  54. package/cjs/rules/require-nullable-result-in-root/index.js +2 -3
  55. package/cjs/rules/require-selections/index.js +14 -8
  56. package/cjs/rules/require-type-pattern-with-oneof/index.js +1 -2
  57. package/cjs/rules/selection-set-depth/index.js +4 -5
  58. package/cjs/rules/strict-id-in-types/index.js +2 -3
  59. package/cjs/rules/unique-enum-value-names/index.js +1 -2
  60. package/cjs/rules/unique-fragment-name/index.js +2 -3
  61. package/cjs/rules/unique-operation-name/index.js +1 -2
  62. package/cjs/schema.js +1 -2
  63. package/cjs/siblings.js +1 -2
  64. package/cjs/types.d.cts +1 -0
  65. package/cjs/utils.d.cts +4 -4
  66. package/cjs/utils.js +8 -9
  67. package/esm/cache.js +0 -1
  68. package/esm/configs/index.d.ts +427 -10
  69. package/esm/configs/index.js +0 -1
  70. package/esm/configs/operations-all.d.ts +7 -7
  71. package/esm/configs/operations-all.js +28 -33
  72. package/esm/configs/operations-recommended.d.ts +34 -34
  73. package/esm/configs/operations-recommended.js +54 -59
  74. package/esm/configs/schema-all.d.ts +11 -11
  75. package/esm/configs/schema-all.js +24 -29
  76. package/esm/configs/schema-recommended.d.ts +22 -22
  77. package/esm/configs/schema-recommended.js +68 -73
  78. package/esm/configs/schema-relay.d.ts +4 -4
  79. package/esm/configs/schema-relay.js +12 -17
  80. package/esm/documents.js +8 -4
  81. package/esm/estree-converter/converter.js +0 -1
  82. package/esm/estree-converter/utils.js +0 -1
  83. package/esm/graphql-config.d.ts +6 -1
  84. package/esm/graphql-config.js +8 -2
  85. package/esm/index.d.ts +436 -16
  86. package/esm/index.js +3 -4
  87. package/esm/meta.js +1 -2
  88. package/esm/parser.js +3 -7
  89. package/esm/processor.js +4 -1
  90. package/esm/rules/alphabetize/index.js +0 -1
  91. package/esm/rules/description-style/index.js +0 -1
  92. package/esm/rules/graphql-js-validation.js +5 -6
  93. package/esm/rules/index.d.ts +6 -4
  94. package/esm/rules/index.js +0 -1
  95. package/esm/rules/input-name/index.js +0 -1
  96. package/esm/rules/lone-executable-definition/index.js +0 -1
  97. package/esm/rules/match-document-filename/index.js +0 -1
  98. package/esm/rules/naming-convention/index.js +3 -2
  99. package/esm/rules/no-anonymous-operations/index.js +0 -1
  100. package/esm/rules/no-deprecated/index.js +20 -8
  101. package/esm/rules/no-duplicate-fields/index.js +0 -1
  102. package/esm/rules/no-hashtag-description/index.js +0 -1
  103. package/esm/rules/no-one-place-fragments/index.js +2 -3
  104. package/esm/rules/no-root-type/index.js +2 -3
  105. package/esm/rules/no-scalar-result-type-on-mutation/index.js +2 -3
  106. package/esm/rules/no-typename-prefix/index.js +0 -1
  107. package/esm/rules/no-unreachable-types/index.js +5 -7
  108. package/esm/rules/no-unused-fields/index.d.ts +24 -3
  109. package/esm/rules/no-unused-fields/index.js +119 -10
  110. package/esm/rules/relay-arguments/index.js +2 -3
  111. package/esm/rules/relay-connection-types/index.js +0 -1
  112. package/esm/rules/relay-edge-types/index.js +2 -3
  113. package/esm/rules/relay-page-info/index.js +2 -3
  114. package/esm/rules/require-deprecation-date/index.js +0 -1
  115. package/esm/rules/require-deprecation-reason/index.js +0 -1
  116. package/esm/rules/require-description/index.js +2 -8
  117. package/esm/rules/require-field-of-type-query-in-mutation-result/index.js +2 -3
  118. package/esm/rules/require-import-fragment/index.js +9 -5
  119. package/esm/rules/require-nullable-fields-with-oneof/index.js +0 -1
  120. package/esm/rules/require-nullable-result-in-root/index.js +2 -3
  121. package/esm/rules/require-selections/index.js +15 -9
  122. package/esm/rules/require-type-pattern-with-oneof/index.js +0 -1
  123. package/esm/rules/selection-set-depth/index.js +4 -5
  124. package/esm/rules/strict-id-in-types/index.js +2 -3
  125. package/esm/rules/unique-enum-value-names/index.js +0 -1
  126. package/esm/rules/unique-fragment-name/index.js +2 -3
  127. package/esm/rules/unique-operation-name/index.js +0 -1
  128. package/esm/schema.js +0 -1
  129. package/esm/siblings.js +0 -1
  130. package/esm/types.d.ts +1 -0
  131. package/esm/utils.d.ts +4 -4
  132. package/esm/utils.js +8 -9
  133. package/index.browser.js +514 -426
  134. package/package.json +2 -2
  135. package/cjs/chunk-UIAXBAMD.js +0 -8
  136. package/esm/chunk-UIAXBAMD.js +0 -8
package/index.browser.js CHANGED
@@ -1,241 +1,3 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __commonJS = (cb, mod) => function() {
7
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- ));
23
-
24
- // src/configs/operations-all.ts
25
- var require_operations_all = __commonJS({
26
- "src/configs/operations-all.ts"(exports, module) {
27
- "use strict";
28
- module.exports = {
29
- extends: "./configs/operations-recommended",
30
- rules: {
31
- "@graphql-eslint/alphabetize": [
32
- "error",
33
- {
34
- definitions: !0,
35
- selections: ["OperationDefinition", "FragmentDefinition"],
36
- variables: !0,
37
- arguments: ["Field", "Directive"],
38
- groups: ["...", "id", "*", "{"]
39
- }
40
- ],
41
- "@graphql-eslint/lone-executable-definition": "error",
42
- "@graphql-eslint/match-document-filename": [
43
- "error",
44
- {
45
- query: "kebab-case",
46
- mutation: "kebab-case",
47
- subscription: "kebab-case",
48
- fragment: "kebab-case"
49
- }
50
- ],
51
- "@graphql-eslint/no-one-place-fragments": "error",
52
- "@graphql-eslint/require-import-fragment": "error"
53
- }
54
- };
55
- }
56
- });
57
-
58
- // src/configs/operations-recommended.ts
59
- var require_operations_recommended = __commonJS({
60
- "src/configs/operations-recommended.ts"(exports, module) {
61
- "use strict";
62
- module.exports = {
63
- parser: "@graphql-eslint/eslint-plugin",
64
- plugins: ["@graphql-eslint"],
65
- rules: {
66
- "@graphql-eslint/executable-definitions": "error",
67
- "@graphql-eslint/fields-on-correct-type": "error",
68
- "@graphql-eslint/fragments-on-composite-type": "error",
69
- "@graphql-eslint/known-argument-names": "error",
70
- "@graphql-eslint/known-directives": "error",
71
- "@graphql-eslint/known-fragment-names": "error",
72
- "@graphql-eslint/known-type-names": "error",
73
- "@graphql-eslint/lone-anonymous-operation": "error",
74
- "@graphql-eslint/naming-convention": [
75
- "error",
76
- {
77
- VariableDefinition: "camelCase",
78
- OperationDefinition: {
79
- style: "PascalCase",
80
- forbiddenPrefixes: ["Query", "Mutation", "Subscription", "Get"],
81
- forbiddenSuffixes: ["Query", "Mutation", "Subscription"]
82
- },
83
- FragmentDefinition: {
84
- style: "PascalCase",
85
- forbiddenPrefixes: ["Fragment"],
86
- forbiddenSuffixes: ["Fragment"]
87
- }
88
- }
89
- ],
90
- "@graphql-eslint/no-anonymous-operations": "error",
91
- "@graphql-eslint/no-deprecated": "error",
92
- "@graphql-eslint/no-duplicate-fields": "error",
93
- "@graphql-eslint/no-fragment-cycles": "error",
94
- "@graphql-eslint/no-undefined-variables": "error",
95
- "@graphql-eslint/no-unused-fragments": "error",
96
- "@graphql-eslint/no-unused-variables": "error",
97
- "@graphql-eslint/one-field-subscriptions": "error",
98
- "@graphql-eslint/overlapping-fields-can-be-merged": "error",
99
- "@graphql-eslint/possible-fragment-spread": "error",
100
- "@graphql-eslint/provided-required-arguments": "error",
101
- "@graphql-eslint/require-selections": "error",
102
- "@graphql-eslint/scalar-leafs": "error",
103
- "@graphql-eslint/selection-set-depth": ["error", { maxDepth: 7 }],
104
- "@graphql-eslint/unique-argument-names": "error",
105
- "@graphql-eslint/unique-directive-names-per-location": "error",
106
- "@graphql-eslint/unique-fragment-name": "error",
107
- "@graphql-eslint/unique-input-field-names": "error",
108
- "@graphql-eslint/unique-operation-name": "error",
109
- "@graphql-eslint/unique-variable-names": "error",
110
- "@graphql-eslint/value-literals-of-correct-type": "error",
111
- "@graphql-eslint/variables-are-input-types": "error",
112
- "@graphql-eslint/variables-in-allowed-position": "error"
113
- }
114
- };
115
- }
116
- });
117
-
118
- // src/configs/schema-all.ts
119
- var require_schema_all = __commonJS({
120
- "src/configs/schema-all.ts"(exports, module) {
121
- "use strict";
122
- module.exports = {
123
- extends: "./configs/schema-recommended",
124
- rules: {
125
- "@graphql-eslint/alphabetize": [
126
- "error",
127
- {
128
- definitions: !0,
129
- fields: ["ObjectTypeDefinition", "InterfaceTypeDefinition", "InputObjectTypeDefinition"],
130
- values: !0,
131
- arguments: ["FieldDefinition", "Field", "DirectiveDefinition", "Directive"],
132
- groups: ["id", "*", "createdAt", "updatedAt"]
133
- }
134
- ],
135
- "@graphql-eslint/input-name": "error",
136
- "@graphql-eslint/no-root-type": ["error", { disallow: ["mutation", "subscription"] }],
137
- "@graphql-eslint/no-scalar-result-type-on-mutation": "error",
138
- "@graphql-eslint/require-deprecation-date": "error",
139
- "@graphql-eslint/require-field-of-type-query-in-mutation-result": "error",
140
- "@graphql-eslint/require-nullable-fields-with-oneof": "error",
141
- "@graphql-eslint/require-nullable-result-in-root": "error",
142
- "@graphql-eslint/require-type-pattern-with-oneof": "error"
143
- }
144
- };
145
- }
146
- });
147
-
148
- // src/configs/schema-recommended.ts
149
- var require_schema_recommended = __commonJS({
150
- "src/configs/schema-recommended.ts"(exports, module) {
151
- "use strict";
152
- module.exports = {
153
- parser: "@graphql-eslint/eslint-plugin",
154
- plugins: ["@graphql-eslint"],
155
- rules: {
156
- "@graphql-eslint/description-style": "error",
157
- "@graphql-eslint/known-argument-names": "error",
158
- "@graphql-eslint/known-directives": "error",
159
- "@graphql-eslint/known-type-names": "error",
160
- "@graphql-eslint/lone-schema-definition": "error",
161
- "@graphql-eslint/naming-convention": [
162
- "error",
163
- {
164
- types: "PascalCase",
165
- FieldDefinition: "camelCase",
166
- InputValueDefinition: "camelCase",
167
- Argument: "camelCase",
168
- DirectiveDefinition: "camelCase",
169
- EnumValueDefinition: "UPPER_CASE",
170
- "FieldDefinition[parent.name.value=Query]": {
171
- forbiddenPrefixes: ["query", "get"],
172
- forbiddenSuffixes: ["Query"]
173
- },
174
- "FieldDefinition[parent.name.value=Mutation]": {
175
- forbiddenPrefixes: ["mutation"],
176
- forbiddenSuffixes: ["Mutation"]
177
- },
178
- "FieldDefinition[parent.name.value=Subscription]": {
179
- forbiddenPrefixes: ["subscription"],
180
- forbiddenSuffixes: ["Subscription"]
181
- },
182
- "EnumTypeDefinition,EnumTypeExtension": {
183
- forbiddenPrefixes: ["Enum"],
184
- forbiddenSuffixes: ["Enum"]
185
- },
186
- "InterfaceTypeDefinition,InterfaceTypeExtension": {
187
- forbiddenPrefixes: ["Interface"],
188
- forbiddenSuffixes: ["Interface"]
189
- },
190
- "UnionTypeDefinition,UnionTypeExtension": {
191
- forbiddenPrefixes: ["Union"],
192
- forbiddenSuffixes: ["Union"]
193
- },
194
- "ObjectTypeDefinition,ObjectTypeExtension": {
195
- forbiddenPrefixes: ["Type"],
196
- forbiddenSuffixes: ["Type"]
197
- }
198
- }
199
- ],
200
- "@graphql-eslint/no-hashtag-description": "error",
201
- "@graphql-eslint/no-typename-prefix": "error",
202
- "@graphql-eslint/no-unreachable-types": "error",
203
- "@graphql-eslint/possible-type-extension": "error",
204
- "@graphql-eslint/provided-required-arguments": "error",
205
- "@graphql-eslint/require-deprecation-reason": "error",
206
- "@graphql-eslint/require-description": [
207
- "error",
208
- { types: !0, DirectiveDefinition: !0, rootField: !0 }
209
- ],
210
- "@graphql-eslint/strict-id-in-types": "error",
211
- "@graphql-eslint/unique-directive-names": "error",
212
- "@graphql-eslint/unique-directive-names-per-location": "error",
213
- "@graphql-eslint/unique-enum-value-names": "error",
214
- "@graphql-eslint/unique-field-definition-names": "error",
215
- "@graphql-eslint/unique-operation-types": "error",
216
- "@graphql-eslint/unique-type-names": "error"
217
- }
218
- };
219
- }
220
- });
221
-
222
- // src/configs/schema-relay.ts
223
- var require_schema_relay = __commonJS({
224
- "src/configs/schema-relay.ts"(exports, module) {
225
- "use strict";
226
- module.exports = {
227
- parser: "@graphql-eslint/eslint-plugin",
228
- plugins: ["@graphql-eslint"],
229
- rules: {
230
- "@graphql-eslint/relay-arguments": "error",
231
- "@graphql-eslint/relay-connection-types": "error",
232
- "@graphql-eslint/relay-edge-types": "error",
233
- "@graphql-eslint/relay-page-info": "error"
234
- }
235
- };
236
- }
237
- });
238
-
239
1
  // src/parser.ts
240
2
  import debugFactory2 from "debug";
241
3
  import { buildSchema, GraphQLError } from "graphql";
@@ -341,8 +103,8 @@ function convertLocation(location) {
341
103
  }
342
104
 
343
105
  // src/estree-converter/converter.ts
344
- function convertToESTree(node, schema15) {
345
- let typeInfo = schema15 && new TypeInfo(schema15), visitor = {
106
+ function convertToESTree(node, schema16) {
107
+ let typeInfo = schema16 && new TypeInfo(schema16), visitor = {
346
108
  leave(node2, key, parent) {
347
109
  let leadingComments = "description" in node2 && node2.description ? [
348
110
  {
@@ -399,21 +161,21 @@ import {
399
161
  // src/utils.ts
400
162
  import { Kind as Kind2 } from "graphql";
401
163
  import lowerCase from "lodash.lowercase";
402
- function requireSiblingsOperations(ruleId, context) {
164
+ function requireGraphQLOperations(ruleId, context) {
403
165
  let { siblingOperations } = context.sourceCode.parserServices;
404
166
  if (!siblingOperations.available)
405
167
  throw new Error(
406
- `Rule \`${ruleId}\` requires graphql-config \`documents\` field to be set and loaded. See https://the-guild.dev/graphql/config/docs/user/documents for more info`
168
+ `Rule \`${ruleId}\` requires graphql-config \`documents\` field to be set and loaded. See https://the-guild.dev/graphql/eslint/docs/usage#providing-operations for more info`
407
169
  );
408
170
  return siblingOperations;
409
171
  }
410
- function requireGraphQLSchemaFromContext(ruleId, context) {
411
- let { schema: schema15 } = context.sourceCode.parserServices;
412
- if (!schema15)
172
+ function requireGraphQLSchema(ruleId, context) {
173
+ let { schema: schema16 } = context.sourceCode.parserServices;
174
+ if (!schema16)
413
175
  throw new Error(
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`
176
+ `Rule \`${ruleId}\` requires graphql-config \`schema\` field to be set and loaded. See https://the-guild.dev/graphql/eslint/docs/usage#providing-schema for more info`
415
177
  );
416
- return schema15;
178
+ return schema16;
417
179
  }
418
180
  var chalk = {
419
181
  red: (str) => `\x1B[31m${str}\x1B[39m`,
@@ -427,7 +189,7 @@ var chalk = {
427
189
  // eslint-disable-next-line no-console
428
190
  console.warn(chalk.yellow("warning"), "[graphql-eslint]", ...args)
429
191
  )
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 = [
192
+ }, 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 = [
431
193
  Kind2.OBJECT_TYPE_DEFINITION,
432
194
  Kind2.INTERFACE_TYPE_DEFINITION,
433
195
  Kind2.ENUM_TYPE_DEFINITION,
@@ -521,7 +283,7 @@ var DisplayNodeNameMap = {
521
283
  [Kind2.VARIABLE]: "variable"
522
284
  };
523
285
  function displayNodeName(node) {
524
- return `${node.kind === Kind2.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
286
+ return `${node.kind === Kind2.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value || node.value}"`;
525
287
  }
526
288
  function getNodeName(node) {
527
289
  switch (node.kind) {
@@ -635,7 +397,7 @@ function parseForESLint(code, options) {
635
397
  `\`parserOptions.${key}\` was removed in graphql-eslint@4. Use physical graphql-config for setting schema and documents or \`parserOptions.graphQLConfig\` for programmatic usage.`
636
398
  );
637
399
  try {
638
- let { filePath } = options, { document } = parseGraphQLSDL(filePath, code, { noLocation: !1 }), project, schema15, documents;
400
+ let { filePath } = options, { document } = parseGraphQLSDL(filePath, code, { noLocation: !1 }), project, schema16, documents;
639
401
  documents = [
640
402
  parseGraphQLSDL(
641
403
  "operation.graphql",
@@ -644,14 +406,14 @@ function parseForESLint(code, options) {
644
406
  )
645
407
  ];
646
408
  try {
647
- schema15 = buildSchema(options.graphQLConfig.schema);
409
+ schema16 = buildSchema(options.graphQLConfig.schema);
648
410
  } catch (error) {
649
411
  throw error instanceof Error && (error.message = `Error while loading schema: ${error.message}`), error;
650
412
  }
651
- let rootTree = convertToESTree(document, schema15);
413
+ let rootTree = convertToESTree(document, schema16);
652
414
  return {
653
415
  services: {
654
- schema: schema15,
416
+ schema: schema16,
655
417
  siblingOperations: getSiblings(documents)
656
418
  },
657
419
  ast: {
@@ -1118,14 +880,14 @@ import {
1118
880
  import { validateSDL } from "graphql/validation/validate.js";
1119
881
  function validateDocument({
1120
882
  context,
1121
- schema: schema15 = null,
883
+ schema: schema16 = null,
1122
884
  documentNode,
1123
885
  rule: rule35,
1124
886
  hasDidYouMeanSuggestions
1125
887
  }) {
1126
888
  if (documentNode.definitions.length !== 0)
1127
889
  try {
1128
- let validationErrors = schema15 ? validate(schema15, documentNode, [rule35]) : validateSDL(documentNode, null, [rule35]);
890
+ let validationErrors = schema16 ? validate(schema16, documentNode, [rule35]) : validateSDL(documentNode, null, [rule35]);
1129
891
  for (let error of validationErrors) {
1130
892
  let { line, column } = error.locations[0], sourceCode = context.getSourceCode(), { tokens } = sourceCode.ast, token = tokens.find(
1131
893
  (token2) => token2.loc.start.line === line && token2.loc.start.column === column - 1
@@ -1171,7 +933,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1171
933
  }, handleMissingFragments = ({ ruleId, context, node }) => {
1172
934
  let missingFragments = getMissingFragments(node);
1173
935
  if (missingFragments.length > 0) {
1174
- let siblings = requireSiblingsOperations(ruleId, context), fragmentsToAdd = [];
936
+ let siblings = requireGraphQLOperations(ruleId, context), fragmentsToAdd = [];
1175
937
  for (let fragmentName of missingFragments) {
1176
938
  let [foundFragment] = siblings.getFragment(fragmentName).map((source) => source.document);
1177
939
  foundFragment && fragmentsToAdd.push(foundFragment);
@@ -1191,7 +953,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1191
953
  ruleId,
1192
954
  rule: rule35,
1193
955
  getDocumentNode,
1194
- schema: schema15 = [],
956
+ schema: schema16 = [],
1195
957
  hasDidYouMeanSuggestions
1196
958
  }, docs) => ({
1197
959
  [ruleId]: {
@@ -1204,16 +966,16 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1204
966
  description: `${docs.description}
1205
967
  > This rule is a wrapper around a \`graphql-js\` validation function.`
1206
968
  },
1207
- schema: schema15,
969
+ schema: schema16,
1208
970
  hasSuggestions: hasDidYouMeanSuggestions
1209
971
  },
1210
972
  create(context) {
1211
973
  return {
1212
974
  Document(node) {
1213
- let schema16 = docs.requiresSchema ? requireGraphQLSchemaFromContext(ruleId, context) : null, documentNode = getDocumentNode ? getDocumentNode({ ruleId, context, node: node.rawNode() }) : node.rawNode();
975
+ let schema17 = docs.requiresSchema ? requireGraphQLSchema(ruleId, context) : null, documentNode = getDocumentNode ? getDocumentNode({ ruleId, context, node: node.rawNode() }) : node.rawNode();
1214
976
  validateDocument({
1215
977
  context,
1216
- schema: schema16,
978
+ schema: schema17,
1217
979
  documentNode,
1218
980
  rule: rule35,
1219
981
  hasDidYouMeanSuggestions
@@ -1454,7 +1216,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1454
1216
  ruleId: "no-unused-fragments",
1455
1217
  rule: NoUnusedFragmentsRule,
1456
1218
  getDocumentNode: ({ ruleId, context, node }) => {
1457
- let siblings = requireSiblingsOperations(ruleId, context), FilePathToDocumentsMap = [
1219
+ let siblings = requireGraphQLOperations(ruleId, context), FilePathToDocumentsMap = [
1458
1220
  ...siblings.getOperations(),
1459
1221
  ...siblings.getFragments()
1460
1222
  ].reduce((map, { filePath, document }) => (map[filePath] ??= [], map[filePath].push(document), map), /* @__PURE__ */ Object.create(null)), getParentNode = (currentFilePath, node2) => {
@@ -2509,12 +2271,14 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
2509
2271
  };
2510
2272
  }
2511
2273
  }, checkUnderscore = (isLeading) => (node) => {
2274
+ if (node.parent.kind === "Field" && node.parent.alias !== node)
2275
+ return;
2512
2276
  let suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
2513
2277
  report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
2514
2278
  suggestedName
2515
2279
  ]);
2516
2280
  }, listeners = {};
2517
- allowLeadingUnderscore || (listeners["Name[value=/^_/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!1));
2281
+ allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
2518
2282
  let selectors = new Set(
2519
2283
  [types && TYPES_KINDS, Object.keys(restOptions)].flat().filter(truthy)
2520
2284
  );
@@ -2594,7 +2358,6 @@ var RULE_ID3 = "no-anonymous-operations", rule7 = {
2594
2358
  };
2595
2359
 
2596
2360
  // src/rules/no-deprecated/index.ts
2597
- import { Kind as Kind10 } from "graphql";
2598
2361
  var RULE_ID4 = "no-deprecated", rule8 = {
2599
2362
  meta: {
2600
2363
  type: "suggestion",
@@ -2678,24 +2441,24 @@ var RULE_ID4 = "no-deprecated", rule8 = {
2678
2441
  recommended: !0
2679
2442
  },
2680
2443
  messages: {
2681
- [RULE_ID4]: "This {{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
2444
+ [RULE_ID4]: "{{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
2682
2445
  },
2683
2446
  schema: []
2684
2447
  },
2685
2448
  create(context) {
2686
- requireGraphQLSchemaFromContext(RULE_ID4, context);
2449
+ requireGraphQLSchema(RULE_ID4, context);
2687
2450
  function report(node, reason) {
2688
- let nodeName = node.kind === Kind10.ENUM ? node.value : node.name.value, nodeType = node.kind === Kind10.ENUM ? "enum value" : "field";
2451
+ let nodeType = displayNodeName(node);
2689
2452
  context.report({
2690
2453
  node,
2691
2454
  messageId: RULE_ID4,
2692
2455
  data: {
2693
- type: nodeType,
2456
+ type: nodeType[0].toUpperCase() + nodeType.slice(1),
2694
2457
  reason
2695
2458
  },
2696
2459
  suggest: [
2697
2460
  {
2698
- desc: `Remove \`${nodeName}\` ${nodeType}`,
2461
+ desc: `Remove ${nodeType}`,
2699
2462
  fix: (fixer) => fixer.remove(node)
2700
2463
  }
2701
2464
  ]
@@ -2709,13 +2472,27 @@ var RULE_ID4 = "no-deprecated", rule8 = {
2709
2472
  Field(node) {
2710
2473
  let reason = node.typeInfo().fieldDef?.deprecationReason;
2711
2474
  reason && report(node, reason);
2475
+ },
2476
+ Argument(node) {
2477
+ let reason = node.typeInfo().argument?.deprecationReason;
2478
+ reason && report(node, reason);
2479
+ },
2480
+ ObjectValue(node) {
2481
+ let { inputType } = node.typeInfo();
2482
+ if (inputType && "getFields" in inputType) {
2483
+ let fields = inputType.getFields();
2484
+ for (let field of node.fields) {
2485
+ let fieldName = field.name.value, reason = fields[fieldName].deprecationReason;
2486
+ reason && report(field, reason);
2487
+ }
2488
+ }
2712
2489
  }
2713
2490
  };
2714
2491
  }
2715
2492
  };
2716
2493
 
2717
2494
  // src/rules/no-duplicate-fields/index.ts
2718
- import { Kind as Kind11 } from "graphql";
2495
+ import { Kind as Kind10 } from "graphql";
2719
2496
  var RULE_ID5 = "no-duplicate-fields", rule9 = {
2720
2497
  meta: {
2721
2498
  type: "suggestion",
@@ -2799,7 +2576,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
2799
2576
  desc: `Remove \`${fieldName}\` ${parent.type.toLowerCase()}`,
2800
2577
  fix(fixer) {
2801
2578
  return fixer.remove(
2802
- parent.type === Kind11.VARIABLE ? parent.parent : parent
2579
+ parent.type === Kind10.VARIABLE ? parent.parent : parent
2803
2580
  );
2804
2581
  }
2805
2582
  }
@@ -2822,7 +2599,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
2822
2599
  SelectionSet(node) {
2823
2600
  let set = /* @__PURE__ */ new Set();
2824
2601
  for (let selection of node.selections)
2825
- selection.kind === Kind11.FIELD && checkNode2(set, selection.alias || selection.name);
2602
+ selection.kind === Kind10.FIELD && checkNode2(set, selection.alias || selection.name);
2826
2603
  }
2827
2604
  };
2828
2605
  }
@@ -2988,7 +2765,7 @@ var RULE_ID7 = "no-one-place-fragments", rule11 = {
2988
2765
  schema: []
2989
2766
  },
2990
2767
  create(context) {
2991
- let operations = requireSiblingsOperations(RULE_ID7, context), allDocuments = [...operations.getOperations(), ...operations.getFragments()], usedFragmentsMap = /* @__PURE__ */ Object.create(null);
2768
+ let operations = requireGraphQLOperations(RULE_ID7, context), allDocuments = [...operations.getOperations(), ...operations.getFragments()], usedFragmentsMap = /* @__PURE__ */ Object.create(null);
2992
2769
  for (let { document, filePath } of allDocuments) {
2993
2770
  let relativeFilePath = relative(CWD, filePath);
2994
2771
  visit4(document, {
@@ -3069,9 +2846,9 @@ var schema7 = {
3069
2846
  schema: schema7
3070
2847
  },
3071
2848
  create(context) {
3072
- let schema15 = requireGraphQLSchemaFromContext("no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
3073
- disallow.has("mutation") && schema15.getMutationType(),
3074
- disallow.has("subscription") && schema15.getSubscriptionType()
2849
+ let schema16 = requireGraphQLSchema("no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
2850
+ disallow.has("mutation") && schema16.getMutationType(),
2851
+ disallow.has("subscription") && schema16.getSubscriptionType()
3075
2852
  ].filter(truthy).map((type) => type.name).join("|");
3076
2853
  return rootTypeNames ? {
3077
2854
  [`:matches(ObjectTypeDefinition, ObjectTypeExtension) > .name[value=/^(${rootTypeNames})$/]`](node) {
@@ -3092,7 +2869,7 @@ var schema7 = {
3092
2869
  };
3093
2870
 
3094
2871
  // src/rules/no-scalar-result-type-on-mutation/index.ts
3095
- import { isScalarType, Kind as Kind12 } from "graphql";
2872
+ import { isScalarType, Kind as Kind11 } from "graphql";
3096
2873
  var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3097
2874
  meta: {
3098
2875
  type: "suggestion",
@@ -3130,16 +2907,16 @@ var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3130
2907
  schema: []
3131
2908
  },
3132
2909
  create(context) {
3133
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID8, context), mutationType = schema15.getMutationType();
2910
+ let schema16 = requireGraphQLSchema(RULE_ID8, context), mutationType = schema16.getMutationType();
3134
2911
  return mutationType ? {
3135
2912
  [[
3136
2913
  `:matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=${mutationType.name}]`,
3137
2914
  "> FieldDefinition > .gqlType Name"
3138
2915
  ].join(" ")](node) {
3139
- let typeName = node.value, graphQLType = schema15.getType(typeName);
2916
+ let typeName = node.value, graphQLType = schema16.getType(typeName);
3140
2917
  if (isScalarType(graphQLType)) {
3141
2918
  let fieldDef = node.parent;
3142
- for (; fieldDef.kind !== Kind12.FIELD_DEFINITION; )
2919
+ for (; fieldDef.kind !== Kind11.FIELD_DEFINITION; )
3143
2920
  fieldDef = fieldDef.parent;
3144
2921
  context.report({
3145
2922
  node,
@@ -3229,25 +3006,26 @@ var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
3229
3006
  // src/rules/no-unreachable-types/index.ts
3230
3007
  import {
3231
3008
  DirectiveLocation,
3009
+ getNamedType,
3232
3010
  isInterfaceType,
3233
- Kind as Kind13,
3011
+ Kind as Kind12,
3234
3012
  visit as visit5
3235
3013
  } from "graphql";
3236
3014
  import lowerCase3 from "lodash.lowercase";
3237
3015
  var RULE_ID9 = "no-unreachable-types", KINDS = [
3238
- Kind13.DIRECTIVE_DEFINITION,
3239
- Kind13.OBJECT_TYPE_DEFINITION,
3240
- Kind13.OBJECT_TYPE_EXTENSION,
3241
- Kind13.INTERFACE_TYPE_DEFINITION,
3242
- Kind13.INTERFACE_TYPE_EXTENSION,
3243
- Kind13.SCALAR_TYPE_DEFINITION,
3244
- Kind13.SCALAR_TYPE_EXTENSION,
3245
- Kind13.INPUT_OBJECT_TYPE_DEFINITION,
3246
- Kind13.INPUT_OBJECT_TYPE_EXTENSION,
3247
- Kind13.UNION_TYPE_DEFINITION,
3248
- Kind13.UNION_TYPE_EXTENSION,
3249
- Kind13.ENUM_TYPE_DEFINITION,
3250
- Kind13.ENUM_TYPE_EXTENSION
3016
+ Kind12.DIRECTIVE_DEFINITION,
3017
+ Kind12.OBJECT_TYPE_DEFINITION,
3018
+ Kind12.OBJECT_TYPE_EXTENSION,
3019
+ Kind12.INTERFACE_TYPE_DEFINITION,
3020
+ Kind12.INTERFACE_TYPE_EXTENSION,
3021
+ Kind12.SCALAR_TYPE_DEFINITION,
3022
+ Kind12.SCALAR_TYPE_EXTENSION,
3023
+ Kind12.INPUT_OBJECT_TYPE_DEFINITION,
3024
+ Kind12.INPUT_OBJECT_TYPE_EXTENSION,
3025
+ Kind12.UNION_TYPE_DEFINITION,
3026
+ Kind12.UNION_TYPE_EXTENSION,
3027
+ Kind12.ENUM_TYPE_DEFINITION,
3028
+ Kind12.ENUM_TYPE_EXTENSION
3251
3029
  ], reachableTypesCache = new ModuleCache(), RequestDirectiveLocations = /* @__PURE__ */ new Set([
3252
3030
  DirectiveLocation.QUERY,
3253
3031
  DirectiveLocation.MUTATION,
@@ -3258,8 +3036,8 @@ var RULE_ID9 = "no-unreachable-types", KINDS = [
3258
3036
  DirectiveLocation.INLINE_FRAGMENT,
3259
3037
  DirectiveLocation.VARIABLE_DEFINITION
3260
3038
  ]);
3261
- function getReachableTypes(schema15) {
3262
- let cachedValue = reachableTypesCache.get(schema15);
3039
+ function getReachableTypes(schema16) {
3040
+ let cachedValue = reachableTypesCache.get(schema16);
3263
3041
  if (cachedValue)
3264
3042
  return cachedValue;
3265
3043
  let reachableTypes = /* @__PURE__ */ new Set(), collect = (node) => {
@@ -3267,9 +3045,9 @@ function getReachableTypes(schema15) {
3267
3045
  if (reachableTypes.has(typeName))
3268
3046
  return;
3269
3047
  reachableTypes.add(typeName);
3270
- let type = schema15.getType(typeName) || schema15.getDirective(typeName);
3048
+ let type = schema16.getType(typeName) || schema16.getDirective(typeName);
3271
3049
  if (isInterfaceType(type)) {
3272
- let { objects, interfaces } = schema15.getImplementations(type);
3050
+ let { objects, interfaces } = schema16.getImplementations(type);
3273
3051
  for (let { astNode } of [...objects, ...interfaces])
3274
3052
  visit5(astNode, visitor);
3275
3053
  } else type?.astNode && visit5(type.astNode, visitor);
@@ -3283,22 +3061,20 @@ function getReachableTypes(schema15) {
3283
3061
  NamedType: collect
3284
3062
  };
3285
3063
  for (let type of [
3286
- schema15,
3064
+ schema16,
3287
3065
  // visiting SchemaDefinition node
3288
- schema15.getQueryType(),
3289
- schema15.getMutationType(),
3290
- schema15.getSubscriptionType()
3066
+ schema16.getQueryType(),
3067
+ schema16.getMutationType(),
3068
+ schema16.getSubscriptionType()
3291
3069
  ])
3292
3070
  type?.astNode && visit5(type.astNode, visitor);
3293
- for (let node of schema15.getDirectives())
3071
+ for (let node of schema16.getDirectives())
3294
3072
  if (node.locations.some((location) => RequestDirectiveLocations.has(location))) {
3295
3073
  reachableTypes.add(node.name);
3296
- for (let arg of node.args) {
3297
- let argTypeName = "name" in arg.type && arg.type.name;
3298
- argTypeName && reachableTypes.add(argTypeName);
3299
- }
3074
+ for (let arg of node.args)
3075
+ reachableTypes.add(getNamedType(arg.type).name);
3300
3076
  }
3301
- return reachableTypesCache.set(schema15, reachableTypes), reachableTypes;
3077
+ return reachableTypesCache.set(schema16, reachableTypes), reachableTypes;
3302
3078
  }
3303
3079
  var rule15 = {
3304
3080
  meta: {
@@ -3351,7 +3127,7 @@ var rule15 = {
3351
3127
  hasSuggestions: !0
3352
3128
  },
3353
3129
  create(context) {
3354
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID9, context), reachableTypes = getReachableTypes(schema15);
3130
+ let schema16 = requireGraphQLSchema(RULE_ID9, context), reachableTypes = getReachableTypes(schema16);
3355
3131
  return {
3356
3132
  [`:matches(${KINDS}) > .name`](node) {
3357
3133
  let typeName = node.value;
@@ -3379,12 +3155,105 @@ var rule15 = {
3379
3155
 
3380
3156
  // src/rules/no-unused-fields/index.ts
3381
3157
  import { TypeInfo as TypeInfo2, visit as visit6, visitWithTypeInfo as visitWithTypeInfo2 } from "graphql";
3382
- var RULE_ID10 = "no-unused-fields", usedFieldsCache = new ModuleCache();
3383
- function getUsedFields(schema15, operations) {
3384
- let cachedValue = usedFieldsCache.get(schema15);
3158
+ var RULE_ID10 = "no-unused-fields", RELAY_SCHEMA = (
3159
+ /* GraphQL */
3160
+ `
3161
+ # Root Query Type
3162
+ type Query {
3163
+ user: User
3164
+ }
3165
+
3166
+ # User Type
3167
+ type User {
3168
+ id: ID!
3169
+ name: String!
3170
+ friends(first: Int, after: String): FriendConnection!
3171
+ }
3172
+
3173
+ # FriendConnection Type (Relay Connection)
3174
+ type FriendConnection {
3175
+ edges: [FriendEdge]
3176
+ pageInfo: PageInfo!
3177
+ }
3178
+
3179
+ # FriendEdge Type
3180
+ type FriendEdge {
3181
+ cursor: String!
3182
+ node: Friend!
3183
+ }
3184
+
3185
+ # Friend Type
3186
+ type Friend {
3187
+ id: ID!
3188
+ name: String!
3189
+ }
3190
+
3191
+ # PageInfo Type (Relay Pagination)
3192
+ type PageInfo {
3193
+ hasPreviousPage: Boolean!
3194
+ hasNextPage: Boolean!
3195
+ startCursor: String
3196
+ endCursor: String
3197
+ }
3198
+ `
3199
+ ), RELAY_QUERY = (
3200
+ /* GraphQL */
3201
+ `
3202
+ query {
3203
+ user {
3204
+ id
3205
+ name
3206
+ friends(first: 10) {
3207
+ edges {
3208
+ node {
3209
+ id
3210
+ name
3211
+ }
3212
+ }
3213
+ }
3214
+ }
3215
+ }
3216
+ `
3217
+ ), RELAY_DEFAULT_IGNORED_FIELD_SELECTORS = [
3218
+ "[parent.name.value=PageInfo][name.value=/(endCursor|startCursor|hasNextPage|hasPreviousPage)/]",
3219
+ "[parent.name.value=/Edge$/][name.value=cursor]",
3220
+ "[parent.name.value=/Connection$/][name.value=pageInfo]"
3221
+ ], schema8 = {
3222
+ type: "array",
3223
+ maxItems: 1,
3224
+ items: {
3225
+ type: "object",
3226
+ additionalProperties: !1,
3227
+ properties: {
3228
+ ignoredFieldSelectors: {
3229
+ type: "array",
3230
+ uniqueItems: !0,
3231
+ minItems: 1,
3232
+ description: [
3233
+ "Fields that will be ignored and are allowed to be unused.",
3234
+ "",
3235
+ "E.g. The following selector will ignore all the relay pagination fields for every connection exposed in the schema:",
3236
+ "```json",
3237
+ JSON.stringify(RELAY_DEFAULT_IGNORED_FIELD_SELECTORS, null, 2),
3238
+ "```",
3239
+ "",
3240
+ "> These fields are defined by ESLint [`selectors`](https://eslint.org/docs/developer-guide/selectors).",
3241
+ "> Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector."
3242
+ ].join(`
3243
+ `),
3244
+ items: {
3245
+ type: "string",
3246
+ pattern: "^\\[(.+)]$"
3247
+ }
3248
+ }
3249
+ }
3250
+ }
3251
+ }, usedFieldsCache = new ModuleCache();
3252
+ function getUsedFields(schema16, operations) {
3253
+ let cachedValue = usedFieldsCache.get(schema16);
3385
3254
  if (cachedValue)
3386
3255
  return cachedValue;
3387
- let usedFields = /* @__PURE__ */ Object.create(null), typeInfo = new TypeInfo2(schema15), visitor = visitWithTypeInfo2(typeInfo, {
3256
+ let usedFields = /* @__PURE__ */ Object.create(null), typeInfo = new TypeInfo2(schema16), visitor = visitWithTypeInfo2(typeInfo, {
3388
3257
  Field(node) {
3389
3258
  if (!typeInfo.getFieldDef())
3390
3259
  return !1;
@@ -3394,7 +3263,7 @@ function getUsedFields(schema15, operations) {
3394
3263
  }), allDocuments = [...operations.getOperations(), ...operations.getFragments()];
3395
3264
  for (let { document } of allDocuments)
3396
3265
  visit6(document, visitor);
3397
- return usedFieldsCache.set(schema15, usedFields), usedFields;
3266
+ return usedFieldsCache.set(schema16, usedFields), usedFields;
3398
3267
  }
3399
3268
  var rule16 = {
3400
3269
  meta: {
@@ -3456,17 +3325,34 @@ var rule16 = {
3456
3325
  }
3457
3326
  `
3458
3327
  )
3328
+ },
3329
+ {
3330
+ title: "Correct (ignoring fields)",
3331
+ usage: [{ ignoredFieldSelectors: RELAY_DEFAULT_IGNORED_FIELD_SELECTORS }],
3332
+ code: (
3333
+ /* GraphQL */
3334
+ `
3335
+ ### 1\uFE0F\u20E3 YOUR SCHEMA
3336
+ ${RELAY_SCHEMA}
3337
+
3338
+ ### 2\uFE0F\u20E3 YOUR QUERY
3339
+ ${RELAY_QUERY}
3340
+ `
3341
+ )
3459
3342
  }
3460
3343
  ]
3461
3344
  },
3462
3345
  type: "suggestion",
3463
- schema: [],
3346
+ schema: schema8,
3464
3347
  hasSuggestions: !0
3465
3348
  },
3466
3349
  create(context) {
3467
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID10, context), siblingsOperations = requireSiblingsOperations(RULE_ID10, context), usedFields = getUsedFields(schema15, siblingsOperations);
3350
+ let schema16 = requireGraphQLSchema(RULE_ID10, context), siblingsOperations = requireGraphQLOperations(RULE_ID10, context), usedFields = getUsedFields(schema16, siblingsOperations), { ignoredFieldSelectors } = context.options[0] || {};
3468
3351
  return {
3469
- FieldDefinition(node) {
3352
+ [(ignoredFieldSelectors || []).reduce(
3353
+ (acc, selector2) => `${acc}:not(${selector2})`,
3354
+ "FieldDefinition"
3355
+ )](node) {
3470
3356
  let fieldName = node.name.value, parentTypeName = node.parent.name.value;
3471
3357
  usedFields[parentTypeName]?.has(fieldName) || context.report({
3472
3358
  node: node.name,
@@ -3488,8 +3374,8 @@ var rule16 = {
3488
3374
  };
3489
3375
 
3490
3376
  // src/rules/relay-arguments/index.ts
3491
- import { isScalarType as isScalarType2, Kind as Kind14 } from "graphql";
3492
- var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema8 = {
3377
+ import { isScalarType as isScalarType2, Kind as Kind13 } from "graphql";
3378
+ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema9 = {
3493
3379
  type: "array",
3494
3380
  maxItems: 1,
3495
3381
  items: {
@@ -3555,14 +3441,14 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3555
3441
  messages: {
3556
3442
  [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."
3557
3443
  },
3558
- schema: schema8
3444
+ schema: schema9
3559
3445
  },
3560
3446
  create(context) {
3561
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID11, context), { includeBoth = !0 } = context.options[0] || {};
3447
+ let schema16 = requireGraphQLSchema(RULE_ID11, context), { includeBoth = !0 } = context.options[0] || {};
3562
3448
  return {
3563
3449
  "FieldDefinition > .gqlType Name[value=/Connection$/]"(node) {
3564
3450
  let fieldNode = node.parent;
3565
- for (; fieldNode.kind !== Kind14.FIELD_DEFINITION; )
3451
+ for (; fieldNode.kind !== Kind13.FIELD_DEFINITION; )
3566
3452
  fieldNode = fieldNode.parent;
3567
3453
  let args = Object.fromEntries(
3568
3454
  fieldNode.arguments?.map((argument) => [argument.name.value, argument]) || []
@@ -3576,7 +3462,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3576
3462
  }
3577
3463
  function checkField(typeName, argumentName) {
3578
3464
  let argument = args[argumentName], hasArgument = !!argument, type = argument;
3579
- 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))))) {
3465
+ if (hasArgument && type.gqlType.kind === Kind13.NON_NULL_TYPE && (type = type.gqlType), !(hasArgument && type.gqlType.kind === Kind13.NAMED_TYPE && (type.gqlType.name.value === typeName || typeName === "String" && isScalarType2(schema16.getType(type.gqlType.name.value))))) {
3580
3466
  let returnType = typeName === "String" ? "String or Scalar" : typeName;
3581
3467
  context.report({
3582
3468
  node: (argument || fieldNode).name,
@@ -3591,17 +3477,17 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3591
3477
  };
3592
3478
 
3593
3479
  // src/rules/relay-connection-types/index.ts
3594
- import { Kind as Kind15 } from "graphql";
3480
+ import { Kind as Kind14 } from "graphql";
3595
3481
  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 = [
3596
- Kind15.SCALAR_TYPE_DEFINITION,
3597
- Kind15.UNION_TYPE_DEFINITION,
3598
- Kind15.UNION_TYPE_EXTENSION,
3599
- Kind15.INPUT_OBJECT_TYPE_DEFINITION,
3600
- Kind15.INPUT_OBJECT_TYPE_EXTENSION,
3601
- Kind15.ENUM_TYPE_DEFINITION,
3602
- Kind15.ENUM_TYPE_EXTENSION,
3603
- Kind15.INTERFACE_TYPE_DEFINITION,
3604
- Kind15.INTERFACE_TYPE_EXTENSION
3482
+ Kind14.SCALAR_TYPE_DEFINITION,
3483
+ Kind14.UNION_TYPE_DEFINITION,
3484
+ Kind14.UNION_TYPE_EXTENSION,
3485
+ Kind14.INPUT_OBJECT_TYPE_DEFINITION,
3486
+ Kind14.INPUT_OBJECT_TYPE_EXTENSION,
3487
+ Kind14.ENUM_TYPE_DEFINITION,
3488
+ Kind14.ENUM_TYPE_EXTENSION,
3489
+ Kind14.INTERFACE_TYPE_DEFINITION,
3490
+ Kind14.INTERFACE_TYPE_EXTENSION
3605
3491
  ], notConnectionTypesSelector = `:matches(${NON_OBJECT_TYPES})[name.value=/Connection$/] > .name`, hasEdgesField = (node) => node.fields?.some((field) => field.name.value === "edges"), hasPageInfoField = (node) => node.fields?.some((field) => field.name.value === "pageInfo"), rule18 = {
3606
3492
  meta: {
3607
3493
  type: "problem",
@@ -3668,10 +3554,10 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
3668
3554
  hasEdgesField(node) || context.report({ node: node.name, messageId: MUST_CONTAIN_FIELD_EDGES }), hasPageInfoField(node) || context.report({ node: node.name, messageId: MUST_CONTAIN_FIELD_PAGE_INFO });
3669
3555
  },
3670
3556
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/Connection$/] > FieldDefinition[name.value=edges] > .gqlType"(node) {
3671
- node.kind === Kind15.LIST_TYPE || node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.LIST_TYPE || context.report({ node, messageId: EDGES_FIELD_MUST_RETURN_LIST_TYPE });
3557
+ node.kind === Kind14.LIST_TYPE || node.kind === Kind14.NON_NULL_TYPE && node.gqlType.kind === Kind14.LIST_TYPE || context.report({ node, messageId: EDGES_FIELD_MUST_RETURN_LIST_TYPE });
3672
3558
  },
3673
3559
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/Connection$/] > FieldDefinition[name.value=pageInfo] > .gqlType"(node) {
3674
- node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.NAMED_TYPE && node.gqlType.name.value === "PageInfo" || context.report({ node, messageId: PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE });
3560
+ node.kind === Kind14.NON_NULL_TYPE && node.gqlType.kind === Kind14.NAMED_TYPE && node.gqlType.name.value === "PageInfo" || context.report({ node, messageId: PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE });
3675
3561
  }
3676
3562
  };
3677
3563
  }
@@ -3681,12 +3567,12 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
3681
3567
  import {
3682
3568
  isObjectType as isObjectType2,
3683
3569
  isScalarType as isScalarType3,
3684
- Kind as Kind16,
3570
+ Kind as Kind15,
3685
3571
  visit as visit7
3686
3572
  } from "graphql";
3687
3573
  import { getDocumentNodeFromSchema } from "@graphql-tools/utils";
3688
3574
  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;
3689
- function getEdgeTypes(schema15) {
3575
+ function getEdgeTypes(schema16) {
3690
3576
  if (edgeTypesCache)
3691
3577
  return edgeTypesCache;
3692
3578
  let edgeTypes = /* @__PURE__ */ new Set(), visitor = {
@@ -3695,14 +3581,14 @@ function getEdgeTypes(schema15) {
3695
3581
  return;
3696
3582
  let edges = node.fields?.find((field) => field.name.value === "edges");
3697
3583
  if (edges) {
3698
- let edgesTypeName = getTypeName(edges), edgesType = schema15.getType(edgesTypeName);
3584
+ let edgesTypeName = getTypeName(edges), edgesType = schema16.getType(edgesTypeName);
3699
3585
  isObjectType2(edgesType) && edgeTypes.add(edgesTypeName);
3700
3586
  }
3701
3587
  }
3702
- }, astNode = getDocumentNodeFromSchema(schema15);
3588
+ }, astNode = getDocumentNodeFromSchema(schema16);
3703
3589
  return visit7(astNode, visitor), edgeTypesCache = edgeTypes, edgeTypesCache;
3704
3590
  }
3705
- var schema9 = {
3591
+ var schema10 = {
3706
3592
  type: "array",
3707
3593
  maxItems: 1,
3708
3594
  items: {
@@ -3768,15 +3654,15 @@ var schema9 = {
3768
3654
  [MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE]: "A list type should only wrap an edge type.",
3769
3655
  [MESSAGE_SHOULD_IMPLEMENTS_NODE]: "Edge type's field `node` must implement `Node` interface."
3770
3656
  },
3771
- schema: schema9
3657
+ schema: schema10
3772
3658
  },
3773
3659
  create(context) {
3774
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID12, context), edgeTypes = getEdgeTypes(schema15), options = {
3660
+ let schema16 = requireGraphQLSchema(RULE_ID12, context), edgeTypes = getEdgeTypes(schema16), options = {
3775
3661
  withEdgeSuffix: !0,
3776
3662
  shouldImplementNode: !0,
3777
3663
  listTypeCanWrapOnlyEdgeType: !0,
3778
3664
  ...context.options[0]
3779
- }, isNamedOrNonNullNamed = (node) => node.kind === Kind16.NAMED_TYPE || node.kind === Kind16.NON_NULL_TYPE && node.gqlType.kind === Kind16.NAMED_TYPE, checkNodeField = (node) => {
3665
+ }, isNamedOrNonNullNamed = (node) => node.kind === Kind15.NAMED_TYPE || node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.NAMED_TYPE, checkNodeField = (node) => {
3780
3666
  let nodeField = node.fields?.find((field) => field.name.value === "node"), message = "return either a Scalar, Enum, Object, Interface, Union, or a non-null wrapper around one of those types.";
3781
3667
  if (!nodeField)
3782
3668
  context.report({
@@ -3786,7 +3672,7 @@ var schema9 = {
3786
3672
  else if (!isNamedOrNonNullNamed(nodeField.gqlType))
3787
3673
  context.report({ node: nodeField.name, message: `Field \`node\` must ${message}` });
3788
3674
  else if (options.shouldImplementNode) {
3789
- let nodeReturnTypeName = getTypeName(nodeField.gqlType.rawNode()), type = schema15.getType(nodeReturnTypeName);
3675
+ let nodeReturnTypeName = getTypeName(nodeField.gqlType.rawNode()), type = schema16.getType(nodeReturnTypeName);
3790
3676
  if (!isObjectType2(type))
3791
3677
  return;
3792
3678
  type.astNode.interfaces?.some((n) => n.name.value === "Node") || context.report({ node: node.name, messageId: MESSAGE_SHOULD_IMPLEMENTS_NODE });
@@ -3801,10 +3687,10 @@ var schema9 = {
3801
3687
  return;
3802
3688
  }
3803
3689
  let typeName = getTypeName(cursorField.rawNode());
3804
- (!isNamedOrNonNullNamed(cursorField.gqlType) || typeName !== "String" && !isScalarType3(schema15.getType(typeName))) && context.report({ node: cursorField.name, message: `Field \`cursor\` must ${message}` });
3690
+ (!isNamedOrNonNullNamed(cursorField.gqlType) || typeName !== "String" && !isScalarType3(schema16.getType(typeName))) && context.report({ node: cursorField.name, message: `Field \`cursor\` must ${message}` });
3805
3691
  }, listeners = {
3806
3692
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/Connection$/] > FieldDefinition[name.value=edges] > .gqlType Name"(node) {
3807
- let type = schema15.getType(node.value);
3693
+ let type = schema16.getType(node.value);
3808
3694
  isObjectType2(type) || context.report({ node, messageId: MESSAGE_MUST_BE_OBJECT_TYPE });
3809
3695
  },
3810
3696
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)"(node) {
@@ -3813,7 +3699,7 @@ var schema9 = {
3813
3699
  }
3814
3700
  };
3815
3701
  return options.listTypeCanWrapOnlyEdgeType && (listeners["FieldDefinition > .gqlType"] = (node) => {
3816
- if (node.kind === Kind16.LIST_TYPE || node.kind === Kind16.NON_NULL_TYPE && node.gqlType.kind === Kind16.LIST_TYPE) {
3702
+ if (node.kind === Kind15.LIST_TYPE || node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.LIST_TYPE) {
3817
3703
  let typeName = getTypeName(node.rawNode());
3818
3704
  edgeTypes.has(typeName) || context.report({ node, messageId: MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE });
3819
3705
  }
@@ -3822,7 +3708,7 @@ var schema9 = {
3822
3708
  };
3823
3709
 
3824
3710
  // src/rules/relay-page-info/index.ts
3825
- import { isScalarType as isScalarType4, Kind as Kind17 } from "graphql";
3711
+ import { isScalarType as isScalarType4, Kind as Kind16 } from "graphql";
3826
3712
  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 = {
3827
3713
  meta: {
3828
3714
  type: "problem",
@@ -3863,8 +3749,8 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3863
3749
  schema: []
3864
3750
  },
3865
3751
  create(context) {
3866
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID13, context);
3867
- return hasPageInfoChecked || (schema15.getType("PageInfo") || context.report({
3752
+ let schema16 = requireGraphQLSchema(RULE_ID13, context);
3753
+ return hasPageInfoChecked || (schema16.getType("PageInfo") || context.report({
3868
3754
  loc: REPORT_ON_FIRST_CHARACTER,
3869
3755
  messageId: MESSAGE_MUST_EXIST
3870
3756
  }), hasPageInfoChecked = !0), {
@@ -3878,7 +3764,7 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3878
3764
  let field = fieldMap[fieldName], isAllowedType = !1;
3879
3765
  if (field) {
3880
3766
  let type = field.gqlType;
3881
- 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)));
3767
+ typeName === "Boolean" ? isAllowedType = type.kind === Kind16.NON_NULL_TYPE && type.gqlType.kind === Kind16.NAMED_TYPE && type.gqlType.name.value === "Boolean" : type.kind === Kind16.NAMED_TYPE && (isAllowedType = type.name.value === "String" || isScalarType4(schema16.getType(type.name.value)));
3882
3768
  }
3883
3769
  if (!isAllowedType) {
3884
3770
  let returnType = typeName === "Boolean" ? "non-null Boolean" : "either String or Scalar, which can be null if there are no results";
@@ -3895,7 +3781,7 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3895
3781
  };
3896
3782
 
3897
3783
  // src/rules/require-deprecation-date/index.ts
3898
- 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 = {
3784
+ 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 = {
3899
3785
  type: "array",
3900
3786
  maxItems: 1,
3901
3787
  items: {
@@ -3961,7 +3847,7 @@ var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIR
3961
3847
  [MESSAGE_INVALID_DATE]: 'Invalid "{{ deletionDate }}" deletion date for {{ nodeName }}',
3962
3848
  [MESSAGE_CAN_BE_REMOVED]: "{{ nodeName }} \u0441an be removed"
3963
3849
  },
3964
- schema: schema10
3850
+ schema: schema11
3965
3851
  },
3966
3852
  create(context) {
3967
3853
  return {
@@ -4082,16 +3968,16 @@ var rule22 = {
4082
3968
  };
4083
3969
 
4084
3970
  // src/rules/require-description/index.ts
4085
- import { Kind as Kind18, TokenKind as TokenKind3 } from "graphql";
3971
+ import { Kind as Kind17, TokenKind as TokenKind3 } from "graphql";
4086
3972
  import { getRootTypeNames } from "@graphql-tools/utils";
4087
3973
  var RULE_ID14 = "require-description", ALLOWED_KINDS2 = [
4088
3974
  ...TYPES_KINDS,
4089
- Kind18.DIRECTIVE_DEFINITION,
4090
- Kind18.FIELD_DEFINITION,
4091
- Kind18.INPUT_VALUE_DEFINITION,
4092
- Kind18.ENUM_VALUE_DEFINITION,
4093
- Kind18.OPERATION_DEFINITION
4094
- ], schema11 = {
3975
+ Kind17.DIRECTIVE_DEFINITION,
3976
+ Kind17.FIELD_DEFINITION,
3977
+ Kind17.INPUT_VALUE_DEFINITION,
3978
+ Kind17.ENUM_VALUE_DEFINITION,
3979
+ Kind17.OPERATION_DEFINITION
3980
+ ], schema12 = {
4095
3981
  type: "array",
4096
3982
  minItems: 1,
4097
3983
  maxItems: 1,
@@ -4113,7 +3999,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4113
3999
  ...Object.fromEntries(
4114
4000
  [...ALLOWED_KINDS2].sort().map((kind) => {
4115
4001
  let description = `Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#${kind}).`;
4116
- return kind === Kind18.OPERATION_DEFINITION && (description += '\n> You must use only comment syntax `#` and not description syntax `"""` or `"`.'), [kind, { type: "boolean", description }];
4002
+ return kind === Kind17.OPERATION_DEFINITION && (description += '\n> You must use only comment syntax `#` and not description syntax `"""` or `"`.'), [kind, { type: "boolean", description }];
4117
4003
  })
4118
4004
  )
4119
4005
  }
@@ -4189,7 +4075,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4189
4075
  configOptions: [
4190
4076
  {
4191
4077
  types: !0,
4192
- [Kind18.DIRECTIVE_DEFINITION]: !0,
4078
+ [Kind17.DIRECTIVE_DEFINITION]: !0,
4193
4079
  rootField: !0
4194
4080
  }
4195
4081
  ],
@@ -4199,14 +4085,14 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4199
4085
  messages: {
4200
4086
  [RULE_ID14]: "Description is required for {{ nodeName }}"
4201
4087
  },
4202
- schema: schema11
4088
+ schema: schema12
4203
4089
  },
4204
4090
  create(context) {
4205
4091
  let { types, rootField, ...restOptions } = context.options[0] || {}, kinds = new Set(types ? TYPES_KINDS : []);
4206
4092
  for (let [kind, isEnabled] of Object.entries(restOptions))
4207
4093
  isEnabled ? kinds.add(kind) : kinds.delete(kind);
4208
4094
  if (rootField) {
4209
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID14, context), rootTypeNames = getRootTypeNames(schema15);
4095
+ let schema16 = requireGraphQLSchema(RULE_ID14, context), rootTypeNames = getRootTypeNames(schema16);
4210
4096
  kinds.add(
4211
4097
  `:matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/^(${[
4212
4098
  ...rootTypeNames
@@ -4215,7 +4101,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4215
4101
  }
4216
4102
  return {
4217
4103
  [[...kinds].join(",")](node) {
4218
- let description = "", isOperation = node.kind === Kind18.OPERATION_DEFINITION;
4104
+ let description = "", isOperation = node.kind === Kind17.OPERATION_DEFINITION;
4219
4105
  if (isOperation) {
4220
4106
  let rawNode = node.rawNode(), { prev, line } = rawNode.loc.startToken;
4221
4107
  if (prev?.kind === TokenKind3.COMMENT) {
@@ -4285,10 +4171,10 @@ var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
4285
4171
  schema: []
4286
4172
  },
4287
4173
  create(context) {
4288
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID15, context), mutationType = schema15.getMutationType(), queryType = schema15.getQueryType();
4174
+ let schema16 = requireGraphQLSchema(RULE_ID15, context), mutationType = schema16.getMutationType(), queryType = schema16.getQueryType();
4289
4175
  return !mutationType || !queryType ? {} : {
4290
4176
  [`:matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=${mutationType.name}] > FieldDefinition > .gqlType Name`](node) {
4291
- let typeName = node.value, graphQLType = schema15.getType(typeName);
4177
+ let typeName = node.value, graphQLType = schema16.getType(typeName);
4292
4178
  if (isObjectType3(graphQLType)) {
4293
4179
  let { fields } = graphQLType.astNode;
4294
4180
  fields?.some((field) => getTypeName(field) === queryType.name) || context.report({
@@ -4377,7 +4263,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4377
4263
  schema: []
4378
4264
  },
4379
4265
  create(context) {
4380
- let comments = context.getSourceCode().getAllComments(), siblings = requireSiblingsOperations(RULE_ID16, context), filePath = context.filename;
4266
+ let comments = context.getSourceCode().getAllComments(), siblings = requireGraphQLOperations(RULE_ID16, context), filePath = context.filename;
4381
4267
  return {
4382
4268
  "FragmentSpread > .name"(node) {
4383
4269
  let fragmentName = node.value, fragmentsFromSiblings = siblings.getFragment(fragmentName);
@@ -4387,7 +4273,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4387
4273
  ).test(comment.value)) continue;
4388
4274
  let extractedImportPath = comment.value.match(/(["'])((?:\1|.)*?)\1/)?.[2];
4389
4275
  if (!extractedImportPath) continue;
4390
- let importPath = path.join(path.dirname(filePath), extractedImportPath);
4276
+ let importPath = path.join(filePath, "..", extractedImportPath);
4391
4277
  if (fragmentsFromSiblings.some(
4392
4278
  (source) => source.filePath === importPath
4393
4279
  )) return;
@@ -4395,7 +4281,12 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4395
4281
  if (fragmentsFromSiblings.some(
4396
4282
  (source) => source.filePath === filePath
4397
4283
  )) return;
4398
- let suggestedFilePaths = fragmentsFromSiblings.length ? fragmentsFromSiblings.map((o) => path.relative(path.dirname(filePath), o.filePath)) : ["CHANGE_ME.graphql"];
4284
+ let suggestedFilePaths = fragmentsFromSiblings.length ? fragmentsFromSiblings.map(
4285
+ (o) => (
4286
+ // Use always forward slash for suggested import path
4287
+ slash(path.relative(path.dirname(filePath), o.filePath))
4288
+ )
4289
+ ) : ["CHANGE_ME.graphql"];
4399
4290
  context.report({
4400
4291
  node,
4401
4292
  messageId: RULE_ID16,
@@ -4416,7 +4307,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4416
4307
  };
4417
4308
 
4418
4309
  // src/rules/require-nullable-fields-with-oneof/index.ts
4419
- import { Kind as Kind19 } from "graphql";
4310
+ import { Kind as Kind18 } from "graphql";
4420
4311
  var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4421
4312
  meta: {
4422
4313
  type: "suggestion",
@@ -4460,11 +4351,11 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4460
4351
  return {
4461
4352
  "Directive[name.value=oneOf]"({ parent }) {
4462
4353
  if ([
4463
- Kind19.OBJECT_TYPE_DEFINITION,
4464
- Kind19.INPUT_OBJECT_TYPE_DEFINITION
4354
+ Kind18.OBJECT_TYPE_DEFINITION,
4355
+ Kind18.INPUT_OBJECT_TYPE_DEFINITION
4465
4356
  ].includes(parent.kind))
4466
4357
  for (let field of parent.fields || [])
4467
- field.gqlType.kind === Kind19.NON_NULL_TYPE && context.report({
4358
+ field.gqlType.kind === Kind18.NON_NULL_TYPE && context.report({
4468
4359
  node: field.name,
4469
4360
  messageId: RULE_ID17,
4470
4361
  data: { nodeName: getNodeName(field) }
@@ -4475,7 +4366,7 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4475
4366
  };
4476
4367
 
4477
4368
  // src/rules/require-nullable-result-in-root/index.ts
4478
- import { Kind as Kind20 } from "graphql";
4369
+ import { Kind as Kind19 } from "graphql";
4479
4370
  var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4480
4371
  meta: {
4481
4372
  type: "suggestion",
@@ -4518,16 +4409,16 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4518
4409
  schema: []
4519
4410
  },
4520
4411
  create(context) {
4521
- let schema15 = requireGraphQLSchemaFromContext(RULE_ID18, context), rootTypeNames = new Set(
4522
- [schema15.getQueryType(), schema15.getMutationType()].filter(truthy).map((type) => type.name)
4412
+ let schema16 = requireGraphQLSchema(RULE_ID18, context), rootTypeNames = new Set(
4413
+ [schema16.getQueryType(), schema16.getMutationType()].filter(truthy).map((type) => type.name)
4523
4414
  ), sourceCode = context.getSourceCode();
4524
4415
  return {
4525
4416
  "ObjectTypeDefinition,ObjectTypeExtension"(node) {
4526
4417
  if (rootTypeNames.has(node.name.value))
4527
4418
  for (let field of node.fields || []) {
4528
- if (field.gqlType.type !== Kind20.NON_NULL_TYPE || field.gqlType.gqlType.type !== Kind20.NAMED_TYPE)
4419
+ if (field.gqlType.type !== Kind19.NON_NULL_TYPE || field.gqlType.gqlType.type !== Kind19.NAMED_TYPE)
4529
4420
  continue;
4530
- let name = field.gqlType.gqlType.name.value, type = schema15.getType(name), resultType = type?.astNode ? getNodeName(type.astNode) : type?.name;
4421
+ let name = field.gqlType.gqlType.name.value, type = schema16.getType(name), resultType = type?.astNode ? getNodeName(type.astNode) : type?.name;
4531
4422
  context.report({
4532
4423
  node: field.gqlType,
4533
4424
  messageId: RULE_ID18,
@@ -4556,13 +4447,13 @@ import {
4556
4447
  GraphQLInterfaceType,
4557
4448
  GraphQLObjectType,
4558
4449
  GraphQLUnionType,
4559
- Kind as Kind21,
4450
+ Kind as Kind20,
4560
4451
  TypeInfo as TypeInfo3,
4561
4452
  visit as visit8,
4562
4453
  visitWithTypeInfo as visitWithTypeInfo3
4563
4454
  } from "graphql";
4564
4455
  import { asArray } from "@graphql-tools/utils";
4565
- var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema12 = {
4456
+ var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema13 = {
4566
4457
  definitions: {
4567
4458
  asString: {
4568
4459
  type: "string"
@@ -4641,19 +4532,20 @@ var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema12 = {
4641
4532
  )
4642
4533
  }
4643
4534
  ],
4644
- recommended: !0
4535
+ recommended: !0,
4536
+ whenNotToUseIt: "Relay Compiler automatically adds an `id` field to any type that has an `id` field, even if it hasn't been explicitly requested. Requesting a field that is not used directly in the code can conflict with another Relay rule: `relay/unused-fields`."
4645
4537
  },
4646
4538
  messages: {
4647
4539
  [RULE_ID19]: `Field{{ pluralSuffix }} {{ fieldName }} must be selected when it's available on a type.
4648
4540
  Include it in your selection set{{ addition }}.`
4649
4541
  },
4650
- schema: schema12
4542
+ schema: schema13
4651
4543
  },
4652
4544
  create(context) {
4653
- 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);
4545
+ let schema16 = requireGraphQLSchema(RULE_ID19, context), siblings = requireGraphQLOperations(RULE_ID19, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo3(schema16);
4654
4546
  function checkFragments(node) {
4655
4547
  for (let selection of node.selections) {
4656
- if (selection.kind !== Kind21.FRAGMENT_SPREAD)
4548
+ if (selection.kind !== Kind20.FRAGMENT_SPREAD)
4657
4549
  continue;
4658
4550
  let [foundSpread] = siblings.getFragment(selection.name.value);
4659
4551
  if (!foundSpread)
@@ -4661,7 +4553,7 @@ Include it in your selection set{{ addition }}.`
4661
4553
  let checkedFragmentSpreads = /* @__PURE__ */ new Set(), visitor = visitWithTypeInfo3(typeInfo, {
4662
4554
  SelectionSet(node2, key, _parent) {
4663
4555
  let parent = _parent;
4664
- parent.kind === Kind21.FRAGMENT_DEFINITION ? checkedFragmentSpreads.add(parent.name.value) : parent.kind !== Kind21.INLINE_FRAGMENT && checkSelections(
4556
+ parent.kind === Kind20.FRAGMENT_DEFINITION ? checkedFragmentSpreads.add(parent.name.value) : parent.kind !== Kind20.INLINE_FRAGMENT && checkSelections(
4665
4557
  node2,
4666
4558
  typeInfo.getType(),
4667
4559
  selection.loc.start,
@@ -4677,24 +4569,30 @@ Include it in your selection set{{ addition }}.`
4677
4569
  let rawType = getBaseType(type);
4678
4570
  if (rawType instanceof GraphQLObjectType || rawType instanceof GraphQLInterfaceType)
4679
4571
  checkFields(rawType);
4680
- else if (rawType instanceof GraphQLUnionType) {
4681
- for (let selection of node.selections)
4682
- if (selection.kind === Kind21.INLINE_FRAGMENT) {
4683
- let t = rawType.getTypes().find((t2) => t2.name === selection.typeCondition.name.value);
4572
+ else if (rawType instanceof GraphQLUnionType)
4573
+ for (let selection of node.selections) {
4574
+ let types = rawType.getTypes();
4575
+ if (selection.kind === Kind20.INLINE_FRAGMENT) {
4576
+ let t = types.find((t2) => t2.name === selection.typeCondition.name.value);
4684
4577
  t && checkFields(t);
4578
+ } else if (selection.kind === Kind20.FRAGMENT_SPREAD) {
4579
+ let [foundSpread] = siblings.getFragment(selection.name.value);
4580
+ if (!foundSpread) return;
4581
+ let fragmentSpread = foundSpread.document, t = fragmentSpread.typeCondition.name.value === rawType.name ? rawType : types.find((t2) => t2.name === fragmentSpread.typeCondition.name.value);
4582
+ checkedFragmentSpreads.add(fragmentSpread.name.value), checkSelections(fragmentSpread.selectionSet, t, loc, parent, checkedFragmentSpreads);
4685
4583
  }
4686
- }
4584
+ }
4687
4585
  function checkFields(rawType2) {
4688
4586
  let fields = rawType2.getFields();
4689
4587
  if (!idNames.some((name) => fields[name]))
4690
4588
  return;
4691
4589
  function hasIdField({ selections }) {
4692
4590
  return selections.some((selection) => {
4693
- if (selection.kind === Kind21.FIELD)
4591
+ if (selection.kind === Kind20.FIELD)
4694
4592
  return selection.alias && idNames.includes(selection.alias.value) ? !0 : idNames.includes(selection.name.value);
4695
- if (selection.kind === Kind21.INLINE_FRAGMENT)
4593
+ if (selection.kind === Kind20.INLINE_FRAGMENT)
4696
4594
  return hasIdField(selection.selectionSet);
4697
- if (selection.kind === Kind21.FRAGMENT_SPREAD) {
4595
+ if (selection.kind === Kind20.FRAGMENT_SPREAD) {
4698
4596
  let [foundSpread] = siblings.getFragment(selection.name.value);
4699
4597
  if (foundSpread) {
4700
4598
  let fragmentSpread = foundSpread.document;
@@ -4722,7 +4620,7 @@ Include it in your selection set{{ addition }}.`
4722
4620
  desc: `Add \`${idName}\` selection`,
4723
4621
  fix: (fixer) => {
4724
4622
  let insertNode = node.selections[0];
4725
- return insertNode = insertNode.kind === Kind21.INLINE_FRAGMENT ? insertNode.selectionSet.selections[0] : insertNode, fixer.insertTextBefore(insertNode, `${idName} `);
4623
+ return insertNode = insertNode.kind === Kind20.INLINE_FRAGMENT ? insertNode.selectionSet.selections[0] : insertNode, fixer.insertTextBefore(insertNode, `${idName} `);
4726
4624
  }
4727
4625
  }))), context.report(problem);
4728
4626
  }
@@ -4797,9 +4695,9 @@ var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
4797
4695
  };
4798
4696
 
4799
4697
  // src/rules/selection-set-depth/index.ts
4800
- import { Kind as Kind22 } from "graphql";
4698
+ import { Kind as Kind21 } from "graphql";
4801
4699
  import depthLimit from "graphql-depth-limit";
4802
- var RULE_ID21 = "selection-set-depth", schema13 = {
4700
+ var RULE_ID21 = "selection-set-depth", schema14 = {
4803
4701
  type: "array",
4804
4702
  minItems: 1,
4805
4703
  maxItems: 1,
@@ -4867,15 +4765,15 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4867
4765
  recommended: !0,
4868
4766
  configOptions: [{ maxDepth: 7 }]
4869
4767
  },
4870
- schema: schema13
4768
+ schema: schema14
4871
4769
  },
4872
4770
  create(context) {
4873
4771
  let siblings = null;
4874
4772
  try {
4875
- siblings = requireSiblingsOperations(RULE_ID21, context);
4773
+ siblings = requireGraphQLOperations(RULE_ID21, context);
4876
4774
  } catch {
4877
4775
  logger.warn(
4878
- `Rule "${RULE_ID21}" works best with siblings operations loaded. For more info: https://bit.ly/graphql-eslint-operations`
4776
+ `Rule "${RULE_ID21}" works best with siblings operations loaded. See https://the-guild.dev/graphql/eslint/docs/usage#providing-operations for more info`
4879
4777
  );
4880
4778
  }
4881
4779
  let { maxDepth, ignore = [] } = context.options[0], checkFn = depthLimit(maxDepth, { ignore });
@@ -4883,7 +4781,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4883
4781
  "OperationDefinition, FragmentDefinition"(node) {
4884
4782
  try {
4885
4783
  let rawNode = node.rawNode(), fragmentsInUse = siblings ? siblings.getFragmentsInUse(rawNode) : [], document = {
4886
- kind: Kind22.DOCUMENT,
4784
+ kind: Kind21.DOCUMENT,
4887
4785
  definitions: [rawNode, ...fragmentsInUse]
4888
4786
  };
4889
4787
  checkFn({
@@ -4917,7 +4815,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4917
4815
  });
4918
4816
  } catch (e) {
4919
4817
  logger.warn(
4920
- `Rule "${RULE_ID21}" check failed due to a missing siblings operations. For more info: https://bit.ly/graphql-eslint-operations`,
4818
+ `Rule "${RULE_ID21}" check failed due to a missing siblings operations. See https://the-guild.dev/graphql/eslint/docs/usage#providing-operations for more info`,
4921
4819
  e
4922
4820
  );
4923
4821
  }
@@ -4927,8 +4825,8 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4927
4825
  };
4928
4826
 
4929
4827
  // src/rules/strict-id-in-types/index.ts
4930
- import { Kind as Kind23 } from "graphql";
4931
- var RULE_ID22 = "strict-id-in-types", schema14 = {
4828
+ import { Kind as Kind22 } from "graphql";
4829
+ var RULE_ID22 = "strict-id-in-types", schema15 = {
4932
4830
  type: "array",
4933
4831
  maxItems: 1,
4934
4832
  items: {
@@ -5036,7 +4934,7 @@ var RULE_ID22 = "strict-id-in-types", schema14 = {
5036
4934
  }
5037
4935
  ]
5038
4936
  },
5039
- schema: schema14
4937
+ schema: schema15
5040
4938
  },
5041
4939
  create(context) {
5042
4940
  let options = {
@@ -5044,19 +4942,19 @@ var RULE_ID22 = "strict-id-in-types", schema14 = {
5044
4942
  acceptedIdTypes: ["ID"],
5045
4943
  exceptions: {},
5046
4944
  ...context.options[0]
5047
- }, schema15 = requireGraphQLSchemaFromContext(RULE_ID22, context);
4945
+ }, schema16 = requireGraphQLSchema(RULE_ID22, context);
5048
4946
  return {
5049
4947
  [`ObjectTypeDefinition[name.value!=/^(${[
5050
- schema15.getQueryType(),
5051
- schema15.getMutationType(),
5052
- schema15.getSubscriptionType()
4948
+ schema16.getQueryType(),
4949
+ schema16.getMutationType(),
4950
+ schema16.getSubscriptionType()
5053
4951
  ].filter(truthy).map((type) => type.name).join("|")})$/]`](node) {
5054
4952
  let typeName = node.name.value;
5055
4953
  if (options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix)))
5056
4954
  return;
5057
4955
  if (node.fields?.filter((field) => {
5058
4956
  let fieldNode = field.rawNode(), isValidIdName = options.acceptedIdNames.includes(fieldNode.name.value), isValidIdType = !1;
5059
- return fieldNode.type.kind === Kind23.NON_NULL_TYPE && fieldNode.type.type.kind === Kind23.NAMED_TYPE && (isValidIdType = options.acceptedIdTypes.includes(fieldNode.type.type.name.value)), isValidIdName && isValidIdType;
4957
+ return fieldNode.type.kind === Kind22.NON_NULL_TYPE && fieldNode.type.type.kind === Kind22.NAMED_TYPE && (isValidIdType = options.acceptedIdTypes.includes(fieldNode.type.type.name.value)), isValidIdName && isValidIdType;
5060
4958
  })?.length !== 1) {
5061
4959
  let pluralNamesSuffix = options.acceptedIdNames.length > 1 ? "s" : "", pluralTypesSuffix = options.acceptedIdTypes.length > 1 ? "s" : "";
5062
4960
  context.report({
@@ -5072,7 +4970,7 @@ Accepted type${pluralTypesSuffix}: ${englishJoinWords(options.acceptedIdTypes)}.
5072
4970
  };
5073
4971
 
5074
4972
  // src/rules/unique-enum-value-names/index.ts
5075
- import { Kind as Kind24 } from "graphql";
4973
+ import { Kind as Kind23 } from "graphql";
5076
4974
  var rule32 = {
5077
4975
  meta: {
5078
4976
  type: "suggestion",
@@ -5116,7 +5014,7 @@ var rule32 = {
5116
5014
  },
5117
5015
  create(context) {
5118
5016
  return {
5119
- [[Kind24.ENUM_TYPE_DEFINITION, Kind24.ENUM_TYPE_EXTENSION].join(",")](node) {
5017
+ [[Kind23.ENUM_TYPE_DEFINITION, Kind23.ENUM_TYPE_EXTENSION].join(",")](node) {
5120
5018
  let duplicates = node.values?.filter(
5121
5019
  (item, index, array) => array.findIndex((v) => v.name.value.toLowerCase() === item.name.value.toLowerCase()) !== index
5122
5020
  );
@@ -5142,9 +5040,9 @@ var rule32 = {
5142
5040
 
5143
5041
  // src/rules/unique-fragment-name/index.ts
5144
5042
  import { relative as relative2 } from "node:path";
5145
- import { Kind as Kind25 } from "graphql";
5043
+ import { Kind as Kind24 } from "graphql";
5146
5044
  var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
5147
- 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) => {
5045
+ let documentName = node.name.value, siblings = requireGraphQLOperations(ruleId, context), siblingDocuments = node.kind === Kind24.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName), filepath = context.filename, conflictingDocuments = siblingDocuments.filter((f) => {
5148
5046
  let isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
5149
5047
  return isSameName && !isSamePath;
5150
5048
  });
@@ -5332,32 +5230,222 @@ var rules = {
5332
5230
  "unique-operation-name": rule34
5333
5231
  };
5334
5232
 
5233
+ // src/configs/operations-all.ts
5234
+ var operations_all_default = {
5235
+ extends: "./configs/operations-recommended",
5236
+ rules: {
5237
+ "@graphql-eslint/alphabetize": [
5238
+ "error",
5239
+ {
5240
+ definitions: !0,
5241
+ selections: ["OperationDefinition", "FragmentDefinition"],
5242
+ variables: !0,
5243
+ arguments: ["Field", "Directive"],
5244
+ groups: ["...", "id", "*", "{"]
5245
+ }
5246
+ ],
5247
+ "@graphql-eslint/lone-executable-definition": "error",
5248
+ "@graphql-eslint/match-document-filename": [
5249
+ "error",
5250
+ {
5251
+ query: "kebab-case",
5252
+ mutation: "kebab-case",
5253
+ subscription: "kebab-case",
5254
+ fragment: "kebab-case"
5255
+ }
5256
+ ],
5257
+ "@graphql-eslint/no-one-place-fragments": "error",
5258
+ "@graphql-eslint/require-import-fragment": "error"
5259
+ }
5260
+ };
5261
+
5262
+ // src/configs/operations-recommended.ts
5263
+ var operations_recommended_default = {
5264
+ parser: "@graphql-eslint/eslint-plugin",
5265
+ plugins: ["@graphql-eslint"],
5266
+ rules: {
5267
+ "@graphql-eslint/executable-definitions": "error",
5268
+ "@graphql-eslint/fields-on-correct-type": "error",
5269
+ "@graphql-eslint/fragments-on-composite-type": "error",
5270
+ "@graphql-eslint/known-argument-names": "error",
5271
+ "@graphql-eslint/known-directives": "error",
5272
+ "@graphql-eslint/known-fragment-names": "error",
5273
+ "@graphql-eslint/known-type-names": "error",
5274
+ "@graphql-eslint/lone-anonymous-operation": "error",
5275
+ "@graphql-eslint/naming-convention": [
5276
+ "error",
5277
+ {
5278
+ VariableDefinition: "camelCase",
5279
+ OperationDefinition: {
5280
+ style: "PascalCase",
5281
+ forbiddenPrefixes: ["Query", "Mutation", "Subscription", "Get"],
5282
+ forbiddenSuffixes: ["Query", "Mutation", "Subscription"]
5283
+ },
5284
+ FragmentDefinition: {
5285
+ style: "PascalCase",
5286
+ forbiddenPrefixes: ["Fragment"],
5287
+ forbiddenSuffixes: ["Fragment"]
5288
+ }
5289
+ }
5290
+ ],
5291
+ "@graphql-eslint/no-anonymous-operations": "error",
5292
+ "@graphql-eslint/no-deprecated": "error",
5293
+ "@graphql-eslint/no-duplicate-fields": "error",
5294
+ "@graphql-eslint/no-fragment-cycles": "error",
5295
+ "@graphql-eslint/no-undefined-variables": "error",
5296
+ "@graphql-eslint/no-unused-fragments": "error",
5297
+ "@graphql-eslint/no-unused-variables": "error",
5298
+ "@graphql-eslint/one-field-subscriptions": "error",
5299
+ "@graphql-eslint/overlapping-fields-can-be-merged": "error",
5300
+ "@graphql-eslint/possible-fragment-spread": "error",
5301
+ "@graphql-eslint/provided-required-arguments": "error",
5302
+ "@graphql-eslint/require-selections": "error",
5303
+ "@graphql-eslint/scalar-leafs": "error",
5304
+ "@graphql-eslint/selection-set-depth": ["error", { maxDepth: 7 }],
5305
+ "@graphql-eslint/unique-argument-names": "error",
5306
+ "@graphql-eslint/unique-directive-names-per-location": "error",
5307
+ "@graphql-eslint/unique-fragment-name": "error",
5308
+ "@graphql-eslint/unique-input-field-names": "error",
5309
+ "@graphql-eslint/unique-operation-name": "error",
5310
+ "@graphql-eslint/unique-variable-names": "error",
5311
+ "@graphql-eslint/value-literals-of-correct-type": "error",
5312
+ "@graphql-eslint/variables-are-input-types": "error",
5313
+ "@graphql-eslint/variables-in-allowed-position": "error"
5314
+ }
5315
+ };
5316
+
5317
+ // src/configs/schema-all.ts
5318
+ var schema_all_default = {
5319
+ extends: "./configs/schema-recommended",
5320
+ rules: {
5321
+ "@graphql-eslint/alphabetize": [
5322
+ "error",
5323
+ {
5324
+ definitions: !0,
5325
+ fields: ["ObjectTypeDefinition", "InterfaceTypeDefinition", "InputObjectTypeDefinition"],
5326
+ values: !0,
5327
+ arguments: ["FieldDefinition", "Field", "DirectiveDefinition", "Directive"],
5328
+ groups: ["id", "*", "createdAt", "updatedAt"]
5329
+ }
5330
+ ],
5331
+ "@graphql-eslint/input-name": "error",
5332
+ "@graphql-eslint/no-root-type": ["error", { disallow: ["mutation", "subscription"] }],
5333
+ "@graphql-eslint/no-scalar-result-type-on-mutation": "error",
5334
+ "@graphql-eslint/require-deprecation-date": "error",
5335
+ "@graphql-eslint/require-field-of-type-query-in-mutation-result": "error",
5336
+ "@graphql-eslint/require-nullable-fields-with-oneof": "error",
5337
+ "@graphql-eslint/require-nullable-result-in-root": "error",
5338
+ "@graphql-eslint/require-type-pattern-with-oneof": "error"
5339
+ }
5340
+ };
5341
+
5342
+ // src/configs/schema-recommended.ts
5343
+ var schema_recommended_default = {
5344
+ parser: "@graphql-eslint/eslint-plugin",
5345
+ plugins: ["@graphql-eslint"],
5346
+ rules: {
5347
+ "@graphql-eslint/description-style": "error",
5348
+ "@graphql-eslint/known-argument-names": "error",
5349
+ "@graphql-eslint/known-directives": "error",
5350
+ "@graphql-eslint/known-type-names": "error",
5351
+ "@graphql-eslint/lone-schema-definition": "error",
5352
+ "@graphql-eslint/naming-convention": [
5353
+ "error",
5354
+ {
5355
+ types: "PascalCase",
5356
+ FieldDefinition: "camelCase",
5357
+ InputValueDefinition: "camelCase",
5358
+ Argument: "camelCase",
5359
+ DirectiveDefinition: "camelCase",
5360
+ EnumValueDefinition: "UPPER_CASE",
5361
+ "FieldDefinition[parent.name.value=Query]": {
5362
+ forbiddenPrefixes: ["query", "get"],
5363
+ forbiddenSuffixes: ["Query"]
5364
+ },
5365
+ "FieldDefinition[parent.name.value=Mutation]": {
5366
+ forbiddenPrefixes: ["mutation"],
5367
+ forbiddenSuffixes: ["Mutation"]
5368
+ },
5369
+ "FieldDefinition[parent.name.value=Subscription]": {
5370
+ forbiddenPrefixes: ["subscription"],
5371
+ forbiddenSuffixes: ["Subscription"]
5372
+ },
5373
+ "EnumTypeDefinition,EnumTypeExtension": {
5374
+ forbiddenPrefixes: ["Enum"],
5375
+ forbiddenSuffixes: ["Enum"]
5376
+ },
5377
+ "InterfaceTypeDefinition,InterfaceTypeExtension": {
5378
+ forbiddenPrefixes: ["Interface"],
5379
+ forbiddenSuffixes: ["Interface"]
5380
+ },
5381
+ "UnionTypeDefinition,UnionTypeExtension": {
5382
+ forbiddenPrefixes: ["Union"],
5383
+ forbiddenSuffixes: ["Union"]
5384
+ },
5385
+ "ObjectTypeDefinition,ObjectTypeExtension": {
5386
+ forbiddenPrefixes: ["Type"],
5387
+ forbiddenSuffixes: ["Type"]
5388
+ }
5389
+ }
5390
+ ],
5391
+ "@graphql-eslint/no-hashtag-description": "error",
5392
+ "@graphql-eslint/no-typename-prefix": "error",
5393
+ "@graphql-eslint/no-unreachable-types": "error",
5394
+ "@graphql-eslint/possible-type-extension": "error",
5395
+ "@graphql-eslint/provided-required-arguments": "error",
5396
+ "@graphql-eslint/require-deprecation-reason": "error",
5397
+ "@graphql-eslint/require-description": [
5398
+ "error",
5399
+ { types: !0, DirectiveDefinition: !0, rootField: !0 }
5400
+ ],
5401
+ "@graphql-eslint/strict-id-in-types": "error",
5402
+ "@graphql-eslint/unique-directive-names": "error",
5403
+ "@graphql-eslint/unique-directive-names-per-location": "error",
5404
+ "@graphql-eslint/unique-enum-value-names": "error",
5405
+ "@graphql-eslint/unique-field-definition-names": "error",
5406
+ "@graphql-eslint/unique-operation-types": "error",
5407
+ "@graphql-eslint/unique-type-names": "error"
5408
+ }
5409
+ };
5410
+
5411
+ // src/configs/schema-relay.ts
5412
+ var schema_relay_default = {
5413
+ parser: "@graphql-eslint/eslint-plugin",
5414
+ plugins: ["@graphql-eslint"],
5415
+ rules: {
5416
+ "@graphql-eslint/relay-arguments": "error",
5417
+ "@graphql-eslint/relay-connection-types": "error",
5418
+ "@graphql-eslint/relay-edge-types": "error",
5419
+ "@graphql-eslint/relay-page-info": "error"
5420
+ }
5421
+ };
5422
+
5335
5423
  // src/configs/index.ts
5336
- 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 = {
5337
- "schema-recommended": import_schema_recommended.default,
5338
- "schema-all": import_schema_all.default,
5339
- "schema-relay": import_schema_relay.default,
5340
- "operations-recommended": import_operations_recommended.default,
5341
- "operations-all": import_operations_all.default,
5424
+ var configs = {
5425
+ "schema-recommended": schema_recommended_default,
5426
+ "schema-all": schema_all_default,
5427
+ "schema-relay": schema_relay_default,
5428
+ "operations-recommended": operations_recommended_default,
5429
+ "operations-all": operations_all_default,
5342
5430
  "flat/schema-recommended": {
5343
- rules: import_schema_recommended.default.rules
5431
+ rules: schema_recommended_default.rules
5344
5432
  },
5345
5433
  "flat/schema-all": {
5346
5434
  rules: {
5347
- ...import_schema_recommended.default.rules,
5348
- ...import_schema_all.default.rules
5435
+ ...schema_recommended_default.rules,
5436
+ ...schema_all_default.rules
5349
5437
  }
5350
5438
  },
5351
5439
  "flat/schema-relay": {
5352
- rules: import_schema_relay.default.rules
5440
+ rules: schema_relay_default.rules
5353
5441
  },
5354
5442
  "flat/operations-recommended": {
5355
- rules: import_operations_recommended.default.rules
5443
+ rules: operations_recommended_default.rules
5356
5444
  },
5357
5445
  "flat/operations-all": {
5358
5446
  rules: {
5359
- ...import_operations_recommended.default.rules,
5360
- ...import_operations_all.default.rules
5447
+ ...operations_recommended_default.rules,
5448
+ ...operations_all_default.rules
5361
5449
  }
5362
5450
  }
5363
5451
  };