@graphql-eslint/eslint-plugin 4.4.0-alpha-20241210124724-37546942474e54378c2b293d843e141891961747 → 4.4.0-alpha-20241210140320-e9caf71d9b9cfbe349d93078518003a6bd1f6128

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 (161) hide show
  1. package/{programmatic.js → browser.js} +73 -104
  2. package/cjs/graphql-config.d.cts +2 -1
  3. package/cjs/index.d.cts +2 -1
  4. package/cjs/meta.js +1 -1
  5. package/cjs/parser.d.cts +2 -1
  6. package/cjs/rules/alphabetize/index.d.cts +1 -1
  7. package/cjs/rules/alphabetize/index.js +1 -2
  8. package/cjs/rules/description-style/index.d.cts +1 -1
  9. package/cjs/rules/description-style/index.js +1 -3
  10. package/cjs/rules/graphql-js-validation.d.cts +2 -1
  11. package/cjs/rules/graphql-js-validation.js +30 -31
  12. package/cjs/rules/index.d.cts +2 -1
  13. package/cjs/rules/input-name/index.d.cts +1 -1
  14. package/cjs/rules/input-name/index.js +1 -3
  15. package/cjs/rules/lone-executable-definition/index.d.cts +1 -1
  16. package/cjs/rules/lone-executable-definition/index.js +1 -2
  17. package/cjs/rules/match-document-filename/index.d.cts +1 -1
  18. package/cjs/rules/match-document-filename/index.js +1 -2
  19. package/cjs/rules/naming-convention/index.d.cts +1 -1
  20. package/cjs/rules/naming-convention/index.js +1 -3
  21. package/cjs/rules/no-anonymous-operations/index.d.cts +2 -1
  22. package/cjs/rules/no-anonymous-operations/index.js +1 -2
  23. package/cjs/rules/no-deprecated/index.d.cts +2 -1
  24. package/cjs/rules/no-deprecated/index.js +1 -2
  25. package/cjs/rules/no-duplicate-fields/index.d.cts +2 -1
  26. package/cjs/rules/no-duplicate-fields/index.js +1 -2
  27. package/cjs/rules/no-hashtag-description/index.d.cts +2 -1
  28. package/cjs/rules/no-hashtag-description/index.js +1 -2
  29. package/cjs/rules/no-one-place-fragments/index.d.cts +2 -1
  30. package/cjs/rules/no-one-place-fragments/index.js +1 -1
  31. package/cjs/rules/no-root-type/index.d.cts +1 -1
  32. package/cjs/rules/no-root-type/index.js +1 -3
  33. package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +2 -1
  34. package/cjs/rules/no-scalar-result-type-on-mutation/index.js +1 -2
  35. package/cjs/rules/no-typename-prefix/index.d.cts +2 -1
  36. package/cjs/rules/no-typename-prefix/index.js +1 -2
  37. package/cjs/rules/no-unreachable-types/index.d.cts +2 -1
  38. package/cjs/rules/no-unreachable-types/index.js +1 -2
  39. package/cjs/rules/no-unused-fields/index.d.cts +1 -1
  40. package/cjs/rules/no-unused-fields/index.js +1 -2
  41. package/cjs/rules/relay-arguments/index.d.cts +1 -1
  42. package/cjs/rules/relay-arguments/index.js +1 -1
  43. package/cjs/rules/relay-connection-types/index.d.cts +2 -1
  44. package/cjs/rules/relay-connection-types/index.js +1 -1
  45. package/cjs/rules/relay-edge-types/index.d.cts +1 -1
  46. package/cjs/rules/relay-edge-types/index.js +1 -1
  47. package/cjs/rules/relay-page-info/index.d.cts +2 -1
  48. package/cjs/rules/relay-page-info/index.js +1 -1
  49. package/cjs/rules/require-deprecation-date/index.d.cts +1 -1
  50. package/cjs/rules/require-deprecation-date/index.js +1 -2
  51. package/cjs/rules/require-deprecation-reason/index.d.cts +2 -1
  52. package/cjs/rules/require-deprecation-reason/index.js +1 -1
  53. package/cjs/rules/require-description/index.d.cts +1 -1
  54. package/cjs/rules/require-description/index.js +1 -2
  55. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +2 -1
  56. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
  57. package/cjs/rules/require-import-fragment/index.d.cts +2 -1
  58. package/cjs/rules/require-import-fragment/index.js +1 -2
  59. package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +2 -1
  60. package/cjs/rules/require-nullable-fields-with-oneof/index.js +1 -1
  61. package/cjs/rules/require-nullable-result-in-root/index.d.cts +2 -1
  62. package/cjs/rules/require-nullable-result-in-root/index.js +1 -2
  63. package/cjs/rules/require-selections/index.d.cts +1 -1
  64. package/cjs/rules/require-selections/index.js +4 -8
  65. package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +2 -1
  66. package/cjs/rules/require-type-pattern-with-oneof/index.js +1 -1
  67. package/cjs/rules/selection-set-depth/index.d.cts +1 -1
  68. package/cjs/rules/selection-set-depth/index.js +1 -3
  69. package/cjs/rules/strict-id-in-types/index.d.cts +1 -1
  70. package/cjs/rules/strict-id-in-types/index.js +5 -5
  71. package/cjs/rules/unique-enum-value-names/index.d.cts +2 -1
  72. package/cjs/rules/unique-enum-value-names/index.js +1 -2
  73. package/cjs/rules/unique-fragment-name/index.d.cts +1 -0
  74. package/cjs/rules/unique-fragment-name/index.js +2 -1
  75. package/cjs/rules/unique-operation-name/index.d.cts +2 -1
  76. package/cjs/rules/unique-operation-name/index.js +1 -1
  77. package/cjs/schema.d.cts +2 -1
  78. package/cjs/types.d.cts +17 -7
  79. package/cjs/utils.d.cts +2 -2
  80. package/cjs/utils.js +1 -5
  81. package/esm/graphql-config.d.ts +2 -1
  82. package/esm/index.d.ts +1 -0
  83. package/esm/meta.js +1 -1
  84. package/esm/parser.d.ts +2 -1
  85. package/esm/rules/alphabetize/index.d.ts +1 -1
  86. package/esm/rules/alphabetize/index.js +1 -2
  87. package/esm/rules/description-style/index.d.ts +1 -1
  88. package/esm/rules/description-style/index.js +1 -3
  89. package/esm/rules/graphql-js-validation.d.ts +2 -1
  90. package/esm/rules/graphql-js-validation.js +30 -31
  91. package/esm/rules/index.d.ts +1 -0
  92. package/esm/rules/input-name/index.d.ts +1 -1
  93. package/esm/rules/input-name/index.js +1 -3
  94. package/esm/rules/lone-executable-definition/index.d.ts +1 -1
  95. package/esm/rules/lone-executable-definition/index.js +1 -2
  96. package/esm/rules/match-document-filename/index.d.ts +1 -1
  97. package/esm/rules/match-document-filename/index.js +1 -2
  98. package/esm/rules/naming-convention/index.d.ts +1 -1
  99. package/esm/rules/naming-convention/index.js +1 -3
  100. package/esm/rules/no-anonymous-operations/index.d.ts +2 -1
  101. package/esm/rules/no-anonymous-operations/index.js +1 -2
  102. package/esm/rules/no-deprecated/index.d.ts +2 -1
  103. package/esm/rules/no-deprecated/index.js +1 -2
  104. package/esm/rules/no-duplicate-fields/index.d.ts +2 -1
  105. package/esm/rules/no-duplicate-fields/index.js +1 -2
  106. package/esm/rules/no-hashtag-description/index.d.ts +2 -1
  107. package/esm/rules/no-hashtag-description/index.js +1 -2
  108. package/esm/rules/no-one-place-fragments/index.d.ts +2 -1
  109. package/esm/rules/no-one-place-fragments/index.js +1 -1
  110. package/esm/rules/no-root-type/index.d.ts +1 -1
  111. package/esm/rules/no-root-type/index.js +1 -3
  112. package/esm/rules/no-scalar-result-type-on-mutation/index.d.ts +2 -1
  113. package/esm/rules/no-scalar-result-type-on-mutation/index.js +1 -2
  114. package/esm/rules/no-typename-prefix/index.d.ts +2 -1
  115. package/esm/rules/no-typename-prefix/index.js +1 -2
  116. package/esm/rules/no-unreachable-types/index.d.ts +2 -1
  117. package/esm/rules/no-unreachable-types/index.js +1 -2
  118. package/esm/rules/no-unused-fields/index.d.ts +1 -1
  119. package/esm/rules/no-unused-fields/index.js +1 -2
  120. package/esm/rules/relay-arguments/index.d.ts +1 -1
  121. package/esm/rules/relay-arguments/index.js +1 -1
  122. package/esm/rules/relay-connection-types/index.d.ts +2 -1
  123. package/esm/rules/relay-connection-types/index.js +1 -1
  124. package/esm/rules/relay-edge-types/index.d.ts +1 -1
  125. package/esm/rules/relay-edge-types/index.js +1 -1
  126. package/esm/rules/relay-page-info/index.d.ts +2 -1
  127. package/esm/rules/relay-page-info/index.js +1 -1
  128. package/esm/rules/require-deprecation-date/index.d.ts +1 -1
  129. package/esm/rules/require-deprecation-date/index.js +1 -2
  130. package/esm/rules/require-deprecation-reason/index.d.ts +2 -1
  131. package/esm/rules/require-deprecation-reason/index.js +1 -1
  132. package/esm/rules/require-description/index.d.ts +1 -1
  133. package/esm/rules/require-description/index.js +1 -2
  134. package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +2 -1
  135. package/esm/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
  136. package/esm/rules/require-import-fragment/index.d.ts +2 -1
  137. package/esm/rules/require-import-fragment/index.js +1 -2
  138. package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +2 -1
  139. package/esm/rules/require-nullable-fields-with-oneof/index.js +1 -1
  140. package/esm/rules/require-nullable-result-in-root/index.d.ts +2 -1
  141. package/esm/rules/require-nullable-result-in-root/index.js +1 -2
  142. package/esm/rules/require-selections/index.d.ts +1 -1
  143. package/esm/rules/require-selections/index.js +4 -8
  144. package/esm/rules/require-type-pattern-with-oneof/index.d.ts +2 -1
  145. package/esm/rules/require-type-pattern-with-oneof/index.js +1 -1
  146. package/esm/rules/selection-set-depth/index.d.ts +1 -1
  147. package/esm/rules/selection-set-depth/index.js +1 -3
  148. package/esm/rules/strict-id-in-types/index.d.ts +1 -1
  149. package/esm/rules/strict-id-in-types/index.js +5 -5
  150. package/esm/rules/unique-enum-value-names/index.d.ts +2 -1
  151. package/esm/rules/unique-enum-value-names/index.js +1 -2
  152. package/esm/rules/unique-fragment-name/index.d.ts +1 -0
  153. package/esm/rules/unique-fragment-name/index.js +2 -1
  154. package/esm/rules/unique-operation-name/index.d.ts +2 -1
  155. package/esm/rules/unique-operation-name/index.js +1 -1
  156. package/esm/schema.d.ts +2 -1
  157. package/esm/types.d.ts +17 -7
  158. package/esm/utils.d.ts +2 -2
  159. package/esm/utils.js +0 -4
  160. package/package.json +10 -4
  161. package/programmatic.d.ts +0 -1323
@@ -4,7 +4,6 @@
4
4
 
5
5
 
6
6
 
7
-
8
7
  var _utilsjs = require('../../utils.js');
9
8
  const RULE_ID = "strict-id-in-types";
10
9
  const schema = {
@@ -44,7 +43,7 @@ const rule = {
44
43
  type: "suggestion",
45
44
  docs: {
46
45
  description: "Requires output types to have one unique identifier unless they do not have a logical one. Exceptions can be used to ignore output types that do not have unique identifiers.",
47
- category: "schema",
46
+ category: "Schema",
48
47
  recommended: true,
49
48
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
50
49
  requiresSchema: true,
@@ -116,7 +115,6 @@ const rule = {
116
115
  }
117
116
  ]
118
117
  },
119
- // @ts-expect-error -- fixme
120
118
  schema
121
119
  },
122
120
  create(context) {
@@ -150,11 +148,13 @@ const rule = {
150
148
  return isValidIdName && isValidIdType;
151
149
  })]);
152
150
  if (_optionalChain([validIds, 'optionalAccess', _12 => _12.length]) !== 1) {
151
+ const pluralNamesSuffix = options.acceptedIdNames.length > 1 ? "s" : "";
152
+ const pluralTypesSuffix = options.acceptedIdTypes.length > 1 ? "s" : "";
153
153
  context.report({
154
154
  node: node.name,
155
155
  message: `${_utilsjs.displayNodeName.call(void 0, node)} must have exactly one non-nullable unique identifier.
156
- Accepted name${_utilsjs.pluralize.call(void 0, options.acceptedIdNames.length)}: ${_utilsjs.englishJoinWords.call(void 0, options.acceptedIdNames)}.
157
- Accepted type${_utilsjs.pluralize.call(void 0, options.acceptedIdTypes.length)}: ${_utilsjs.englishJoinWords.call(void 0, options.acceptedIdTypes)}.`
156
+ Accepted name${pluralNamesSuffix}: ${_utilsjs.englishJoinWords.call(void 0, options.acceptedIdNames)}.
157
+ Accepted type${pluralTypesSuffix}: ${_utilsjs.englishJoinWords.call(void 0, options.acceptedIdTypes)}.`
158
158
  });
159
159
  }
160
160
  }
@@ -1,9 +1,10 @@
1
1
  import { GraphQLESLintRule } from '../../types.cjs';
2
2
  import 'eslint';
3
+ import 'estree';
3
4
  import 'graphql';
4
5
  import 'graphql-config';
6
+ import 'json-schema-to-ts';
5
7
  import '../../estree-converter/types.cjs';
6
- import 'estree';
7
8
  import '../../siblings.cjs';
8
9
  import '@graphql-tools/utils';
9
10
 
@@ -6,7 +6,7 @@ const rule = {
6
6
  hasSuggestions: true,
7
7
  docs: {
8
8
  url: "https://the-guild.dev/graphql/eslint/rules/unique-enum-value-names",
9
- category: "schema",
9
+ category: "Schema",
10
10
  recommended: true,
11
11
  description: `A GraphQL enum type is only valid if all its values are uniquely named.
12
12
  > This rule disallows case-insensitive enum values duplicates too.`,
@@ -58,7 +58,6 @@ const rule = {
58
58
  suggest: [
59
59
  {
60
60
  desc: `Remove \`${enumName}\` enum value`,
61
- // @ts-expect-error -- fixme
62
61
  fix: (fixer) => fixer.remove(duplicate)
63
62
  }
64
63
  ]
@@ -4,6 +4,7 @@ import { GraphQLESLintRuleContext, GraphQLESLintRule } from '../../types.cjs';
4
4
  import 'eslint';
5
5
  import 'estree';
6
6
  import 'graphql-config';
7
+ import 'json-schema-to-ts';
7
8
  import '../../siblings.cjs';
8
9
  import '@graphql-tools/utils';
9
10
 
@@ -19,6 +19,7 @@ const checkNode = (context, node, ruleId) => {
19
19
  documentName,
20
20
  summary: conflictingDocuments.map((f) => ` ${_nodepath.relative.call(void 0, _utilsjs.CWD, f.filePath.replace(_utilsjs.VIRTUAL_DOCUMENT_REGEX, ""))}`).join("\n")
21
21
  },
22
+ // @ts-expect-error name will exist
22
23
  node: node.name
23
24
  });
24
25
  }
@@ -27,7 +28,7 @@ const rule = {
27
28
  meta: {
28
29
  type: "suggestion",
29
30
  docs: {
30
- category: "operations",
31
+ category: "Operations",
31
32
  description: "Enforce unique fragment names across your project.",
32
33
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
33
34
  requiresSiblings: true,
@@ -1,9 +1,10 @@
1
1
  import { GraphQLESLintRule } from '../../types.cjs';
2
2
  import 'eslint';
3
+ import 'estree';
3
4
  import 'graphql';
4
5
  import 'graphql-config';
6
+ import 'json-schema-to-ts';
5
7
  import '../../estree-converter/types.cjs';
6
- import 'estree';
7
8
  import '../../siblings.cjs';
8
9
  import '@graphql-tools/utils';
9
10
 
@@ -4,7 +4,7 @@ const rule = {
4
4
  meta: {
5
5
  type: "suggestion",
6
6
  docs: {
7
- category: "operations",
7
+ category: "Operations",
8
8
  description: "Enforce unique operation names across your project.",
9
9
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
10
10
  requiresSiblings: true,
package/cjs/schema.d.cts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { GraphQLProjectConfig } from 'graphql-config';
2
2
  import { Schema } from './types.cjs';
3
3
  import 'eslint';
4
+ import 'estree';
4
5
  import 'graphql';
6
+ import 'json-schema-to-ts';
5
7
  import './estree-converter/types.cjs';
6
- import 'estree';
7
8
  import './siblings.cjs';
8
9
  import '@graphql-tools/utils';
9
10
 
package/cjs/types.d.cts CHANGED
@@ -1,9 +1,10 @@
1
- import { Linter, Rule } from 'eslint';
1
+ import { Linter, Rule, AST } from 'eslint';
2
+ import * as ESTree from 'estree';
2
3
  import { GraphQLSchema, ASTKindToNode } from 'graphql';
3
4
  import { IGraphQLConfig } from 'graphql-config';
5
+ import { JSONSchema } from 'json-schema-to-ts';
4
6
  import { GraphQLESTreeNode } from './estree-converter/types.cjs';
5
7
  import { SiblingOperations } from './siblings.cjs';
6
- import 'estree';
7
8
  import '@graphql-tools/utils';
8
9
 
9
10
  type Schema = GraphQLSchema | null;
@@ -20,16 +21,24 @@ type ParserServices = {
20
21
  type GraphQLESLintParseResult = Linter.ESLintParseResult & {
21
22
  services: ParserServices;
22
23
  };
23
- type ReportDescriptorLocation = any;
24
+ type Location = AST.SourceLocation | ESTree.Position;
25
+ type ReportDescriptorLocation = {
26
+ loc: Location;
27
+ } | {
28
+ node: {
29
+ loc: Location;
30
+ };
31
+ };
24
32
  type ReportDescriptor = ReportDescriptorLocation & Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions;
25
- type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'options' | 'report'> & {
33
+ type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'options' | 'parserServices' | 'report'> & {
26
34
  options: Options;
35
+ parserServices: ParserServices;
27
36
  report(descriptor: ReportDescriptor): void;
28
37
  };
29
- type CategoryType = 'schema' | 'operations' | 'schema-and-operations';
38
+ type CategoryType = 'Operations' | 'Schema';
30
39
  type RuleMetaDataDocs = Required<Rule.RuleMetaData>['docs'];
31
40
  type RuleDocsInfo<T> = Omit<RuleMetaDataDocs, 'category' | 'suggestion'> & {
32
- category?: string;
41
+ category: CategoryType | CategoryType[];
33
42
  requiresSchema?: true;
34
43
  requiresSiblings?: true;
35
44
  examples?: {
@@ -49,8 +58,9 @@ type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = Record<st
49
58
  [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
50
59
  };
51
60
  type GraphQLESLintRule<Options = [], WithTypeInfo extends boolean = false> = {
52
- meta?: Omit<Rule.RuleMetaData, 'docs'> & {
61
+ meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & {
53
62
  docs?: RuleDocsInfo<Options>;
63
+ schema: Readonly<JSONSchema> | [];
54
64
  };
55
65
  create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
56
66
  };
package/cjs/utils.d.cts CHANGED
@@ -6,6 +6,7 @@ import { SiblingOperations } from './siblings.cjs';
6
6
  import { GraphQLESLintRuleContext } from './types.cjs';
7
7
  import '@graphql-tools/utils';
8
8
  import 'graphql-config';
9
+ import 'json-schema-to-ts';
9
10
 
10
11
  declare function requireGraphQLOperations(ruleId: string, context: GraphQLESLintRuleContext): SiblingOperations | never;
11
12
  declare function requireGraphQLSchema(ruleId: string, context: GraphQLESLintRuleContext): GraphQLSchema | never;
@@ -39,6 +40,5 @@ declare const englishJoinWords: (words: string[]) => string;
39
40
  declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
40
41
  declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
41
42
  declare const eslintSelectorsTip = "> [!TIP]\n>\n> These fields are defined by ESLint [`selectors`](https://eslint.org/docs/developer-guide/selectors).\n> Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector.";
42
- declare function pluralize(size: number): "" | "s";
43
43
 
44
- export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, eslintSelectorsTip, getLocation, getNodeName, getTypeName, logger, pascalCase, pluralize, requireGraphQLOperations, requireGraphQLSchema, slash };
44
+ export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, eslintSelectorsTip, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLOperations, requireGraphQLSchema, slash };
package/cjs/utils.js CHANGED
@@ -158,10 +158,6 @@ const eslintSelectorsTip = `> [!TIP]
158
158
  >
159
159
  > These fields are defined by ESLint [\`selectors\`](https://eslint.org/docs/developer-guide/selectors).
160
160
  > Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector.`;
161
- function pluralize(size) {
162
- return size > 1 ? "s" : "";
163
- }
164
-
165
161
 
166
162
 
167
163
 
@@ -181,4 +177,4 @@ function pluralize(size) {
181
177
 
182
178
 
183
179
 
184
- exports.ARRAY_DEFAULT_OPTIONS = ARRAY_DEFAULT_OPTIONS; exports.CWD = CWD; exports.REPORT_ON_FIRST_CHARACTER = REPORT_ON_FIRST_CHARACTER; exports.TYPES_KINDS = TYPES_KINDS; exports.VIRTUAL_DOCUMENT_REGEX = VIRTUAL_DOCUMENT_REGEX; exports.camelCase = camelCase; exports.convertCase = convertCase; exports.displayNodeName = displayNodeName; exports.englishJoinWords = englishJoinWords; exports.eslintSelectorsTip = eslintSelectorsTip; exports.getLocation = getLocation; exports.getNodeName = getNodeName; exports.getTypeName = getTypeName; exports.logger = logger; exports.pascalCase = pascalCase; exports.pluralize = pluralize; exports.requireGraphQLOperations = requireGraphQLOperations; exports.requireGraphQLSchema = requireGraphQLSchema; exports.slash = slash;
180
+ exports.ARRAY_DEFAULT_OPTIONS = ARRAY_DEFAULT_OPTIONS; exports.CWD = CWD; exports.REPORT_ON_FIRST_CHARACTER = REPORT_ON_FIRST_CHARACTER; exports.TYPES_KINDS = TYPES_KINDS; exports.VIRTUAL_DOCUMENT_REGEX = VIRTUAL_DOCUMENT_REGEX; exports.camelCase = camelCase; exports.convertCase = convertCase; exports.displayNodeName = displayNodeName; exports.englishJoinWords = englishJoinWords; exports.eslintSelectorsTip = eslintSelectorsTip; exports.getLocation = getLocation; exports.getNodeName = getNodeName; exports.getTypeName = getTypeName; exports.logger = logger; exports.pascalCase = pascalCase; exports.requireGraphQLOperations = requireGraphQLOperations; exports.requireGraphQLSchema = requireGraphQLSchema; exports.slash = slash;
@@ -1,9 +1,10 @@
1
1
  import { GraphQLConfig } from 'graphql-config';
2
2
  import { ParserOptions } from './types.js';
3
3
  import 'eslint';
4
+ import 'estree';
4
5
  import 'graphql';
6
+ import 'json-schema-to-ts';
5
7
  import './estree-converter/types.js';
6
- import 'estree';
7
8
  import './siblings.js';
8
9
  import '@graphql-tools/utils';
9
10
 
package/esm/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export { GraphQLESTreeNode } from './estree-converter/types.js';
15
15
  import 'estree';
16
16
  import './siblings.js';
17
17
  import '@graphql-tools/utils';
18
+ import 'json-schema-to-ts';
18
19
 
19
20
  declare const processors: {
20
21
  graphql: {
package/esm/meta.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = "4.4.0-alpha-20241210124724-37546942474e54378c2b293d843e141891961747";
1
+ const version = "4.4.0-alpha-20241210140320-e9caf71d9b9cfbe349d93078518003a6bd1f6128";
2
2
  export {
3
3
  version
4
4
  };
package/esm/parser.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { ParserOptions, GraphQLESLintParseResult } from './types.js';
2
2
  import 'eslint';
3
+ import 'estree';
3
4
  import 'graphql';
4
5
  import 'graphql-config';
6
+ import 'json-schema-to-ts';
5
7
  import './estree-converter/types.js';
6
- import 'estree';
7
8
  import './siblings.js';
8
9
  import '@graphql-tools/utils';
9
10
 
@@ -1,10 +1,10 @@
1
1
  import { FromSchema } from 'json-schema-to-ts';
2
2
  import { GraphQLESLintRule } from '../../types.js';
3
3
  import 'eslint';
4
+ import 'estree';
4
5
  import 'graphql';
5
6
  import 'graphql-config';
6
7
  import '../../estree-converter/types.js';
7
- import 'estree';
8
8
  import '../../siblings.js';
9
9
  import '@graphql-tools/utils';
10
10
 
@@ -80,7 +80,7 @@ const rule = {
80
80
  type: "suggestion",
81
81
  fixable: "code",
82
82
  docs: {
83
- category: "schema-and-operations",
83
+ category: ["Schema", "Operations"],
84
84
  description: "Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.",
85
85
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
86
86
  examples: [
@@ -278,7 +278,6 @@ const rule = {
278
278
  currNode: displayNodeName(currNode),
279
279
  prevNode: prevName ? displayNodeName(prevNode) : lowerCase(prevNode.kind)
280
280
  },
281
- // @ts-expect-error -- fixme
282
281
  *fix(fixer) {
283
282
  const prevRange = getRangeWithComments(prevNode);
284
283
  const currRange = getRangeWithComments(currNode);
@@ -1,10 +1,10 @@
1
1
  import { FromSchema } from 'json-schema-to-ts';
2
2
  import { GraphQLESLintRule } from '../../types.js';
3
3
  import 'eslint';
4
+ import 'estree';
4
5
  import 'graphql';
5
6
  import 'graphql-config';
6
7
  import '../../estree-converter/types.js';
7
- import 'estree';
8
8
  import '../../siblings.js';
9
9
  import '@graphql-tools/utils';
10
10
 
@@ -48,11 +48,10 @@ const rule = {
48
48
  }
49
49
  ],
50
50
  description: "Require all comments to follow the same style (either block or inline).",
51
- category: "schema",
51
+ category: "Schema",
52
52
  url: "https://the-guild.dev/graphql/eslint/rules/description-style",
53
53
  recommended: true
54
54
  },
55
- // @ts-expect-error -- fixme
56
55
  schema
57
56
  },
58
57
  create(context) {
@@ -68,7 +67,6 @@ const rule = {
68
67
  suggest: [
69
68
  {
70
69
  desc: `Change to ${isBlock ? "block" : "inline"} style description`,
71
- // @ts-expect-error -- fixme
72
70
  fix(fixer) {
73
71
  const sourceCode = context.getSourceCode();
74
72
  const originalText = sourceCode.getText(node);
@@ -1,9 +1,10 @@
1
1
  import { GraphQLESLintRule } from '../types.js';
2
2
  import 'eslint';
3
+ import 'estree';
3
4
  import 'graphql';
4
5
  import 'graphql-config';
6
+ import 'json-schema-to-ts';
5
7
  import '../estree-converter/types.js';
6
- import 'estree';
7
8
  import '../siblings.js';
8
9
  import '@graphql-tools/utils';
9
10
 
@@ -78,7 +78,6 @@ function validateDocument({
78
78
  const { name } = match.groups;
79
79
  return {
80
80
  desc: `Rename to \`${name}\``,
81
- // @ts-expect-error -- fixme
82
81
  fix: (fixer) => fixer.replaceText(token, name)
83
82
  };
84
83
  }) : []
@@ -180,7 +179,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
180
179
  rule: ExecutableDefinitionsRule
181
180
  },
182
181
  {
183
- category: "operations",
182
+ category: "Operations",
184
183
  description: "A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.",
185
184
  requiresSchema: true
186
185
  }
@@ -192,7 +191,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
192
191
  hasDidYouMeanSuggestions: true
193
192
  },
194
193
  {
195
- category: "operations",
194
+ category: "Operations",
196
195
  description: "A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as `__typename`.",
197
196
  requiresSchema: true
198
197
  }
@@ -203,7 +202,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
203
202
  rule: FragmentsOnCompositeTypesRule
204
203
  },
205
204
  {
206
- category: "operations",
205
+ category: "Operations",
207
206
  description: "Fragments use a type condition to determine if they apply, since fragments can only be spread into a composite type (object, interface, or union), the type condition must also be a composite type.",
208
207
  requiresSchema: true
209
208
  }
@@ -215,7 +214,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
215
214
  hasDidYouMeanSuggestions: true
216
215
  },
217
216
  {
218
- category: "schema-and-operations",
217
+ category: ["Schema", "Operations"],
219
218
  description: "A GraphQL field is only valid if all supplied arguments are defined by that field.",
220
219
  requiresSchema: true
221
220
  }
@@ -254,7 +253,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
254
253
  }
255
254
  },
256
255
  {
257
- category: "schema-and-operations",
256
+ category: ["Schema", "Operations"],
258
257
  description: "A GraphQL document is only valid if all `@directive`s are known by the schema and legally positioned.",
259
258
  requiresSchema: true,
260
259
  examples: [
@@ -282,7 +281,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
282
281
  getDocumentNode: handleMissingFragments
283
282
  },
284
283
  {
285
- category: "operations",
284
+ category: "Operations",
286
285
  description: "A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document.",
287
286
  requiresSchema: true,
288
287
  requiresSiblings: true,
@@ -350,7 +349,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
350
349
  hasDidYouMeanSuggestions: true
351
350
  },
352
351
  {
353
- category: "schema-and-operations",
352
+ category: ["Schema", "Operations"],
354
353
  description: "A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.",
355
354
  requiresSchema: true
356
355
  }
@@ -361,7 +360,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
361
360
  rule: LoneAnonymousOperationRule
362
361
  },
363
362
  {
364
- category: "operations",
363
+ category: "Operations",
365
364
  description: "A GraphQL document that contains an anonymous operation (the `query` short-hand) is only valid if it contains only that one operation definition.",
366
365
  requiresSchema: true
367
366
  }
@@ -372,7 +371,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
372
371
  rule: LoneSchemaDefinitionRule
373
372
  },
374
373
  {
375
- category: "schema",
374
+ category: "Schema",
376
375
  description: "A GraphQL document is only valid if it contains only one schema definition."
377
376
  }
378
377
  ),
@@ -382,7 +381,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
382
381
  rule: NoFragmentCyclesRule
383
382
  },
384
383
  {
385
- category: "operations",
384
+ category: "Operations",
386
385
  description: "A GraphQL fragment is only valid when it does not have cycles in fragments usage.",
387
386
  requiresSchema: true
388
387
  }
@@ -394,7 +393,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
394
393
  getDocumentNode: handleMissingFragments
395
394
  },
396
395
  {
397
- category: "operations",
396
+ category: "Operations",
398
397
  description: "A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.",
399
398
  requiresSchema: true,
400
399
  requiresSiblings: true
@@ -441,7 +440,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
441
440
  }
442
441
  },
443
442
  {
444
- category: "operations",
443
+ category: "Operations",
445
444
  description: "A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.",
446
445
  requiresSchema: true,
447
446
  requiresSiblings: true
@@ -454,7 +453,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
454
453
  getDocumentNode: handleMissingFragments
455
454
  },
456
455
  {
457
- category: "operations",
456
+ category: "Operations",
458
457
  description: "A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.",
459
458
  requiresSchema: true,
460
459
  requiresSiblings: true
@@ -466,7 +465,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
466
465
  rule: OverlappingFieldsCanBeMergedRule
467
466
  },
468
467
  {
469
- category: "operations",
468
+ category: "Operations",
470
469
  description: "A selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.",
471
470
  requiresSchema: true
472
471
  }
@@ -477,7 +476,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
477
476
  rule: PossibleFragmentSpreadsRule
478
477
  },
479
478
  {
480
- category: "operations",
479
+ category: "Operations",
481
480
  description: "A fragment spread is only valid if the type condition could ever possibly be true: if there is a non-empty intersection of the possible parent types, and possible types which pass the type condition.",
482
481
  requiresSchema: true
483
482
  }
@@ -489,7 +488,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
489
488
  hasDidYouMeanSuggestions: true
490
489
  },
491
490
  {
492
- category: "schema",
491
+ category: "Schema",
493
492
  description: "A type extension is only valid if the type is defined and has the same kind.",
494
493
  recommended: true,
495
494
  requiresSchema: true
@@ -501,7 +500,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
501
500
  rule: ProvidedRequiredArgumentsRule
502
501
  },
503
502
  {
504
- category: "schema-and-operations",
503
+ category: ["Schema", "Operations"],
505
504
  description: "A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.",
506
505
  requiresSchema: true
507
506
  }
@@ -513,7 +512,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
513
512
  hasDidYouMeanSuggestions: true
514
513
  },
515
514
  {
516
- category: "operations",
515
+ category: "Operations",
517
516
  description: "A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.",
518
517
  requiresSchema: true
519
518
  }
@@ -524,7 +523,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
524
523
  rule: SingleFieldSubscriptionsRule
525
524
  },
526
525
  {
527
- category: "operations",
526
+ category: "Operations",
528
527
  description: "A GraphQL subscription is valid only if it contains a single root field.",
529
528
  requiresSchema: true
530
529
  }
@@ -535,7 +534,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
535
534
  rule: UniqueArgumentNamesRule
536
535
  },
537
536
  {
538
- category: "operations",
537
+ category: "Operations",
539
538
  description: "A GraphQL field or directive is only valid if all supplied arguments are uniquely named.",
540
539
  requiresSchema: true
541
540
  }
@@ -546,7 +545,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
546
545
  rule: UniqueDirectiveNamesRule
547
546
  },
548
547
  {
549
- category: "schema",
548
+ category: "Schema",
550
549
  description: "A GraphQL document is only valid if all defined directives have unique names."
551
550
  }
552
551
  ),
@@ -556,7 +555,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
556
555
  rule: UniqueDirectivesPerLocationRule
557
556
  },
558
557
  {
559
- category: "schema-and-operations",
558
+ category: ["Schema", "Operations"],
560
559
  description: "A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.",
561
560
  requiresSchema: true
562
561
  }
@@ -567,7 +566,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
567
566
  rule: UniqueFieldDefinitionNamesRule
568
567
  },
569
568
  {
570
- category: "schema",
569
+ category: "Schema",
571
570
  description: "A GraphQL complex type is only valid if all its fields are uniquely named."
572
571
  }
573
572
  ),
@@ -577,7 +576,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
577
576
  rule: UniqueInputFieldNamesRule
578
577
  },
579
578
  {
580
- category: "operations",
579
+ category: "Operations",
581
580
  description: "A GraphQL input object value is only valid if all supplied fields are uniquely named."
582
581
  }
583
582
  ),
@@ -587,7 +586,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
587
586
  rule: UniqueOperationTypesRule
588
587
  },
589
588
  {
590
- category: "schema",
589
+ category: "Schema",
591
590
  description: "A GraphQL document is only valid if it has only one type per operation."
592
591
  }
593
592
  ),
@@ -597,7 +596,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
597
596
  rule: UniqueTypeNamesRule
598
597
  },
599
598
  {
600
- category: "schema",
599
+ category: "Schema",
601
600
  description: "A GraphQL document is only valid if all defined types have unique names."
602
601
  }
603
602
  ),
@@ -607,7 +606,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
607
606
  rule: UniqueVariableNamesRule
608
607
  },
609
608
  {
610
- category: "operations",
609
+ category: "Operations",
611
610
  description: "A GraphQL operation is only valid if all its variables are uniquely named.",
612
611
  requiresSchema: true
613
612
  }
@@ -619,7 +618,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
619
618
  hasDidYouMeanSuggestions: true
620
619
  },
621
620
  {
622
- category: "operations",
621
+ category: "Operations",
623
622
  description: "A GraphQL document is only valid if all value literals are of the type expected at their position.",
624
623
  requiresSchema: true
625
624
  }
@@ -630,7 +629,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
630
629
  rule: VariablesAreInputTypesRule
631
630
  },
632
631
  {
633
- category: "operations",
632
+ category: "Operations",
634
633
  description: "A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).",
635
634
  requiresSchema: true
636
635
  }
@@ -641,7 +640,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
641
640
  rule: VariablesInAllowedPositionRule
642
641
  },
643
642
  {
644
- category: "operations",
643
+ category: "Operations",
645
644
  description: "Variables passed to field arguments conform to type.",
646
645
  requiresSchema: true
647
646
  }
@@ -7,6 +7,7 @@ import '../estree-converter/types.js';
7
7
  import '../siblings.js';
8
8
  import '@graphql-tools/utils';
9
9
  import 'graphql-config';
10
+ import 'json-schema-to-ts';
10
11
 
11
12
  declare const rules: {
12
13
  alphabetize: GraphQLESLintRule<{
@@ -1,10 +1,10 @@
1
1
  import { FromSchema } from 'json-schema-to-ts';
2
2
  import { GraphQLESLintRule } from '../../types.js';
3
3
  import 'eslint';
4
+ import 'estree';
4
5
  import 'graphql';
5
6
  import 'graphql-config';
6
7
  import '../../estree-converter/types.js';
7
- import 'estree';
8
8
  import '../../siblings.js';
9
9
  import '@graphql-tools/utils';
10
10
 
@@ -43,7 +43,7 @@ const rule = {
43
43
  hasSuggestions: true,
44
44
  docs: {
45
45
  description: 'Require mutation argument to be always called "input" and input type to be called Mutation name + "Input".\nUsing the same name for all input parameters will make your schemas easier to consume and more predictable. Using the same name as mutation for InputType will make it easier to find mutations that InputType belongs to.',
46
- category: "schema",
46
+ category: "Schema",
47
47
  url: "https://the-guild.dev/graphql/eslint/rules/input-name",
48
48
  examples: [
49
49
  {
@@ -105,7 +105,6 @@ const rule = {
105
105
  suggest: [
106
106
  {
107
107
  desc: "Rename to `input`",
108
- // @ts-expect-error -- fixme
109
108
  fix: (fixer) => fixer.replaceText(node, "input")
110
109
  }
111
110
  ]
@@ -133,7 +132,6 @@ const rule = {
133
132
  suggest: [
134
133
  {
135
134
  desc: `Rename to \`${mutationName}\``,
136
- // @ts-expect-error -- fixme
137
135
  fix: (fixer) => fixer.replaceText(node, mutationName)
138
136
  }
139
137
  ]