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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. package/cjs/cache.js +8 -36
  2. package/cjs/chunk-UIAXBAMD.js +8 -0
  3. package/cjs/configs/index.d.cts +15 -5
  4. package/cjs/configs/index.js +31 -45
  5. package/cjs/configs/operations-all.js +33 -26
  6. package/cjs/configs/operations-recommended.js +59 -52
  7. package/cjs/configs/schema-all.js +29 -22
  8. package/cjs/configs/schema-recommended.js +73 -66
  9. package/cjs/configs/schema-relay.js +17 -10
  10. package/cjs/documents.js +12 -37
  11. package/cjs/estree-converter/converter.js +16 -30
  12. package/cjs/estree-converter/index.js +3 -23
  13. package/cjs/estree-converter/types.js +1 -14
  14. package/cjs/estree-converter/utils.js +22 -40
  15. package/cjs/graphql-config.js +15 -41
  16. package/cjs/index.d.cts +164 -9
  17. package/cjs/index.js +24 -41
  18. package/cjs/meta.js +5 -25
  19. package/cjs/parser.js +29 -49
  20. package/cjs/processor.js +22 -35
  21. package/{esm/rules/alphabetize.d.ts → cjs/rules/alphabetize/index.d.cts} +4 -4
  22. package/cjs/rules/{alphabetize.js → alphabetize/index.js} +69 -77
  23. package/{esm/rules/description-style.d.ts → cjs/rules/description-style/index.d.cts} +3 -3
  24. package/cjs/rules/{description-style.js → description-style/index.js} +7 -27
  25. package/cjs/rules/graphql-js-validation.js +93 -70
  26. package/cjs/rules/index.d.cts +5 -5
  27. package/cjs/rules/index.js +74 -60
  28. package/{esm/rules/input-name.d.ts → cjs/rules/input-name/index.d.cts} +3 -3
  29. package/cjs/rules/{input-name.js → input-name/index.js} +10 -28
  30. package/{esm/rules/lone-executable-definition.d.ts → cjs/rules/lone-executable-definition/index.d.cts} +3 -3
  31. package/cjs/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +13 -32
  32. package/cjs/rules/{match-document-filename.d.cts → match-document-filename/index.d.cts} +4 -4
  33. package/cjs/rules/{match-document-filename.js → match-document-filename/index.js} +20 -34
  34. package/{esm/rules/naming-convention.d.ts → cjs/rules/naming-convention/index.d.cts} +3 -3
  35. package/cjs/rules/{naming-convention.js → naming-convention/index.js} +41 -54
  36. package/cjs/rules/no-anonymous-operations/index.d.cts +13 -0
  37. package/cjs/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +9 -28
  38. package/cjs/rules/{no-deprecated.d.cts → no-deprecated/index.d.cts} +3 -3
  39. package/cjs/rules/{no-deprecated.js → no-deprecated/index.js} +11 -30
  40. package/cjs/rules/no-duplicate-fields/index.d.cts +13 -0
  41. package/cjs/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +8 -28
  42. package/cjs/rules/{no-hashtag-description.d.cts → no-hashtag-description/index.d.cts} +3 -3
  43. package/cjs/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +11 -31
  44. package/cjs/rules/no-one-place-fragments/index.d.cts +13 -0
  45. package/cjs/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +11 -29
  46. package/cjs/rules/{no-root-type.d.cts → no-root-type/index.d.cts} +3 -3
  47. package/cjs/rules/{no-root-type.js → no-root-type/index.js} +9 -29
  48. package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +13 -0
  49. package/cjs/rules/no-scalar-result-type-on-mutation/index.js +69 -0
  50. package/cjs/rules/no-typename-prefix/index.d.cts +13 -0
  51. package/cjs/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +5 -25
  52. package/cjs/rules/no-unreachable-types/index.d.cts +13 -0
  53. package/cjs/rules/no-unreachable-types/index.js +155 -0
  54. package/cjs/rules/no-unused-fields/index.d.cts +13 -0
  55. package/cjs/rules/{no-unused-fields.js → no-unused-fields/index.js} +12 -30
  56. package/{esm/rules/relay-arguments.d.ts → cjs/rules/relay-arguments/index.d.cts} +3 -3
  57. package/cjs/rules/{relay-arguments.js → relay-arguments/index.js} +11 -30
  58. package/{esm/rules/relay-connection-types.d.ts → cjs/rules/relay-connection-types/index.d.cts} +3 -3
  59. package/cjs/rules/{relay-connection-types.js → relay-connection-types/index.js} +19 -40
  60. package/{esm/rules/relay-edge-types.d.ts → cjs/rules/relay-edge-types/index.d.cts} +3 -3
  61. package/cjs/rules/{relay-edge-types.js → relay-edge-types/index.js} +30 -43
  62. package/cjs/rules/relay-page-info/index.d.cts +13 -0
  63. package/cjs/rules/{relay-page-info.js → relay-page-info/index.js} +12 -30
  64. package/{esm/rules/require-deprecation-date.d.ts → cjs/rules/require-deprecation-date/index.d.cts} +3 -3
  65. package/cjs/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +13 -32
  66. package/cjs/rules/require-deprecation-reason/index.d.cts +13 -0
  67. package/cjs/rules/require-deprecation-reason/index.js +66 -0
  68. package/cjs/rules/{require-description.d.cts → require-description/index.d.cts} +3 -3
  69. package/cjs/rules/{require-description.js → require-description/index.js} +30 -44
  70. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +13 -0
  71. package/cjs/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +10 -29
  72. package/cjs/rules/require-import-fragment/index.d.cts +13 -0
  73. package/cjs/rules/{require-import-fragment.js → require-import-fragment/index.js} +11 -38
  74. package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +13 -0
  75. package/cjs/rules/require-nullable-fields-with-oneof/index.js +62 -0
  76. package/cjs/rules/require-nullable-result-in-root/index.d.cts +13 -0
  77. package/cjs/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +12 -31
  78. package/cjs/rules/{require-selections.d.cts → require-selections/index.d.cts} +3 -3
  79. package/cjs/rules/{require-selections.js → require-selections/index.js} +38 -43
  80. package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +13 -0
  81. package/cjs/rules/require-type-pattern-with-oneof/index.js +63 -0
  82. package/{esm/rules/selection-set-depth.d.ts → cjs/rules/selection-set-depth/index.d.cts} +3 -3
  83. package/cjs/rules/{selection-set-depth.js → selection-set-depth/index.js} +15 -41
  84. package/cjs/rules/{strict-id-in-types.d.cts → strict-id-in-types/index.d.cts} +3 -3
  85. package/cjs/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +26 -39
  86. package/cjs/rules/unique-enum-value-names/index.d.cts +13 -0
  87. package/cjs/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +10 -29
  88. package/{esm/rules/unique-fragment-name.d.ts → cjs/rules/unique-fragment-name/index.d.cts} +3 -3
  89. package/cjs/rules/unique-fragment-name/index.js +87 -0
  90. package/cjs/rules/unique-operation-name/index.d.cts +13 -0
  91. package/cjs/rules/{unique-operation-name.js → unique-operation-name/index.js} +7 -27
  92. package/cjs/schema.js +11 -36
  93. package/cjs/siblings.js +17 -33
  94. package/cjs/types.js +1 -14
  95. package/cjs/utils.d.cts +2 -2
  96. package/cjs/utils.js +94 -115
  97. package/esm/configs/index.d.ts +15 -5
  98. package/esm/configs/index.js +17 -7
  99. package/esm/configs/operations-all.js +1 -1
  100. package/esm/index.d.ts +164 -9
  101. package/esm/index.js +9 -2
  102. package/esm/meta.js +1 -1
  103. package/{cjs/rules/alphabetize.d.cts → esm/rules/alphabetize/index.d.ts} +4 -4
  104. package/esm/rules/{alphabetize.js → alphabetize/index.js} +26 -10
  105. package/{cjs/rules/description-style.d.cts → esm/rules/description-style/index.d.ts} +3 -3
  106. package/esm/rules/{description-style.js → description-style/index.js} +2 -2
  107. package/esm/rules/index.d.ts +5 -5
  108. package/esm/rules/index.js +34 -34
  109. package/{cjs/rules/input-name.d.cts → esm/rules/input-name/index.d.ts} +3 -3
  110. package/esm/rules/{input-name.js → input-name/index.js} +1 -1
  111. package/{cjs/rules/lone-executable-definition.d.cts → esm/rules/lone-executable-definition/index.d.ts} +3 -3
  112. package/esm/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +2 -2
  113. package/esm/rules/{match-document-filename.d.ts → match-document-filename/index.d.ts} +4 -4
  114. package/esm/rules/{match-document-filename.js → match-document-filename/index.js} +2 -2
  115. package/{cjs/rules/naming-convention.d.cts → esm/rules/naming-convention/index.d.ts} +3 -3
  116. package/esm/rules/{naming-convention.js → naming-convention/index.js} +2 -2
  117. package/{cjs/rules/no-anonymous-operations.d.cts → esm/rules/no-anonymous-operations/index.d.ts} +3 -3
  118. package/esm/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +2 -2
  119. package/esm/rules/{no-deprecated.d.ts → no-deprecated/index.d.ts} +3 -3
  120. package/esm/rules/{no-deprecated.js → no-deprecated/index.js} +2 -2
  121. package/{cjs/rules/no-one-place-fragments.d.cts → esm/rules/no-duplicate-fields/index.d.ts} +3 -3
  122. package/esm/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +1 -1
  123. package/esm/rules/{no-hashtag-description.d.ts → no-hashtag-description/index.d.ts} +3 -3
  124. package/esm/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +2 -2
  125. package/{cjs/rules/no-duplicate-fields.d.cts → esm/rules/no-one-place-fragments/index.d.ts} +3 -3
  126. package/esm/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +2 -2
  127. package/esm/rules/{no-root-type.d.ts → no-root-type/index.d.ts} +3 -3
  128. package/esm/rules/{no-root-type.js → no-root-type/index.js} +2 -2
  129. package/{cjs/rules/no-scalar-result-type-on-mutation.d.cts → esm/rules/no-scalar-result-type-on-mutation/index.d.ts} +3 -3
  130. package/esm/rules/{no-scalar-result-type-on-mutation.js → no-scalar-result-type-on-mutation/index.js} +2 -2
  131. package/esm/rules/no-typename-prefix/index.d.ts +13 -0
  132. package/esm/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +1 -1
  133. package/esm/rules/no-unreachable-types/index.d.ts +13 -0
  134. package/esm/rules/{no-unreachable-types.js → no-unreachable-types/index.js} +3 -3
  135. package/esm/rules/no-unused-fields/index.d.ts +13 -0
  136. package/esm/rules/{no-unused-fields.js → no-unused-fields/index.js} +3 -3
  137. package/{cjs/rules/relay-arguments.d.cts → esm/rules/relay-arguments/index.d.ts} +3 -3
  138. package/esm/rules/{relay-arguments.js → relay-arguments/index.js} +2 -2
  139. package/{cjs/rules/relay-connection-types.d.cts → esm/rules/relay-connection-types/index.d.ts} +3 -3
  140. package/esm/rules/{relay-connection-types.js → relay-connection-types/index.js} +1 -1
  141. package/{cjs/rules/relay-edge-types.d.cts → esm/rules/relay-edge-types/index.d.ts} +3 -3
  142. package/esm/rules/{relay-edge-types.js → relay-edge-types/index.js} +2 -2
  143. package/esm/rules/relay-page-info/index.d.ts +13 -0
  144. package/esm/rules/{relay-page-info.js → relay-page-info/index.js} +3 -3
  145. package/{cjs/rules/require-deprecation-date.d.cts → esm/rules/require-deprecation-date/index.d.ts} +3 -3
  146. package/esm/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +3 -3
  147. package/esm/rules/require-deprecation-reason/index.d.ts +13 -0
  148. package/esm/rules/{require-deprecation-reason.js → require-deprecation-reason/index.js} +3 -3
  149. package/esm/rules/{require-description.d.ts → require-description/index.d.ts} +3 -3
  150. package/esm/rules/{require-description.js → require-description/index.js} +2 -2
  151. package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +13 -0
  152. package/esm/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +2 -2
  153. package/esm/rules/require-import-fragment/index.d.ts +13 -0
  154. package/esm/rules/{require-import-fragment.js → require-import-fragment/index.js} +2 -2
  155. package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +13 -0
  156. package/esm/rules/{require-nullable-fields-with-oneof.js → require-nullable-fields-with-oneof/index.js} +2 -2
  157. package/esm/rules/require-nullable-result-in-root/index.d.ts +13 -0
  158. package/esm/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +2 -2
  159. package/esm/rules/{require-selections.d.ts → require-selections/index.d.ts} +3 -3
  160. package/esm/rules/{require-selections.js → require-selections/index.js} +3 -4
  161. package/esm/rules/require-type-pattern-with-oneof/index.d.ts +13 -0
  162. package/esm/rules/{require-type-pattern-with-oneof.js → require-type-pattern-with-oneof/index.js} +2 -2
  163. package/{cjs/rules/selection-set-depth.d.cts → esm/rules/selection-set-depth/index.d.ts} +3 -3
  164. package/esm/rules/{selection-set-depth.js → selection-set-depth/index.js} +2 -2
  165. package/esm/rules/{strict-id-in-types.d.ts → strict-id-in-types/index.d.ts} +3 -3
  166. package/esm/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +2 -2
  167. package/esm/rules/unique-enum-value-names/index.d.ts +13 -0
  168. package/esm/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +2 -2
  169. package/{cjs/rules/unique-fragment-name.d.cts → esm/rules/unique-fragment-name/index.d.ts} +3 -3
  170. package/esm/rules/{unique-fragment-name.js → unique-fragment-name/index.js} +3 -3
  171. package/esm/rules/unique-operation-name/index.d.ts +13 -0
  172. package/esm/rules/{unique-operation-name.js → unique-operation-name/index.js} +2 -2
  173. package/esm/utils.d.ts +2 -2
  174. package/esm/utils.js +39 -16
  175. package/index.browser.js +115 -67
  176. package/package.json +2 -2
  177. package/cjs/rules/no-scalar-result-type-on-mutation.js +0 -88
  178. package/cjs/rules/no-typename-prefix.d.cts +0 -13
  179. package/cjs/rules/no-unreachable-types.d.cts +0 -13
  180. package/cjs/rules/no-unreachable-types.js +0 -175
  181. package/cjs/rules/no-unused-fields.d.cts +0 -13
  182. package/cjs/rules/relay-page-info.d.cts +0 -13
  183. package/cjs/rules/require-deprecation-reason.d.cts +0 -13
  184. package/cjs/rules/require-deprecation-reason.js +0 -85
  185. package/cjs/rules/require-field-of-type-query-in-mutation-result.d.cts +0 -13
  186. package/cjs/rules/require-import-fragment.d.cts +0 -13
  187. package/cjs/rules/require-nullable-fields-with-oneof.d.cts +0 -13
  188. package/cjs/rules/require-nullable-fields-with-oneof.js +0 -81
  189. package/cjs/rules/require-nullable-result-in-root.d.cts +0 -13
  190. package/cjs/rules/require-type-pattern-with-oneof.d.cts +0 -13
  191. package/cjs/rules/require-type-pattern-with-oneof.js +0 -83
  192. package/cjs/rules/unique-enum-value-names.d.cts +0 -13
  193. package/cjs/rules/unique-fragment-name.js +0 -106
  194. package/cjs/rules/unique-operation-name.d.cts +0 -13
  195. package/esm/rules/no-anonymous-operations.d.ts +0 -13
  196. package/esm/rules/no-duplicate-fields.d.ts +0 -13
  197. package/esm/rules/no-one-place-fragments.d.ts +0 -13
  198. package/esm/rules/no-scalar-result-type-on-mutation.d.ts +0 -13
  199. package/esm/rules/no-typename-prefix.d.ts +0 -13
  200. package/esm/rules/no-unreachable-types.d.ts +0 -13
  201. package/esm/rules/no-unused-fields.d.ts +0 -13
  202. package/esm/rules/relay-page-info.d.ts +0 -13
  203. package/esm/rules/require-deprecation-reason.d.ts +0 -13
  204. package/esm/rules/require-field-of-type-query-in-mutation-result.d.ts +0 -13
  205. package/esm/rules/require-import-fragment.d.ts +0 -13
  206. package/esm/rules/require-nullable-fields-with-oneof.d.ts +0 -13
  207. package/esm/rules/require-nullable-result-in-root.d.ts +0 -13
  208. package/esm/rules/require-type-pattern-with-oneof.d.ts +0 -13
  209. package/esm/rules/unique-enum-value-names.d.ts +0 -13
  210. package/esm/rules/unique-operation-name.d.ts +0 -13
@@ -1,6 +1,6 @@
1
- import "../chunk-UIAXBAMD.js";
1
+ import "../../chunk-UIAXBAMD.js";
2
2
  import { Kind } from "graphql";
3
- import { getNodeName } from "../utils.js";
3
+ import { getNodeName } from "../../utils.js";
4
4
  const rule = {
5
5
  meta: {
6
6
  type: "suggestion",
@@ -1,11 +1,11 @@
1
1
  import { ExecutableDefinitionNode } from 'graphql';
2
- import { GraphQLESTreeNode } from '../estree-converter/types.cjs';
3
- import { GraphQLESLintRuleContext, GraphQLESLintRule } from '../types.cjs';
2
+ import { GraphQLESTreeNode } from '../../estree-converter/types.js';
3
+ import { GraphQLESLintRuleContext, GraphQLESLintRule } from '../../types.js';
4
4
  import 'eslint';
5
5
  import 'estree';
6
6
  import 'graphql-config';
7
7
  import 'json-schema-to-ts';
8
- import '../siblings.cjs';
8
+ import '../../siblings.js';
9
9
  import '@graphql-tools/utils';
10
10
 
11
11
  declare const checkNode: (context: GraphQLESLintRuleContext, node: GraphQLESTreeNode<ExecutableDefinitionNode>, ruleId: string) => void;
@@ -1,10 +1,10 @@
1
- import "../chunk-UIAXBAMD.js";
1
+ import "../../chunk-UIAXBAMD.js";
2
2
  import { relative } from "node:path";
3
3
  import { Kind } from "graphql";
4
- import { CWD, normalizePath, requireSiblingsOperations, VIRTUAL_DOCUMENT_REGEX } from "../utils.js";
4
+ import { CWD, requireSiblingsOperations, slash, VIRTUAL_DOCUMENT_REGEX } from "../../utils.js";
5
5
  const RULE_ID = "unique-fragment-name", checkNode = (context, node, ruleId) => {
6
6
  const documentName = node.name.value, siblings = requireSiblingsOperations(ruleId, context), siblingDocuments = node.kind === Kind.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName), filepath = context.filename, conflictingDocuments = siblingDocuments.filter((f) => {
7
- const isSameName = f.document.name?.value === documentName, isSamePath = normalizePath(f.filePath) === normalizePath(filepath);
7
+ const isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
8
8
  return isSameName && !isSamePath;
9
9
  });
10
10
  conflictingDocuments.length > 0 && context.report({
@@ -0,0 +1,13 @@
1
+ import { GraphQLESLintRule } from '../../types.js';
2
+ import 'eslint';
3
+ import 'estree';
4
+ import 'graphql';
5
+ import 'graphql-config';
6
+ import 'json-schema-to-ts';
7
+ import '../../estree-converter/types.js';
8
+ import '../../siblings.js';
9
+ import '@graphql-tools/utils';
10
+
11
+ declare const rule: GraphQLESLintRule;
12
+
13
+ export { rule };
@@ -1,5 +1,5 @@
1
- import "../chunk-UIAXBAMD.js";
2
- import { checkNode } from "./unique-fragment-name.js";
1
+ import "../../chunk-UIAXBAMD.js";
2
+ import { checkNode } from "../unique-fragment-name/index.js";
3
3
  const RULE_ID = "unique-operation-name", rule = {
4
4
  meta: {
5
5
  type: "suggestion",
package/esm/utils.d.ts CHANGED
@@ -14,7 +14,7 @@ declare const logger: {
14
14
  error: (...args: unknown[]) => void;
15
15
  warn: (...args: unknown[]) => void;
16
16
  };
17
- declare const normalizePath: (path: string) => string;
17
+ declare const slash: (path: string) => string;
18
18
  declare const VIRTUAL_DOCUMENT_REGEX: RegExp;
19
19
  declare const CWD: string;
20
20
  declare const getTypeName: (node: ASTNode) => string;
@@ -42,4 +42,4 @@ declare function truthy<T>(value: T): value is Truthy<T>;
42
42
  declare function displayNodeName(node: GraphQLESTreeNode<ASTNode>): string;
43
43
  declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
44
44
 
45
- export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, getLocation, getNodeName, getTypeName, logger, normalizePath, pascalCase, requireGraphQLSchemaFromContext, requireSiblingsOperations, truthy };
45
+ export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLSchemaFromContext, requireSiblingsOperations, slash, truthy };
package/esm/utils.js CHANGED
@@ -29,7 +29,7 @@ const chalk = {
29
29
  // eslint-disable-next-line no-console
30
30
  console.warn(chalk.yellow("warning"), "[graphql-eslint]", ...args)
31
31
  )
32
- }, normalizePath = (path) => (path || "").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 = [
32
+ }, slash = (path) => path.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 = [
33
33
  Kind.OBJECT_TYPE_DEFINITION,
34
34
  Kind.INTERFACE_TYPE_DEFINITION,
35
35
  Kind.ENUM_TYPE_DEFINITION,
@@ -78,26 +78,49 @@ function truthy(value) {
78
78
  return !!value;
79
79
  }
80
80
  const DisplayNodeNameMap = {
81
- [Kind.OBJECT_TYPE_DEFINITION]: "type",
82
- [Kind.OBJECT_TYPE_EXTENSION]: "type",
83
- [Kind.INTERFACE_TYPE_DEFINITION]: "interface",
84
- [Kind.INTERFACE_TYPE_EXTENSION]: "interface",
81
+ [Kind.ARGUMENT]: "argument",
82
+ [Kind.BOOLEAN]: "boolean",
83
+ [Kind.DIRECTIVE_DEFINITION]: "directive",
84
+ [Kind.DIRECTIVE]: "directive",
85
+ [Kind.DOCUMENT]: "document",
85
86
  [Kind.ENUM_TYPE_DEFINITION]: "enum",
86
87
  [Kind.ENUM_TYPE_EXTENSION]: "enum",
87
- [Kind.SCALAR_TYPE_DEFINITION]: "scalar",
88
+ [Kind.ENUM_VALUE_DEFINITION]: "enum value",
89
+ [Kind.ENUM]: "enum",
90
+ [Kind.FIELD_DEFINITION]: "field",
91
+ [Kind.FIELD]: "field",
92
+ [Kind.FLOAT]: "float",
93
+ [Kind.FRAGMENT_DEFINITION]: "fragment",
94
+ [Kind.FRAGMENT_SPREAD]: "fragment spread",
95
+ [Kind.INLINE_FRAGMENT]: "inline fragment",
88
96
  [Kind.INPUT_OBJECT_TYPE_DEFINITION]: "input",
89
97
  [Kind.INPUT_OBJECT_TYPE_EXTENSION]: "input",
90
- [Kind.UNION_TYPE_DEFINITION]: "union",
91
- [Kind.UNION_TYPE_EXTENSION]: "union",
92
- [Kind.DIRECTIVE_DEFINITION]: "directive",
93
- [Kind.FIELD_DEFINITION]: "field",
94
- [Kind.ENUM_VALUE_DEFINITION]: "enum value",
95
98
  [Kind.INPUT_VALUE_DEFINITION]: "input value",
96
- [Kind.ARGUMENT]: "argument",
97
- [Kind.VARIABLE]: "variable",
98
- [Kind.FRAGMENT_DEFINITION]: "fragment",
99
+ [Kind.INT]: "int",
100
+ [Kind.INTERFACE_TYPE_DEFINITION]: "interface",
101
+ [Kind.INTERFACE_TYPE_EXTENSION]: "interface",
102
+ [Kind.LIST_TYPE]: "list type",
103
+ [Kind.LIST]: "list",
104
+ [Kind.NAME]: "name",
105
+ [Kind.NAMED_TYPE]: "named type",
106
+ [Kind.NON_NULL_TYPE]: "non-null type",
107
+ [Kind.NULL]: "null",
108
+ [Kind.OBJECT_FIELD]: "object field",
109
+ [Kind.OBJECT_TYPE_DEFINITION]: "type",
110
+ [Kind.OBJECT_TYPE_EXTENSION]: "type",
111
+ [Kind.OBJECT]: "object",
99
112
  [Kind.OPERATION_DEFINITION]: "operation",
100
- [Kind.FIELD]: "field"
113
+ [Kind.OPERATION_TYPE_DEFINITION]: "operation type",
114
+ [Kind.SCALAR_TYPE_DEFINITION]: "scalar",
115
+ [Kind.SCALAR_TYPE_EXTENSION]: "scalar",
116
+ [Kind.SCHEMA_DEFINITION]: "schema",
117
+ [Kind.SCHEMA_EXTENSION]: "schema",
118
+ [Kind.SELECTION_SET]: "selection set",
119
+ [Kind.STRING]: "string",
120
+ [Kind.UNION_TYPE_DEFINITION]: "union",
121
+ [Kind.UNION_TYPE_EXTENSION]: "union",
122
+ [Kind.VARIABLE_DEFINITION]: "variable",
123
+ [Kind.VARIABLE]: "variable"
101
124
  };
102
125
  function displayNodeName(node) {
103
126
  return `${node.kind === Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
@@ -136,9 +159,9 @@ export {
136
159
  getNodeName,
137
160
  getTypeName,
138
161
  logger,
139
- normalizePath,
140
162
  pascalCase,
141
163
  requireGraphQLSchemaFromContext,
142
164
  requireSiblingsOperations,
165
+ slash,
143
166
  truthy
144
167
  };
package/index.browser.js CHANGED
@@ -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",
@@ -427,7 +427,7 @@ var chalk = {
427
427
  // eslint-disable-next-line no-console
428
428
  console.warn(chalk.yellow("warning"), "[graphql-eslint]", ...args)
429
429
  )
430
- }, 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 = [
431
431
  Kind2.OBJECT_TYPE_DEFINITION,
432
432
  Kind2.INTERFACE_TYPE_DEFINITION,
433
433
  Kind2.ENUM_TYPE_DEFINITION,
@@ -476,26 +476,49 @@ function truthy(value) {
476
476
  return !!value;
477
477
  }
478
478
  var DisplayNodeNameMap = {
479
- [Kind2.OBJECT_TYPE_DEFINITION]: "type",
480
- [Kind2.OBJECT_TYPE_EXTENSION]: "type",
481
- [Kind2.INTERFACE_TYPE_DEFINITION]: "interface",
482
- [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",
483
484
  [Kind2.ENUM_TYPE_DEFINITION]: "enum",
484
485
  [Kind2.ENUM_TYPE_EXTENSION]: "enum",
485
- [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",
486
494
  [Kind2.INPUT_OBJECT_TYPE_DEFINITION]: "input",
487
495
  [Kind2.INPUT_OBJECT_TYPE_EXTENSION]: "input",
488
- [Kind2.UNION_TYPE_DEFINITION]: "union",
489
- [Kind2.UNION_TYPE_EXTENSION]: "union",
490
- [Kind2.DIRECTIVE_DEFINITION]: "directive",
491
- [Kind2.FIELD_DEFINITION]: "field",
492
- [Kind2.ENUM_VALUE_DEFINITION]: "enum value",
493
496
  [Kind2.INPUT_VALUE_DEFINITION]: "input value",
494
- [Kind2.ARGUMENT]: "argument",
495
- [Kind2.VARIABLE]: "variable",
496
- [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",
497
510
  [Kind2.OPERATION_DEFINITION]: "operation",
498
- [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"
499
522
  };
500
523
  function displayNodeName(node) {
501
524
  return `${node.kind === Kind2.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
@@ -664,7 +687,7 @@ var parser = {
664
687
  }
665
688
  };
666
689
 
667
- // src/rules/alphabetize.ts
690
+ // src/rules/alphabetize/index.ts
668
691
  import {
669
692
  Kind as Kind4
670
693
  } from "graphql";
@@ -726,7 +749,14 @@ var RULE_ID = "alphabetize", fieldsEnum = [
726
749
  groups: {
727
750
  ...ARRAY_DEFAULT_OPTIONS,
728
751
  minItems: 2,
729
- 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
+ `)
730
760
  }
731
761
  }
732
762
  }
@@ -848,7 +878,7 @@ var RULE_ID = "alphabetize", fieldsEnum = [
848
878
  selections: selectionsEnum,
849
879
  variables: !0,
850
880
  arguments: [Kind4.FIELD, Kind4.DIRECTIVE],
851
- groups: ["id", "*", "createdAt", "updatedAt"]
881
+ groups: ["...", "id", "*", "{"]
852
882
  }
853
883
  ]
854
884
  }
@@ -886,19 +916,17 @@ var RULE_ID = "alphabetize", fieldsEnum = [
886
916
  }
887
917
  function checkNodes(nodes = []) {
888
918
  for (let i = 1; i < nodes.length; i += 1) {
889
- 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);
890
920
  if (!currName)
891
921
  continue;
892
- 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);
893
923
  if (prevName) {
894
924
  let compareResult = prevName.localeCompare(currName), { groups } = opts, shouldSortByGroup = !1;
895
925
  if (groups?.length) {
896
926
  if (!groups.includes("*"))
897
927
  throw new Error("`groups` option should contain `*` string.");
898
- let indexForPrev = groups.indexOf(prevName);
899
- indexForPrev === -1 && (indexForPrev = groups.indexOf("*"));
900
- let indexForCurr = groups.indexOf(currName);
901
- 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)
902
930
  continue;
903
931
  }
904
932
  if (!shouldSortByGroup && !(compareResult === 1) && (!(compareResult === 0) || !prevNode.kind.endsWith("Extension") || currNode.kind.endsWith("Extension")))
@@ -958,8 +986,19 @@ var RULE_ID = "alphabetize", fieldsEnum = [
958
986
  }), listeners;
959
987
  }
960
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
+ }
961
1000
 
962
- // src/rules/description-style.ts
1001
+ // src/rules/description-style/index.ts
963
1002
  var schema2 = {
964
1003
  type: "array",
965
1004
  maxItems: 1,
@@ -1647,7 +1686,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1647
1686
  )
1648
1687
  );
1649
1688
 
1650
- // src/rules/input-name.ts
1689
+ // src/rules/input-name/index.ts
1651
1690
  import {
1652
1691
  Kind as Kind6
1653
1692
  } from "graphql";
@@ -1781,7 +1820,7 @@ Using the same name for all input parameters will make your schemas easier to co
1781
1820
  }
1782
1821
  };
1783
1822
 
1784
- // src/rules/lone-executable-definition.ts
1823
+ // src/rules/lone-executable-definition/index.ts
1785
1824
  import { OperationTypeNode as OperationTypeNode2 } from "graphql";
1786
1825
  var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...Object.values(OperationTypeNode2)], schema4 = {
1787
1826
  type: "array",
@@ -1863,7 +1902,7 @@ var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...O
1863
1902
  }
1864
1903
  };
1865
1904
 
1866
- // src/rules/match-document-filename.ts
1905
+ // src/rules/match-document-filename/index.ts
1867
1906
  import { basename, extname } from "node:path";
1868
1907
  import { Kind as Kind7 } from "graphql";
1869
1908
  var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLES = [
@@ -2091,7 +2130,7 @@ var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLE
2091
2130
  }
2092
2131
  };
2093
2132
 
2094
- // src/rules/naming-convention.ts
2133
+ // src/rules/naming-convention/index.ts
2095
2134
  import { Kind as Kind8 } from "graphql";
2096
2135
  var KindToDisplayName = {
2097
2136
  // types
@@ -2485,7 +2524,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
2485
2524
  }
2486
2525
  };
2487
2526
 
2488
- // src/rules/no-anonymous-operations.ts
2527
+ // src/rules/no-anonymous-operations/index.ts
2489
2528
  import { Kind as Kind9 } from "graphql";
2490
2529
  var RULE_ID3 = "no-anonymous-operations", rule7 = {
2491
2530
  meta: {
@@ -2554,7 +2593,7 @@ var RULE_ID3 = "no-anonymous-operations", rule7 = {
2554
2593
  }
2555
2594
  };
2556
2595
 
2557
- // src/rules/no-deprecated.ts
2596
+ // src/rules/no-deprecated/index.ts
2558
2597
  import { Kind as Kind10 } from "graphql";
2559
2598
  var RULE_ID4 = "no-deprecated", rule8 = {
2560
2599
  meta: {
@@ -2675,7 +2714,7 @@ var RULE_ID4 = "no-deprecated", rule8 = {
2675
2714
  }
2676
2715
  };
2677
2716
 
2678
- // src/rules/no-duplicate-fields.ts
2717
+ // src/rules/no-duplicate-fields/index.ts
2679
2718
  import { Kind as Kind11 } from "graphql";
2680
2719
  var RULE_ID5 = "no-duplicate-fields", rule9 = {
2681
2720
  meta: {
@@ -2789,7 +2828,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
2789
2828
  }
2790
2829
  };
2791
2830
 
2792
- // src/rules/no-hashtag-description.ts
2831
+ // src/rules/no-hashtag-description/index.ts
2793
2832
  import { TokenKind as TokenKind2 } from "graphql";
2794
2833
  var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
2795
2834
  meta: {
@@ -2892,7 +2931,7 @@ var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
2892
2931
  }
2893
2932
  };
2894
2933
 
2895
- // src/rules/no-one-place-fragments.ts
2934
+ // src/rules/no-one-place-fragments/index.ts
2896
2935
  import { relative } from "node:path";
2897
2936
  import { visit as visit4 } from "graphql";
2898
2937
  var RULE_ID7 = "no-one-place-fragments", rule11 = {
@@ -2972,7 +3011,7 @@ var RULE_ID7 = "no-one-place-fragments", rule11 = {
2972
3011
  }
2973
3012
  };
2974
3013
 
2975
- // src/rules/no-root-type.ts
3014
+ // src/rules/no-root-type/index.ts
2976
3015
  var schema7 = {
2977
3016
  type: "array",
2978
3017
  minItems: 1,
@@ -3052,7 +3091,7 @@ var schema7 = {
3052
3091
  }
3053
3092
  };
3054
3093
 
3055
- // src/rules/no-scalar-result-type-on-mutation.ts
3094
+ // src/rules/no-scalar-result-type-on-mutation/index.ts
3056
3095
  import { isScalarType, Kind as Kind12 } from "graphql";
3057
3096
  var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3058
3097
  meta: {
@@ -3118,7 +3157,7 @@ var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3118
3157
  }
3119
3158
  };
3120
3159
 
3121
- // src/rules/no-typename-prefix.ts
3160
+ // src/rules/no-typename-prefix/index.ts
3122
3161
  var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
3123
3162
  meta: {
3124
3163
  type: "suggestion",
@@ -3187,7 +3226,7 @@ var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
3187
3226
  }
3188
3227
  };
3189
3228
 
3190
- // src/rules/no-unreachable-types.ts
3229
+ // src/rules/no-unreachable-types/index.ts
3191
3230
  import {
3192
3231
  DirectiveLocation,
3193
3232
  isInterfaceType,
@@ -3338,7 +3377,7 @@ var rule15 = {
3338
3377
  }
3339
3378
  };
3340
3379
 
3341
- // src/rules/no-unused-fields.ts
3380
+ // src/rules/no-unused-fields/index.ts
3342
3381
  import { TypeInfo as TypeInfo2, visit as visit6, visitWithTypeInfo as visitWithTypeInfo2 } from "graphql";
3343
3382
  var RULE_ID10 = "no-unused-fields", usedFieldsCache = new ModuleCache();
3344
3383
  function getUsedFields(schema15, operations) {
@@ -3448,7 +3487,7 @@ var rule16 = {
3448
3487
  }
3449
3488
  };
3450
3489
 
3451
- // src/rules/relay-arguments.ts
3490
+ // src/rules/relay-arguments/index.ts
3452
3491
  import { isScalarType as isScalarType2, Kind as Kind14 } from "graphql";
3453
3492
  var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema8 = {
3454
3493
  type: "array",
@@ -3551,7 +3590,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3551
3590
  }
3552
3591
  };
3553
3592
 
3554
- // src/rules/relay-connection-types.ts
3593
+ // src/rules/relay-connection-types/index.ts
3555
3594
  import { Kind as Kind15 } from "graphql";
3556
3595
  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 = [
3557
3596
  Kind15.SCALAR_TYPE_DEFINITION,
@@ -3638,7 +3677,7 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
3638
3677
  }
3639
3678
  };
3640
3679
 
3641
- // src/rules/relay-edge-types.ts
3680
+ // src/rules/relay-edge-types/index.ts
3642
3681
  import {
3643
3682
  isObjectType as isObjectType2,
3644
3683
  isScalarType as isScalarType3,
@@ -3782,7 +3821,7 @@ var schema9 = {
3782
3821
  }
3783
3822
  };
3784
3823
 
3785
- // src/rules/relay-page-info.ts
3824
+ // src/rules/relay-page-info/index.ts
3786
3825
  import { isScalarType as isScalarType4, Kind as Kind17 } from "graphql";
3787
3826
  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 = {
3788
3827
  meta: {
@@ -3855,7 +3894,7 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3855
3894
  }
3856
3895
  };
3857
3896
 
3858
- // src/rules/require-deprecation-date.ts
3897
+ // src/rules/require-deprecation-date/index.ts
3859
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 = {
3860
3899
  type: "array",
3861
3900
  maxItems: 1,
@@ -3980,7 +4019,7 @@ var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIR
3980
4019
  }
3981
4020
  };
3982
4021
 
3983
- // src/rules/require-deprecation-reason.ts
4022
+ // src/rules/require-deprecation-reason/index.ts
3984
4023
  var rule22 = {
3985
4024
  meta: {
3986
4025
  docs: {
@@ -4042,7 +4081,7 @@ var rule22 = {
4042
4081
  }
4043
4082
  };
4044
4083
 
4045
- // src/rules/require-description.ts
4084
+ // src/rules/require-description/index.ts
4046
4085
  import { Kind as Kind18, TokenKind as TokenKind3 } from "graphql";
4047
4086
  import { getRootTypeNames } from "@graphql-tools/utils";
4048
4087
  var RULE_ID14 = "require-description", ALLOWED_KINDS2 = [
@@ -4197,7 +4236,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4197
4236
  }
4198
4237
  };
4199
4238
 
4200
- // src/rules/require-field-of-type-query-in-mutation-result.ts
4239
+ // src/rules/require-field-of-type-query-in-mutation-result/index.ts
4201
4240
  import { isObjectType as isObjectType3 } from "graphql";
4202
4241
  var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
4203
4242
  meta: {
@@ -4262,7 +4301,7 @@ var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
4262
4301
  }
4263
4302
  };
4264
4303
 
4265
- // src/rules/require-import-fragment.ts
4304
+ // src/rules/require-import-fragment/index.ts
4266
4305
  import path from "node:path";
4267
4306
  var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expression", rule25 = {
4268
4307
  meta: {
@@ -4376,7 +4415,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4376
4415
  }
4377
4416
  };
4378
4417
 
4379
- // src/rules/require-nullable-fields-with-oneof.ts
4418
+ // src/rules/require-nullable-fields-with-oneof/index.ts
4380
4419
  import { Kind as Kind19 } from "graphql";
4381
4420
  var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4382
4421
  meta: {
@@ -4435,7 +4474,7 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4435
4474
  }
4436
4475
  };
4437
4476
 
4438
- // src/rules/require-nullable-result-in-root.ts
4477
+ // src/rules/require-nullable-result-in-root/index.ts
4439
4478
  import { Kind as Kind20 } from "graphql";
4440
4479
  var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4441
4480
  meta: {
@@ -4512,7 +4551,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4512
4551
  }
4513
4552
  };
4514
4553
 
4515
- // src/rules/require-selections.ts
4554
+ // src/rules/require-selections/index.ts
4516
4555
  import {
4517
4556
  GraphQLInterfaceType,
4518
4557
  GraphQLObjectType,
@@ -4545,7 +4584,6 @@ var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema12 = {
4545
4584
  }, rule28 = {
4546
4585
  meta: {
4547
4586
  type: "suggestion",
4548
- // eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- false positive since we assign `problem.suggest` conditionally
4549
4587
  hasSuggestions: !0,
4550
4588
  docs: {
4551
4589
  category: "Operations",
@@ -4698,7 +4736,7 @@ Include it in your selection set{{ addition }}.`
4698
4736
  }
4699
4737
  };
4700
4738
 
4701
- // src/rules/require-type-pattern-with-oneof.ts
4739
+ // src/rules/require-type-pattern-with-oneof/index.ts
4702
4740
  var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
4703
4741
  meta: {
4704
4742
  type: "suggestion",
@@ -4758,7 +4796,7 @@ var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
4758
4796
  }
4759
4797
  };
4760
4798
 
4761
- // src/rules/selection-set-depth.ts
4799
+ // src/rules/selection-set-depth/index.ts
4762
4800
  import { Kind as Kind22 } from "graphql";
4763
4801
  import depthLimit from "graphql-depth-limit";
4764
4802
  var RULE_ID21 = "selection-set-depth", schema13 = {
@@ -4888,7 +4926,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
4888
4926
  }
4889
4927
  };
4890
4928
 
4891
- // src/rules/strict-id-in-types.ts
4929
+ // src/rules/strict-id-in-types/index.ts
4892
4930
  import { Kind as Kind23 } from "graphql";
4893
4931
  var RULE_ID22 = "strict-id-in-types", schema14 = {
4894
4932
  type: "array",
@@ -5033,7 +5071,7 @@ Accepted type${pluralTypesSuffix}: ${englishJoinWords(options.acceptedIdTypes)}.
5033
5071
  }
5034
5072
  };
5035
5073
 
5036
- // src/rules/unique-enum-value-names.ts
5074
+ // src/rules/unique-enum-value-names/index.ts
5037
5075
  import { Kind as Kind24 } from "graphql";
5038
5076
  var rule32 = {
5039
5077
  meta: {
@@ -5102,12 +5140,12 @@ var rule32 = {
5102
5140
  }
5103
5141
  };
5104
5142
 
5105
- // src/rules/unique-fragment-name.ts
5143
+ // src/rules/unique-fragment-name/index.ts
5106
5144
  import { relative as relative2 } from "node:path";
5107
5145
  import { Kind as Kind25 } from "graphql";
5108
5146
  var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
5109
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) => {
5110
- let isSameName = f.document.name?.value === documentName, isSamePath = normalizePath(f.filePath) === normalizePath(filepath);
5148
+ let isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
5111
5149
  return isSameName && !isSamePath;
5112
5150
  });
5113
5151
  conflictingDocuments.length > 0 && context.report({
@@ -5185,7 +5223,7 @@ var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
5185
5223
  }
5186
5224
  };
5187
5225
 
5188
- // src/rules/unique-operation-name.ts
5226
+ // src/rules/unique-operation-name/index.ts
5189
5227
  var RULE_ID24 = "unique-operation-name", rule34 = {
5190
5228
  meta: {
5191
5229
  type: "suggestion",
@@ -5301,16 +5339,26 @@ var import_operations_all = __toESM(require_operations_all(), 1), import_operati
5301
5339
  "schema-relay": import_schema_relay.default,
5302
5340
  "operations-recommended": import_operations_recommended.default,
5303
5341
  "operations-all": import_operations_all.default,
5304
- "flat/schema-recommended": import_schema_recommended.default.rules,
5342
+ "flat/schema-recommended": {
5343
+ rules: import_schema_recommended.default.rules
5344
+ },
5305
5345
  "flat/schema-all": {
5306
- ...import_schema_recommended.default.rules,
5307
- ...import_schema_all.default.rules
5346
+ rules: {
5347
+ ...import_schema_recommended.default.rules,
5348
+ ...import_schema_all.default.rules
5349
+ }
5350
+ },
5351
+ "flat/schema-relay": {
5352
+ rules: import_schema_relay.default.rules
5353
+ },
5354
+ "flat/operations-recommended": {
5355
+ rules: import_operations_recommended.default.rules
5308
5356
  },
5309
- "flat/schema-relay": import_schema_relay.default.rules,
5310
- "flat/operations-recommended": import_operations_recommended.default.rules,
5311
5357
  "flat/operations-all": {
5312
- ...import_operations_recommended.default.rules,
5313
- ...import_operations_all.default.rules
5358
+ rules: {
5359
+ ...import_operations_recommended.default.rules,
5360
+ ...import_operations_all.default.rules
5361
+ }
5314
5362
  }
5315
5363
  };
5316
5364
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.8",
4
4
  "type": "module",
5
5
  "description": "GraphQL plugin for ESLint",
6
6
  "repository": "https://github.com/B2o5T/graphql-eslint",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@graphql-tools/code-file-loader": "^8.0.0",
38
- "@graphql-tools/graphql-tag-pluck": "8.3.3",
38
+ "@graphql-tools/graphql-tag-pluck": "8.3.4",
39
39
  "@graphql-tools/utils": "^10.0.0",
40
40
  "debug": "^4.3.4",
41
41
  "fast-glob": "^3.2.12",