@graphql-eslint/eslint-plugin 4.0.0-alpha-20230801163310-8bc4340 → 4.0.0-alpha-20230810155929-e89edf7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. package/README.md +2 -0
  2. package/cjs/cache.js +10 -19
  3. package/cjs/configs/index.d.ts +42 -16
  4. package/cjs/configs/index.js +10 -19
  5. package/cjs/configs/operations-all.d.ts +4 -3
  6. package/cjs/configs/operations-all.js +5 -4
  7. package/cjs/configs/operations-recommended.d.ts +3 -1
  8. package/cjs/configs/operations-recommended.js +3 -1
  9. package/cjs/configs/schema-all.d.ts +6 -1
  10. package/cjs/configs/schema-all.js +5 -2
  11. package/cjs/configs/schema-recommended.d.ts +19 -1
  12. package/cjs/configs/schema-recommended.js +22 -2
  13. package/cjs/documents.js +17 -32
  14. package/cjs/estree-converter/converter.js +14 -27
  15. package/cjs/estree-converter/index.js +4 -7
  16. package/cjs/estree-converter/types.js +3 -5
  17. package/cjs/estree-converter/utils.d.ts +2 -3
  18. package/cjs/estree-converter/utils.js +15 -45
  19. package/cjs/flat-configs.d.ts +59 -12
  20. package/cjs/flat-configs.js +9 -14
  21. package/cjs/graphql-config.d.ts +4 -3
  22. package/cjs/graphql-config.js +23 -44
  23. package/cjs/index.d.ts +10 -4
  24. package/cjs/index.js +8 -16
  25. package/cjs/parser.d.ts +4 -3
  26. package/cjs/parser.js +38 -45
  27. package/cjs/processor.d.ts +5 -1
  28. package/cjs/processor.js +25 -57
  29. package/cjs/rules/alphabetize.d.ts +6 -16
  30. package/cjs/rules/alphabetize.js +60 -132
  31. package/cjs/rules/description-style.d.ts +4 -3
  32. package/cjs/rules/description-style.js +11 -18
  33. package/cjs/rules/graphql-js-validation.d.ts +4 -3
  34. package/cjs/rules/graphql-js-validation.js +151 -225
  35. package/cjs/rules/index.d.ts +15 -13
  36. package/cjs/rules/index.js +8 -45
  37. package/cjs/rules/input-name.d.ts +4 -3
  38. package/cjs/rules/input-name.js +43 -59
  39. package/cjs/rules/lone-executable-definition.d.ts +6 -5
  40. package/cjs/rules/lone-executable-definition.js +14 -28
  41. package/cjs/rules/match-document-filename.d.ts +4 -3
  42. package/cjs/rules/match-document-filename.js +39 -70
  43. package/cjs/rules/naming-convention.d.ts +4 -3
  44. package/cjs/rules/naming-convention.js +56 -74
  45. package/cjs/rules/no-anonymous-operations.d.ts +4 -3
  46. package/cjs/rules/no-anonymous-operations.js +11 -18
  47. package/cjs/rules/no-deprecated.d.ts +4 -3
  48. package/cjs/rules/no-deprecated.js +15 -29
  49. package/cjs/rules/no-duplicate-fields.d.ts +4 -3
  50. package/cjs/rules/no-duplicate-fields.js +13 -23
  51. package/cjs/rules/no-hashtag-description.d.ts +4 -3
  52. package/cjs/rules/no-hashtag-description.js +16 -29
  53. package/cjs/rules/no-one-place-fragments.d.ts +4 -3
  54. package/cjs/rules/no-one-place-fragments.js +17 -29
  55. package/cjs/rules/no-root-type.d.ts +4 -3
  56. package/cjs/rules/no-root-type.js +15 -25
  57. package/cjs/rules/no-scalar-result-type-on-mutation.d.ts +4 -3
  58. package/cjs/rules/no-scalar-result-type-on-mutation.js +18 -30
  59. package/cjs/rules/no-typename-prefix.d.ts +4 -3
  60. package/cjs/rules/no-typename-prefix.js +26 -33
  61. package/cjs/rules/no-unreachable-types.d.ts +4 -3
  62. package/cjs/rules/no-unreachable-types.js +25 -47
  63. package/cjs/rules/no-unused-fields.d.ts +4 -3
  64. package/cjs/rules/no-unused-fields.js +24 -49
  65. package/cjs/rules/relay-arguments.d.ts +4 -3
  66. package/cjs/rules/relay-arguments.js +20 -43
  67. package/cjs/rules/relay-connection-types.d.ts +4 -3
  68. package/cjs/rules/relay-connection-types.js +14 -45
  69. package/cjs/rules/relay-edge-types.d.ts +4 -3
  70. package/cjs/rules/relay-edge-types.js +48 -99
  71. package/cjs/rules/relay-page-info.d.ts +4 -3
  72. package/cjs/rules/relay-page-info.js +21 -44
  73. package/cjs/rules/require-deprecation-date.d.ts +4 -3
  74. package/cjs/rules/require-deprecation-date.js +15 -31
  75. package/cjs/rules/require-deprecation-reason.d.ts +4 -3
  76. package/cjs/rules/require-deprecation-reason.js +12 -20
  77. package/cjs/rules/require-description.d.ts +4 -3
  78. package/cjs/rules/require-description.js +39 -65
  79. package/cjs/rules/require-field-of-type-query-in-mutation-result.d.ts +4 -3
  80. package/cjs/rules/require-field-of-type-query-in-mutation-result.js +16 -31
  81. package/cjs/rules/require-import-fragment.d.ts +4 -3
  82. package/cjs/rules/require-import-fragment.js +22 -40
  83. package/cjs/rules/require-nullable-fields-with-oneof.d.ts +4 -3
  84. package/cjs/rules/require-nullable-fields-with-oneof.js +11 -22
  85. package/cjs/rules/require-nullable-result-in-root.d.ts +4 -3
  86. package/cjs/rules/require-nullable-result-in-root.js +34 -44
  87. package/cjs/rules/{require-id-when-available.d.ts → require-selections.d.ts} +4 -3
  88. package/cjs/rules/require-selections.js +198 -0
  89. package/cjs/rules/require-type-pattern-with-oneof.d.ts +4 -3
  90. package/cjs/rules/require-type-pattern-with-oneof.js +15 -23
  91. package/cjs/rules/selection-set-depth.d.ts +4 -3
  92. package/cjs/rules/selection-set-depth.js +18 -34
  93. package/cjs/rules/strict-id-in-types.d.ts +4 -3
  94. package/cjs/rules/strict-id-in-types.js +25 -43
  95. package/cjs/rules/{no-case-insensitive-enum-values-duplicates.d.ts → unique-enum-value-names.d.ts} +4 -3
  96. package/cjs/rules/{no-case-insensitive-enum-values-duplicates.js → unique-enum-value-names.js} +16 -21
  97. package/cjs/rules/unique-fragment-name.d.ts +3 -2
  98. package/cjs/rules/unique-fragment-name.js +24 -36
  99. package/cjs/rules/unique-operation-name.d.ts +4 -3
  100. package/cjs/rules/unique-operation-name.js +10 -12
  101. package/cjs/schema.d.ts +4 -3
  102. package/cjs/schema.js +14 -27
  103. package/cjs/siblings.d.ts +24 -8
  104. package/cjs/siblings.js +42 -82
  105. package/cjs/types.d.ts +74 -7
  106. package/cjs/types.js +3 -5
  107. package/cjs/utils.d.ts +3 -2
  108. package/cjs/utils.js +27 -44
  109. package/esm/cache.js +4 -8
  110. package/esm/{chunk-BMTV3EA2.js → chunk-U3TKCM4X.js} +1 -1
  111. package/esm/configs/index.d.mts +42 -16
  112. package/esm/configs/index.js +4 -4
  113. package/esm/configs/operations-all.d.mts +4 -3
  114. package/esm/configs/operations-all.js +6 -5
  115. package/esm/configs/operations-recommended.d.mts +3 -1
  116. package/esm/configs/operations-recommended.js +4 -2
  117. package/esm/configs/schema-all.d.mts +6 -1
  118. package/esm/configs/schema-all.js +6 -3
  119. package/esm/configs/schema-recommended.d.mts +19 -1
  120. package/esm/configs/schema-recommended.js +23 -3
  121. package/esm/configs/{relay.js → schema-relay.js} +4 -4
  122. package/esm/documents.js +10 -17
  123. package/esm/estree-converter/converter.js +9 -18
  124. package/esm/estree-converter/utils.d.mts +2 -3
  125. package/esm/estree-converter/utils.js +11 -38
  126. package/esm/flat-configs.d.mts +59 -12
  127. package/esm/flat-configs.js +4 -5
  128. package/esm/graphql-config.d.mts +4 -3
  129. package/esm/graphql-config.js +18 -34
  130. package/esm/index.d.mts +10 -4
  131. package/esm/index.js +1 -1
  132. package/esm/parser.d.mts +4 -3
  133. package/esm/parser.js +33 -27
  134. package/esm/processor.d.mts +5 -1
  135. package/esm/processor.js +21 -46
  136. package/esm/rules/alphabetize.d.mts +6 -16
  137. package/esm/rules/alphabetize.js +53 -118
  138. package/esm/rules/description-style.d.mts +4 -3
  139. package/esm/rules/description-style.js +7 -11
  140. package/esm/rules/graphql-js-validation.d.mts +4 -3
  141. package/esm/rules/graphql-js-validation.js +178 -218
  142. package/esm/rules/index.d.mts +15 -13
  143. package/esm/rules/index.js +5 -5
  144. package/esm/rules/input-name.d.mts +4 -3
  145. package/esm/rules/input-name.js +39 -52
  146. package/esm/rules/lone-executable-definition.d.mts +6 -5
  147. package/esm/rules/lone-executable-definition.js +10 -20
  148. package/esm/rules/match-document-filename.d.mts +4 -3
  149. package/esm/rules/match-document-filename.js +35 -61
  150. package/esm/rules/naming-convention.d.mts +4 -3
  151. package/esm/rules/naming-convention.js +51 -65
  152. package/esm/rules/no-anonymous-operations.d.mts +4 -3
  153. package/esm/rules/no-anonymous-operations.js +6 -9
  154. package/esm/rules/no-deprecated.d.mts +4 -3
  155. package/esm/rules/no-deprecated.js +10 -20
  156. package/esm/rules/no-duplicate-fields.d.mts +4 -3
  157. package/esm/rules/no-duplicate-fields.js +9 -16
  158. package/esm/rules/no-hashtag-description.d.mts +4 -3
  159. package/esm/rules/no-hashtag-description.js +11 -20
  160. package/esm/rules/no-one-place-fragments.d.mts +4 -3
  161. package/esm/rules/no-one-place-fragments.js +12 -19
  162. package/esm/rules/no-root-type.d.mts +4 -3
  163. package/esm/rules/no-root-type.js +11 -18
  164. package/esm/rules/no-scalar-result-type-on-mutation.d.mts +4 -3
  165. package/esm/rules/no-scalar-result-type-on-mutation.js +13 -21
  166. package/esm/rules/no-typename-prefix.d.mts +4 -3
  167. package/esm/rules/no-typename-prefix.js +22 -26
  168. package/esm/rules/no-unreachable-types.d.mts +4 -3
  169. package/esm/rules/no-unreachable-types.js +18 -33
  170. package/esm/rules/no-unused-fields.d.mts +4 -3
  171. package/esm/rules/no-unused-fields.js +19 -40
  172. package/esm/rules/relay-arguments.d.mts +4 -3
  173. package/esm/rules/relay-arguments.js +15 -34
  174. package/esm/rules/relay-connection-types.d.mts +4 -3
  175. package/esm/rules/relay-connection-types.js +10 -38
  176. package/esm/rules/relay-edge-types.d.mts +4 -3
  177. package/esm/rules/relay-edge-types.js +43 -89
  178. package/esm/rules/relay-page-info.d.mts +4 -3
  179. package/esm/rules/relay-page-info.js +16 -34
  180. package/esm/rules/require-deprecation-date.d.mts +4 -3
  181. package/esm/rules/require-deprecation-date.js +10 -22
  182. package/esm/rules/require-deprecation-reason.d.mts +4 -3
  183. package/esm/rules/require-deprecation-reason.js +7 -11
  184. package/esm/rules/require-description.d.mts +4 -3
  185. package/esm/rules/require-description.js +34 -55
  186. package/esm/rules/require-field-of-type-query-in-mutation-result.d.mts +4 -3
  187. package/esm/rules/require-field-of-type-query-in-mutation-result.js +11 -22
  188. package/esm/rules/require-import-fragment.d.mts +4 -3
  189. package/esm/rules/require-import-fragment.js +14 -26
  190. package/esm/rules/require-nullable-fields-with-oneof.d.mts +4 -3
  191. package/esm/rules/require-nullable-fields-with-oneof.js +6 -13
  192. package/esm/rules/require-nullable-result-in-root.d.mts +4 -3
  193. package/esm/rules/require-nullable-result-in-root.js +29 -35
  194. package/esm/rules/{require-id-when-available.d.mts → require-selections.d.mts} +4 -3
  195. package/esm/rules/{require-id-when-available.js → require-selections.js} +43 -80
  196. package/esm/rules/require-type-pattern-with-oneof.d.mts +4 -3
  197. package/esm/rules/require-type-pattern-with-oneof.js +11 -16
  198. package/esm/rules/selection-set-depth.d.mts +4 -3
  199. package/esm/rules/selection-set-depth.js +11 -20
  200. package/esm/rules/strict-id-in-types.d.mts +4 -3
  201. package/esm/rules/strict-id-in-types.js +20 -34
  202. package/esm/rules/{no-case-insensitive-enum-values-duplicates.d.mts → unique-enum-value-names.d.mts} +4 -3
  203. package/esm/rules/{no-case-insensitive-enum-values-duplicates.js → unique-enum-value-names.js} +8 -9
  204. package/esm/rules/unique-fragment-name.d.mts +3 -2
  205. package/esm/rules/unique-fragment-name.js +20 -27
  206. package/esm/rules/unique-operation-name.d.mts +4 -3
  207. package/esm/rules/unique-operation-name.js +6 -5
  208. package/esm/schema.d.mts +4 -3
  209. package/esm/schema.js +7 -12
  210. package/esm/siblings.d.mts +24 -8
  211. package/esm/siblings.js +37 -73
  212. package/esm/types.d.mts +74 -7
  213. package/esm/utils.d.mts +3 -2
  214. package/esm/utils.js +20 -31
  215. package/index.browser.mjs +5323 -0
  216. package/package.json +8 -13
  217. package/cjs/rules/require-id-when-available.js +0 -241
  218. package/cjs/types-8d5f4ae0.d.ts +0 -107
  219. package/esm/types-ace77d86.d.ts +0 -107
  220. /package/cjs/configs/{relay.d.ts → schema-relay.d.ts} +0 -0
  221. /package/cjs/configs/{relay.js → schema-relay.js} +0 -0
  222. /package/esm/configs/{relay.d.mts → schema-relay.d.mts} +0 -0
@@ -4,13 +4,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
7
+ if (from && typeof from == "object" || typeof from == "function")
8
8
  for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
9
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
10
  return to;
13
11
  };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
12
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
13
  var types_exports = {};
16
14
  module.exports = __toCommonJS(types_exports);
@@ -1,14 +1,13 @@
1
1
  import * as graphql_jsutils_Maybe from 'graphql/jsutils/Maybe';
2
2
  import * as graphql_jsutils_ObjMap from 'graphql/jsutils/ObjMap';
3
3
  import * as graphql from 'graphql';
4
- import { GraphQLOutputType, GraphQLNamedType, Token, Location } from 'graphql';
4
+ import { GraphQLOutputType, GraphQLNamedType, TokenKind, Token, Location } from 'graphql';
5
5
  import { AST } from 'eslint';
6
6
  import { Comment, SourceLocation } from 'estree';
7
7
 
8
8
  declare const valueFromNode: (valueNode: graphql.ValueNode, variables?: graphql_jsutils_Maybe.Maybe<graphql_jsutils_ObjMap.ObjMap<unknown>>) => any;
9
9
  declare function getBaseType(type: GraphQLOutputType): GraphQLNamedType;
10
- type TokenKindValue = ':' | '!' | '...' | '(' | ')' | '[' | ']' | '{' | '}' | '@' | '&' | '<SOF>' | '=' | '|' | '$' | 'BlockString' | 'Comment' | 'Float' | 'Int' | 'Name' | 'String';
11
- declare function convertToken<T extends TokenKindValue | 'Block' | 'Line'>(token: Token, type: T): Omit<AST.Token, 'type'> & {
10
+ declare function convertToken<T extends TokenKind | 'Block' | 'Line'>(token: Token, type: T): Omit<AST.Token, 'type'> & {
12
11
  type: T;
13
12
  };
14
13
  declare function extractTokens(filePath: string, code: string): AST.Token[];
@@ -5,17 +5,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
12
11
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
13
  return to;
17
14
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
16
  var utils_exports = {};
20
17
  __export(utils_exports, {
21
18
  convertLocation: () => convertLocation,
@@ -26,22 +23,15 @@ __export(utils_exports, {
26
23
  valueFromNode: () => valueFromNode
27
24
  });
28
25
  module.exports = __toCommonJS(utils_exports);
29
- var import_graphql = require("graphql");
30
- var import_valueFromASTUntyped = require("graphql/utilities/valueFromASTUntyped.js");
31
- const valueFromNode = (...args) => {
32
- return (0, import_valueFromASTUntyped.valueFromASTUntyped)(...args);
33
- };
26
+ var import_graphql = require("graphql"), import_valueFromASTUntyped = require("graphql/utilities/valueFromASTUntyped.js");
27
+ const valueFromNode = (...args) => (0, import_valueFromASTUntyped.valueFromASTUntyped)(...args);
34
28
  function getBaseType(type) {
35
- if ((0, import_graphql.isNonNullType)(type) || (0, import_graphql.isListType)(type)) {
36
- return getBaseType(type.ofType);
37
- }
38
- return type;
29
+ return (0, import_graphql.isNonNullType)(type) || (0, import_graphql.isListType)(type) ? getBaseType(type.ofType) : type;
39
30
  }
40
31
  function convertToken(token, type) {
41
32
  const { line, column, end, start, value } = token;
42
33
  return {
43
34
  type,
44
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- TODO: remove `!` when drop support of graphql@15
45
35
  value,
46
36
  /*
47
37
  * ESLint has 0-based column number
@@ -60,41 +50,25 @@ function convertToken(token, type) {
60
50
  range: [start, end]
61
51
  };
62
52
  }
63
- function getLexer(source) {
64
- const gqlLanguage = require("graphql/language");
65
- if (gqlLanguage == null ? void 0 : gqlLanguage.createLexer) {
66
- return gqlLanguage.createLexer(source, {});
67
- }
68
- const { Lexer: LexerCls } = require("graphql");
69
- if (LexerCls && typeof LexerCls === "function") {
70
- return new LexerCls(source);
71
- }
72
- throw new Error("Unsupported GraphQL version! Please make sure to use GraphQL v14 or newer!");
73
- }
74
53
  function extractTokens(filePath, code) {
75
- const source = new import_graphql.Source(code, filePath);
76
- const lexer = getLexer(source);
77
- const tokens = [];
54
+ const source = new import_graphql.Source(code, filePath), lexer = new import_graphql.Lexer(source), tokens = [];
78
55
  let token = lexer.advance();
79
- while (token && token.kind !== import_graphql.TokenKind.EOF) {
56
+ for (; token && token.kind !== import_graphql.TokenKind.EOF; ) {
80
57
  const result = convertToken(token, token.kind);
81
- tokens.push(result);
82
- token = lexer.advance();
58
+ tokens.push(result), token = lexer.advance();
83
59
  }
84
60
  return tokens;
85
61
  }
86
62
  function extractComments(loc) {
87
- if (!loc) {
63
+ if (!loc)
88
64
  return [];
89
- }
90
65
  const comments = [];
91
66
  let token = loc.startToken;
92
- while (token) {
67
+ for (; token; ) {
93
68
  if (token.kind === import_graphql.TokenKind.COMMENT) {
94
69
  const comment = convertToken(
95
70
  token,
96
71
  // `eslint-disable` directive works only with `Block` type comment
97
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- TODO: remove `!` when drop support of graphql@15
98
72
  token.value.trimStart().startsWith("eslint") ? "Block" : "Line"
99
73
  );
100
74
  comments.push(comment);
@@ -104,8 +78,7 @@ function extractComments(loc) {
104
78
  return comments;
105
79
  }
106
80
  function convertLocation(location) {
107
- const { startToken, endToken, source, start, end } = location;
108
- const loc = {
81
+ const { startToken, endToken, source, start, end } = location, loc = {
109
82
  start: {
110
83
  /*
111
84
  * Kind.Document has startToken: { line: 0, column: 0 }, we set line as 1 and column as 0
@@ -119,10 +92,7 @@ function convertLocation(location) {
119
92
  },
120
93
  source: source.body
121
94
  };
122
- if (loc.start.column === loc.end.column) {
123
- loc.end.column += end - start;
124
- }
125
- return loc;
95
+ return loc.start.column === loc.end.column && (loc.end.column += end - start), loc;
126
96
  }
127
97
  // Annotate the CommonJS export names for ESM import in node:
128
98
  0 && (module.exports = {
@@ -1,12 +1,13 @@
1
1
  import { parseForESLint } from './parser.js';
2
- import './types-8d5f4ae0.js';
3
- import '@graphql-tools/utils';
2
+ import './types.js';
4
3
  import 'eslint';
5
4
  import 'estree';
6
5
  import 'graphql';
7
- import 'graphql-config';
8
6
  import 'json-schema-to-ts';
7
+ import './siblings.js';
8
+ import '@graphql-tools/utils';
9
9
  import './estree-converter/types.js';
10
+ import 'graphql-config';
10
11
 
11
12
  declare const flatConfigs: {
12
13
  'operations-all': {
@@ -17,9 +18,11 @@ declare const flatConfigs: {
17
18
  };
18
19
  rules: {
19
20
  '@graphql-eslint/alphabetize': (string | {
21
+ definitions: boolean;
20
22
  selections: string[];
21
- variables: string[];
23
+ variables: boolean;
22
24
  arguments: string[];
25
+ groups: string[];
23
26
  })[];
24
27
  '@graphql-eslint/lone-executable-definition': string;
25
28
  '@graphql-eslint/match-document-filename': (string | {
@@ -29,8 +32,7 @@ declare const flatConfigs: {
29
32
  fragment: string;
30
33
  })[];
31
34
  '@graphql-eslint/no-one-place-fragments': string;
32
- '@graphql-eslint/unique-fragment-name': string;
33
- '@graphql-eslint/unique-operation-name': string;
35
+ '@graphql-eslint/require-import-fragment': string;
34
36
  '@graphql-eslint/executable-definitions': string;
35
37
  '@graphql-eslint/fields-on-correct-type': string;
36
38
  '@graphql-eslint/fragments-on-composite-type': string;
@@ -63,14 +65,16 @@ declare const flatConfigs: {
63
65
  '@graphql-eslint/overlapping-fields-can-be-merged': string;
64
66
  '@graphql-eslint/possible-fragment-spread': string;
65
67
  '@graphql-eslint/provided-required-arguments': string;
66
- '@graphql-eslint/require-id-when-available': string;
68
+ '@graphql-eslint/require-selections': string;
67
69
  '@graphql-eslint/scalar-leafs': string;
68
70
  '@graphql-eslint/selection-set-depth': (string | {
69
71
  maxDepth: number;
70
72
  })[];
71
73
  '@graphql-eslint/unique-argument-names': string;
72
74
  '@graphql-eslint/unique-directive-names-per-location': string;
75
+ '@graphql-eslint/unique-fragment-name': string;
73
76
  '@graphql-eslint/unique-input-field-names': string;
77
+ '@graphql-eslint/unique-operation-name': string;
74
78
  '@graphql-eslint/unique-variable-names': string;
75
79
  '@graphql-eslint/value-literals-of-correct-type': string;
76
80
  '@graphql-eslint/variables-are-input-types': string;
@@ -116,21 +120,23 @@ declare const flatConfigs: {
116
120
  '@graphql-eslint/overlapping-fields-can-be-merged': string;
117
121
  '@graphql-eslint/possible-fragment-spread': string;
118
122
  '@graphql-eslint/provided-required-arguments': string;
119
- '@graphql-eslint/require-id-when-available': string;
123
+ '@graphql-eslint/require-selections': string;
120
124
  '@graphql-eslint/scalar-leafs': string;
121
125
  '@graphql-eslint/selection-set-depth': (string | {
122
126
  maxDepth: number;
123
127
  })[];
124
128
  '@graphql-eslint/unique-argument-names': string;
125
129
  '@graphql-eslint/unique-directive-names-per-location': string;
130
+ '@graphql-eslint/unique-fragment-name': string;
126
131
  '@graphql-eslint/unique-input-field-names': string;
132
+ '@graphql-eslint/unique-operation-name': string;
127
133
  '@graphql-eslint/unique-variable-names': string;
128
134
  '@graphql-eslint/value-literals-of-correct-type': string;
129
135
  '@graphql-eslint/variables-are-input-types': string;
130
136
  '@graphql-eslint/variables-in-allowed-position': string;
131
137
  };
132
138
  };
133
- relay: {
139
+ 'schema-relay': {
134
140
  languageOptions: {
135
141
  parser: {
136
142
  parseForESLint: typeof parseForESLint;
@@ -151,11 +157,16 @@ declare const flatConfigs: {
151
157
  };
152
158
  rules: {
153
159
  '@graphql-eslint/alphabetize': (string | {
160
+ definitions: boolean;
154
161
  fields: string[];
155
- values: string[];
162
+ values: boolean;
156
163
  arguments: string[];
164
+ groups: string[];
157
165
  })[];
158
166
  '@graphql-eslint/input-name': string;
167
+ '@graphql-eslint/no-root-type': (string | {
168
+ disallow: string[];
169
+ })[];
159
170
  '@graphql-eslint/no-scalar-result-type-on-mutation': string;
160
171
  '@graphql-eslint/require-deprecation-date': string;
161
172
  '@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
@@ -186,20 +197,38 @@ declare const flatConfigs: {
186
197
  forbiddenPrefixes: string[];
187
198
  forbiddenSuffixes: string[];
188
199
  };
200
+ 'EnumTypeDefinition,EnumTypeExtension': {
201
+ forbiddenPrefixes: string[];
202
+ forbiddenSuffixes: string[];
203
+ };
204
+ 'InterfaceTypeDefinition,InterfaceTypeExtension': {
205
+ forbiddenPrefixes: string[];
206
+ forbiddenSuffixes: string[];
207
+ };
208
+ 'UnionTypeDefinition,UnionTypeExtension': {
209
+ forbiddenPrefixes: string[];
210
+ forbiddenSuffixes: string[];
211
+ };
212
+ 'ObjectTypeDefinition,ObjectTypeExtension': {
213
+ forbiddenPrefixes: string[];
214
+ forbiddenSuffixes: string[];
215
+ };
189
216
  })[];
190
- '@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
191
217
  '@graphql-eslint/no-hashtag-description': string;
192
218
  '@graphql-eslint/no-typename-prefix': string;
193
219
  '@graphql-eslint/no-unreachable-types': string;
220
+ '@graphql-eslint/possible-type-extension': string;
194
221
  '@graphql-eslint/provided-required-arguments': string;
195
222
  '@graphql-eslint/require-deprecation-reason': string;
196
223
  '@graphql-eslint/require-description': (string | {
197
224
  types: boolean;
198
225
  DirectiveDefinition: boolean;
226
+ rootField: boolean;
199
227
  })[];
200
228
  '@graphql-eslint/strict-id-in-types': string;
201
229
  '@graphql-eslint/unique-directive-names': string;
202
230
  '@graphql-eslint/unique-directive-names-per-location': string;
231
+ '@graphql-eslint/unique-enum-value-names': string;
203
232
  '@graphql-eslint/unique-field-definition-names': string;
204
233
  '@graphql-eslint/unique-operation-types': string;
205
234
  '@graphql-eslint/unique-type-names': string;
@@ -236,20 +265,38 @@ declare const flatConfigs: {
236
265
  forbiddenPrefixes: string[];
237
266
  forbiddenSuffixes: string[];
238
267
  };
268
+ 'EnumTypeDefinition,EnumTypeExtension': {
269
+ forbiddenPrefixes: string[];
270
+ forbiddenSuffixes: string[];
271
+ };
272
+ 'InterfaceTypeDefinition,InterfaceTypeExtension': {
273
+ forbiddenPrefixes: string[];
274
+ forbiddenSuffixes: string[];
275
+ };
276
+ 'UnionTypeDefinition,UnionTypeExtension': {
277
+ forbiddenPrefixes: string[];
278
+ forbiddenSuffixes: string[];
279
+ };
280
+ 'ObjectTypeDefinition,ObjectTypeExtension': {
281
+ forbiddenPrefixes: string[];
282
+ forbiddenSuffixes: string[];
283
+ };
239
284
  })[];
240
- '@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
241
285
  '@graphql-eslint/no-hashtag-description': string;
242
286
  '@graphql-eslint/no-typename-prefix': string;
243
287
  '@graphql-eslint/no-unreachable-types': string;
288
+ '@graphql-eslint/possible-type-extension': string;
244
289
  '@graphql-eslint/provided-required-arguments': string;
245
290
  '@graphql-eslint/require-deprecation-reason': string;
246
291
  '@graphql-eslint/require-description': (string | {
247
292
  types: boolean;
248
293
  DirectiveDefinition: boolean;
294
+ rootField: boolean;
249
295
  })[];
250
296
  '@graphql-eslint/strict-id-in-types': string;
251
297
  '@graphql-eslint/unique-directive-names': string;
252
298
  '@graphql-eslint/unique-directive-names-per-location': string;
299
+ '@graphql-eslint/unique-enum-value-names': string;
253
300
  '@graphql-eslint/unique-field-definition-names': string;
254
301
  '@graphql-eslint/unique-operation-types': string;
255
302
  '@graphql-eslint/unique-type-names': string;
@@ -5,28 +5,23 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
12
11
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
13
  return to;
17
14
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
16
  var flat_configs_exports = {};
20
17
  __export(flat_configs_exports, {
21
18
  flatConfigs: () => flatConfigs
22
19
  });
23
20
  module.exports = __toCommonJS(flat_configs_exports);
24
- var import_configs = require("./configs/index.js");
25
- var import_parser = require("./parser.js");
21
+ var import_configs = require("./configs/index.js"), import_parser = require("./parser.js");
26
22
  const languageOptions = {
27
23
  parser: { parseForESLint: import_parser.parseForESLint }
28
- };
29
- const flatConfigs = {
24
+ }, flatConfigs = {
30
25
  "operations-all": {
31
26
  languageOptions,
32
27
  rules: {
@@ -38,9 +33,9 @@ const flatConfigs = {
38
33
  languageOptions,
39
34
  rules: import_configs.configs["operations-recommended"].rules
40
35
  },
41
- relay: {
36
+ "schema-relay": {
42
37
  languageOptions,
43
- rules: import_configs.configs.relay.rules
38
+ rules: import_configs.configs["schema-relay"].rules
44
39
  },
45
40
  "schema-all": {
46
41
  languageOptions,
@@ -1,13 +1,14 @@
1
1
  import { GraphQLConfig } from 'graphql-config';
2
- import { P as ParserOptions } from './types-8d5f4ae0.js';
3
- import '@graphql-tools/utils';
2
+ import { ParserOptions } from './types.js';
4
3
  import 'eslint';
5
4
  import 'estree';
6
5
  import 'graphql';
7
6
  import 'json-schema-to-ts';
7
+ import './siblings.js';
8
+ import '@graphql-tools/utils';
8
9
  import './estree-converter/types.js';
9
10
 
10
11
  declare function loadOnDiskGraphQLConfig(filePath: string): GraphQLConfig;
11
- declare function loadGraphQLConfig(options: ParserOptions): GraphQLConfig;
12
+ declare function loadGraphQLConfig({ graphQLConfig: config, filePath, }: ParserOptions): GraphQLConfig;
12
13
 
13
14
  export { loadGraphQLConfig, loadOnDiskGraphQLConfig };
@@ -3,18 +3,14 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
9
+ __defProp(target, name, { get: all[name], enumerable: !0 });
10
+ }, __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from == "object" || typeof from == "function")
14
12
  for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
13
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
14
  return to;
19
15
  };
20
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
@@ -22,62 +18,45 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
18
  // file that has been converted to a CommonJS file using a Babel-
23
19
  // compatible transform (i.e. "__esModule" has not been set), then set
24
20
  // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
26
22
  mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
29
24
  var graphql_config_exports = {};
30
25
  __export(graphql_config_exports, {
31
26
  loadGraphQLConfig: () => loadGraphQLConfig,
32
27
  loadOnDiskGraphQLConfig: () => loadOnDiskGraphQLConfig
33
28
  });
34
29
  module.exports = __toCommonJS(graphql_config_exports);
35
- var import_path = require("path");
36
- var import_code_file_loader = require("@graphql-tools/code-file-loader");
37
- var import_debug = __toESM(require("debug"));
38
- var import_graphql_config = require("graphql-config");
30
+ var import_node_path = __toESM(require("node:path")), import_code_file_loader = require("@graphql-tools/code-file-loader"), import_debug = __toESM(require("debug")), import_graphql_config = require("graphql-config");
39
31
  const debug = (0, import_debug.default)("graphql-eslint:graphql-config");
40
32
  let graphQLConfig;
41
33
  function loadOnDiskGraphQLConfig(filePath) {
42
34
  return (0, import_graphql_config.loadConfigSync)({
43
35
  // load config relative to the file being linted
44
- rootDir: (0, import_path.dirname)(filePath),
45
- throwOnEmpty: false,
46
- throwOnMissing: false,
36
+ rootDir: import_node_path.default.dirname(filePath),
37
+ throwOnMissing: !1,
47
38
  extensions: [codeFileLoaderExtension]
48
39
  });
49
40
  }
50
- function loadGraphQLConfig(options) {
51
- if (graphQLConfig) {
41
+ function loadGraphQLConfig({
42
+ graphQLConfig: config,
43
+ filePath
44
+ }) {
45
+ if (graphQLConfig)
52
46
  return graphQLConfig;
53
- }
54
- const onDiskConfig = !options.skipGraphQLConfig && loadOnDiskGraphQLConfig(options.filePath);
55
- debug("options.skipGraphQLConfig: %o", options.skipGraphQLConfig);
56
- if (onDiskConfig) {
57
- debug("Graphql-config path %o", onDiskConfig.filepath);
58
- }
59
- const configOptions = options.projects ? { projects: options.projects } : {
60
- schema: options.schema || "",
47
+ debug("parserOptions.graphQLConfig: %o", config);
48
+ const onDiskConfig = !config && loadOnDiskGraphQLConfig(filePath);
49
+ onDiskConfig && debug("GraphQL-Config path %o", onDiskConfig.filepath);
50
+ const configOptions = config && ("projects" in config || "schemaPath" in config) ? config : {
61
51
  // if `schema` is `undefined` will throw error `Project 'default' not found`
62
- documents: options.documents,
63
- extensions: options.extensions,
64
- include: options.include,
65
- exclude: options.exclude
52
+ schema: config?.schema ?? "",
53
+ ...config
66
54
  };
67
- graphQLConfig = onDiskConfig || new import_graphql_config.GraphQLConfig(
68
- {
69
- config: configOptions,
70
- filepath: "virtual-config"
71
- },
72
- [codeFileLoaderExtension]
73
- );
74
- return graphQLConfig;
55
+ return graphQLConfig = onDiskConfig || new import_graphql_config.GraphQLConfig({ config: configOptions, filepath: "" }, [codeFileLoaderExtension]), graphQLConfig;
75
56
  }
76
57
  const codeFileLoaderExtension = (api) => {
77
58
  const { schema, documents } = api.loaders;
78
- schema.register(new import_code_file_loader.CodeFileLoader());
79
- documents.register(new import_code_file_loader.CodeFileLoader());
80
- return { name: "graphql-eslint-loaders" };
59
+ return schema.register(new import_code_file_loader.CodeFileLoader()), documents.register(new import_code_file_loader.CodeFileLoader()), { name: "code-file-loaders" };
81
60
  };
82
61
  // Annotate the CommonJS export names for ESM import in node:
83
62
  0 && (module.exports = {
package/cjs/index.d.ts CHANGED
@@ -2,21 +2,27 @@ import * as eslint from 'eslint';
2
2
  import { Block } from './processor.js';
3
3
  export { parseForESLint } from './parser.js';
4
4
  export { rules } from './rules/index.js';
5
- export { C as CategoryType, G as GraphQLESLintParseResult, f as GraphQLESLintRule, c as GraphQLESLintRuleContext, e as GraphQLESLintRuleListener, O as OmitRecursively, P as ParserOptions, b as ParserServices, a as Pointer, R as ReportDescriptor, d as RuleDocsInfo, S as Schema, V as ValueOf } from './types-8d5f4ae0.js';
5
+ export { CategoryType, ConfigName, GraphQLESLintParseResult, GraphQLESLintRule, GraphQLESLintRuleContext, GraphQLESLintRuleListener, OmitRecursively, ParserOptions, ParserServices, Pointer, ReportDescriptor, RuleDocsInfo, Schema, ValueOf } from './types.js';
6
6
  export { requireGraphQLSchemaFromContext, requireSiblingsOperations } from './utils.js';
7
7
  export { configs } from './configs/index.js';
8
8
  export { flatConfigs } from './flat-configs.js';
9
9
  import './rules/require-description.js';
10
10
  import 'graphql';
11
+ import 'graphql/language/ast.js';
11
12
  import 'json-schema-to-ts/lib/types/type-utils/writable.js';
12
- import '@graphql-tools/utils';
13
13
  import 'estree';
14
- import 'graphql-config';
15
14
  import 'json-schema-to-ts';
15
+ import './siblings.js';
16
+ import '@graphql-tools/utils';
16
17
  import './estree-converter/types.js';
18
+ import 'graphql-config';
17
19
 
18
20
  declare const processors: {
19
- graphql: eslint.Linter.Processor<string | Block>;
21
+ graphql: {
22
+ supportsAutofix: true;
23
+ preprocess(code: string, filePath: string): (string | Block)[];
24
+ postprocess(messages: eslint.Linter.LintMessage[][], filePath: string): eslint.Linter.LintMessage[];
25
+ };
20
26
  };
21
27
 
22
28
  export { processors };
package/cjs/index.js CHANGED
@@ -5,18 +5,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
12
11
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
13
  return to;
17
- };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
20
16
  var src_exports = {};
21
17
  __export(src_exports, {
22
18
  configs: () => import_configs.configs,
@@ -28,13 +24,9 @@ __export(src_exports, {
28
24
  rules: () => import_rules.rules
29
25
  });
30
26
  module.exports = __toCommonJS(src_exports);
31
- var import_processor = require("./processor.js");
32
- var import_parser = require("./parser.js");
33
- var import_rules = require("./rules/index.js");
27
+ var import_processor = require("./processor.js"), import_parser = require("./parser.js"), import_rules = require("./rules/index.js");
34
28
  __reExport(src_exports, require("./types.js"), module.exports);
35
- var import_utils = require("./utils.js");
36
- var import_configs = require("./configs/index.js");
37
- var import_flat_configs = require("./flat-configs.js");
29
+ var import_utils = require("./utils.js"), import_configs = require("./configs/index.js"), import_flat_configs = require("./flat-configs.js");
38
30
  const processors = { graphql: import_processor.processor };
39
31
  // Annotate the CommonJS export names for ESM import in node:
40
32
  0 && (module.exports = {
package/cjs/parser.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { P as ParserOptions, G as GraphQLESLintParseResult } from './types-8d5f4ae0.js';
2
- import '@graphql-tools/utils';
1
+ import { ParserOptions, GraphQLESLintParseResult } from './types.js';
3
2
  import 'eslint';
4
3
  import 'estree';
5
4
  import 'graphql';
6
- import 'graphql-config';
7
5
  import 'json-schema-to-ts';
6
+ import './siblings.js';
7
+ import '@graphql-tools/utils';
8
8
  import './estree-converter/types.js';
9
+ import 'graphql-config';
9
10
 
10
11
  declare function parseForESLint(code: string, options: ParserOptions): GraphQLESLintParseResult;
11
12