@graphql-eslint/eslint-plugin 4.4.0-alpha-20241207210859-41eb4549764dc0314b5bd4f257ea6667b178540e → 4.4.0-alpha-20241210121000-22133a7d66f4a5d831e5588ca0ce4fc789bca4ed

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 (160) hide show
  1. package/cjs/graphql-config.d.cts +1 -2
  2. package/cjs/index.d.cts +1 -2
  3. package/cjs/meta.js +1 -1
  4. package/cjs/parser.d.cts +1 -2
  5. package/cjs/rules/alphabetize/index.d.cts +1 -1
  6. package/cjs/rules/alphabetize/index.js +2 -1
  7. package/cjs/rules/description-style/index.d.cts +1 -1
  8. package/cjs/rules/description-style/index.js +3 -1
  9. package/cjs/rules/graphql-js-validation.d.cts +1 -2
  10. package/cjs/rules/graphql-js-validation.js +31 -30
  11. package/cjs/rules/index.d.cts +1 -2
  12. package/cjs/rules/input-name/index.d.cts +1 -1
  13. package/cjs/rules/input-name/index.js +3 -1
  14. package/cjs/rules/lone-executable-definition/index.d.cts +1 -1
  15. package/cjs/rules/lone-executable-definition/index.js +2 -1
  16. package/cjs/rules/match-document-filename/index.d.cts +1 -1
  17. package/cjs/rules/match-document-filename/index.js +2 -1
  18. package/cjs/rules/naming-convention/index.d.cts +1 -1
  19. package/cjs/rules/naming-convention/index.js +3 -1
  20. package/cjs/rules/no-anonymous-operations/index.d.cts +1 -2
  21. package/cjs/rules/no-anonymous-operations/index.js +2 -1
  22. package/cjs/rules/no-deprecated/index.d.cts +1 -2
  23. package/cjs/rules/no-deprecated/index.js +2 -1
  24. package/cjs/rules/no-duplicate-fields/index.d.cts +1 -2
  25. package/cjs/rules/no-duplicate-fields/index.js +2 -1
  26. package/cjs/rules/no-hashtag-description/index.d.cts +1 -2
  27. package/cjs/rules/no-hashtag-description/index.js +2 -1
  28. package/cjs/rules/no-one-place-fragments/index.d.cts +1 -2
  29. package/cjs/rules/no-one-place-fragments/index.js +1 -1
  30. package/cjs/rules/no-root-type/index.d.cts +1 -1
  31. package/cjs/rules/no-root-type/index.js +3 -1
  32. package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +1 -2
  33. package/cjs/rules/no-scalar-result-type-on-mutation/index.js +2 -1
  34. package/cjs/rules/no-typename-prefix/index.d.cts +1 -2
  35. package/cjs/rules/no-typename-prefix/index.js +2 -1
  36. package/cjs/rules/no-unreachable-types/index.d.cts +1 -2
  37. package/cjs/rules/no-unreachable-types/index.js +2 -1
  38. package/cjs/rules/no-unused-fields/index.d.cts +1 -1
  39. package/cjs/rules/no-unused-fields/index.js +2 -1
  40. package/cjs/rules/relay-arguments/index.d.cts +1 -1
  41. package/cjs/rules/relay-arguments/index.js +1 -1
  42. package/cjs/rules/relay-connection-types/index.d.cts +1 -2
  43. package/cjs/rules/relay-connection-types/index.js +1 -1
  44. package/cjs/rules/relay-edge-types/index.d.cts +1 -1
  45. package/cjs/rules/relay-edge-types/index.js +1 -1
  46. package/cjs/rules/relay-page-info/index.d.cts +1 -2
  47. package/cjs/rules/relay-page-info/index.js +1 -1
  48. package/cjs/rules/require-deprecation-date/index.d.cts +1 -1
  49. package/cjs/rules/require-deprecation-date/index.js +2 -1
  50. package/cjs/rules/require-deprecation-reason/index.d.cts +1 -2
  51. package/cjs/rules/require-deprecation-reason/index.js +1 -1
  52. package/cjs/rules/require-description/index.d.cts +1 -1
  53. package/cjs/rules/require-description/index.js +2 -1
  54. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +1 -2
  55. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
  56. package/cjs/rules/require-import-fragment/index.d.cts +1 -2
  57. package/cjs/rules/require-import-fragment/index.js +2 -1
  58. package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +1 -2
  59. package/cjs/rules/require-nullable-fields-with-oneof/index.js +1 -1
  60. package/cjs/rules/require-nullable-result-in-root/index.d.cts +1 -2
  61. package/cjs/rules/require-nullable-result-in-root/index.js +2 -1
  62. package/cjs/rules/require-selections/index.d.cts +1 -1
  63. package/cjs/rules/require-selections/index.js +8 -4
  64. package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +1 -2
  65. package/cjs/rules/require-type-pattern-with-oneof/index.js +1 -1
  66. package/cjs/rules/selection-set-depth/index.d.cts +1 -1
  67. package/cjs/rules/selection-set-depth/index.js +3 -1
  68. package/cjs/rules/strict-id-in-types/index.d.cts +1 -1
  69. package/cjs/rules/strict-id-in-types/index.js +5 -5
  70. package/cjs/rules/unique-enum-value-names/index.d.cts +1 -2
  71. package/cjs/rules/unique-enum-value-names/index.js +2 -1
  72. package/cjs/rules/unique-fragment-name/index.d.cts +0 -1
  73. package/cjs/rules/unique-fragment-name/index.js +1 -2
  74. package/cjs/rules/unique-operation-name/index.d.cts +1 -2
  75. package/cjs/rules/unique-operation-name/index.js +1 -1
  76. package/cjs/schema.d.cts +1 -2
  77. package/cjs/types.d.cts +7 -17
  78. package/cjs/utils.d.cts +2 -2
  79. package/cjs/utils.js +5 -1
  80. package/esm/graphql-config.d.ts +1 -2
  81. package/esm/index.d.ts +0 -1
  82. package/esm/meta.js +1 -1
  83. package/esm/parser.d.ts +1 -2
  84. package/esm/rules/alphabetize/index.d.ts +1 -1
  85. package/esm/rules/alphabetize/index.js +2 -1
  86. package/esm/rules/description-style/index.d.ts +1 -1
  87. package/esm/rules/description-style/index.js +3 -1
  88. package/esm/rules/graphql-js-validation.d.ts +1 -2
  89. package/esm/rules/graphql-js-validation.js +31 -30
  90. package/esm/rules/index.d.ts +0 -1
  91. package/esm/rules/input-name/index.d.ts +1 -1
  92. package/esm/rules/input-name/index.js +3 -1
  93. package/esm/rules/lone-executable-definition/index.d.ts +1 -1
  94. package/esm/rules/lone-executable-definition/index.js +2 -1
  95. package/esm/rules/match-document-filename/index.d.ts +1 -1
  96. package/esm/rules/match-document-filename/index.js +2 -1
  97. package/esm/rules/naming-convention/index.d.ts +1 -1
  98. package/esm/rules/naming-convention/index.js +3 -1
  99. package/esm/rules/no-anonymous-operations/index.d.ts +1 -2
  100. package/esm/rules/no-anonymous-operations/index.js +2 -1
  101. package/esm/rules/no-deprecated/index.d.ts +1 -2
  102. package/esm/rules/no-deprecated/index.js +2 -1
  103. package/esm/rules/no-duplicate-fields/index.d.ts +1 -2
  104. package/esm/rules/no-duplicate-fields/index.js +2 -1
  105. package/esm/rules/no-hashtag-description/index.d.ts +1 -2
  106. package/esm/rules/no-hashtag-description/index.js +2 -1
  107. package/esm/rules/no-one-place-fragments/index.d.ts +1 -2
  108. package/esm/rules/no-one-place-fragments/index.js +1 -1
  109. package/esm/rules/no-root-type/index.d.ts +1 -1
  110. package/esm/rules/no-root-type/index.js +3 -1
  111. package/esm/rules/no-scalar-result-type-on-mutation/index.d.ts +1 -2
  112. package/esm/rules/no-scalar-result-type-on-mutation/index.js +2 -1
  113. package/esm/rules/no-typename-prefix/index.d.ts +1 -2
  114. package/esm/rules/no-typename-prefix/index.js +2 -1
  115. package/esm/rules/no-unreachable-types/index.d.ts +1 -2
  116. package/esm/rules/no-unreachable-types/index.js +2 -1
  117. package/esm/rules/no-unused-fields/index.d.ts +1 -1
  118. package/esm/rules/no-unused-fields/index.js +2 -1
  119. package/esm/rules/relay-arguments/index.d.ts +1 -1
  120. package/esm/rules/relay-arguments/index.js +1 -1
  121. package/esm/rules/relay-connection-types/index.d.ts +1 -2
  122. package/esm/rules/relay-connection-types/index.js +1 -1
  123. package/esm/rules/relay-edge-types/index.d.ts +1 -1
  124. package/esm/rules/relay-edge-types/index.js +1 -1
  125. package/esm/rules/relay-page-info/index.d.ts +1 -2
  126. package/esm/rules/relay-page-info/index.js +1 -1
  127. package/esm/rules/require-deprecation-date/index.d.ts +1 -1
  128. package/esm/rules/require-deprecation-date/index.js +2 -1
  129. package/esm/rules/require-deprecation-reason/index.d.ts +1 -2
  130. package/esm/rules/require-deprecation-reason/index.js +1 -1
  131. package/esm/rules/require-description/index.d.ts +1 -1
  132. package/esm/rules/require-description/index.js +2 -1
  133. package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +1 -2
  134. package/esm/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
  135. package/esm/rules/require-import-fragment/index.d.ts +1 -2
  136. package/esm/rules/require-import-fragment/index.js +2 -1
  137. package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +1 -2
  138. package/esm/rules/require-nullable-fields-with-oneof/index.js +1 -1
  139. package/esm/rules/require-nullable-result-in-root/index.d.ts +1 -2
  140. package/esm/rules/require-nullable-result-in-root/index.js +2 -1
  141. package/esm/rules/require-selections/index.d.ts +1 -1
  142. package/esm/rules/require-selections/index.js +8 -4
  143. package/esm/rules/require-type-pattern-with-oneof/index.d.ts +1 -2
  144. package/esm/rules/require-type-pattern-with-oneof/index.js +1 -1
  145. package/esm/rules/selection-set-depth/index.d.ts +1 -1
  146. package/esm/rules/selection-set-depth/index.js +3 -1
  147. package/esm/rules/strict-id-in-types/index.d.ts +1 -1
  148. package/esm/rules/strict-id-in-types/index.js +5 -5
  149. package/esm/rules/unique-enum-value-names/index.d.ts +1 -2
  150. package/esm/rules/unique-enum-value-names/index.js +2 -1
  151. package/esm/rules/unique-fragment-name/index.d.ts +0 -1
  152. package/esm/rules/unique-fragment-name/index.js +1 -2
  153. package/esm/rules/unique-operation-name/index.d.ts +1 -2
  154. package/esm/rules/unique-operation-name/index.js +1 -1
  155. package/esm/schema.d.ts +1 -2
  156. package/esm/types.d.ts +7 -17
  157. package/esm/utils.d.ts +2 -2
  158. package/esm/utils.js +4 -0
  159. package/package.json +11 -1
  160. package/{index.browser.js → programmatic.js} +104 -73
@@ -5,7 +5,7 @@ const rule = {
5
5
  meta: {
6
6
  type: "suggestion",
7
7
  docs: {
8
- category: "Schema",
8
+ category: "schema",
9
9
  description: "Require `input` or `type` fields to be non-nullable with `@oneOf` directive.",
10
10
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
11
11
  examples: [
@@ -1,10 +1,9 @@
1
1
  import { GraphQLESLintRule } from '../../types.js';
2
2
  import 'eslint';
3
- import 'estree';
4
3
  import 'graphql';
5
4
  import 'graphql-config';
6
- import 'json-schema-to-ts';
7
5
  import '../../estree-converter/types.js';
6
+ import 'estree';
8
7
  import '../../siblings.js';
9
8
  import '@graphql-tools/utils';
10
9
 
@@ -6,7 +6,7 @@ const rule = {
6
6
  type: "suggestion",
7
7
  hasSuggestions: true,
8
8
  docs: {
9
- category: "Schema",
9
+ category: "schema",
10
10
  description: "Require nullable fields in root types.",
11
11
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
12
12
  requiresSchema: true,
@@ -67,6 +67,7 @@ const rule = {
67
67
  suggest: [
68
68
  {
69
69
  desc: `Make ${resultType} nullable`,
70
+ // @ts-expect-error -- fixme
70
71
  fix(fixer) {
71
72
  const text = sourceCode.getText(field.gqlType);
72
73
  return fixer.replaceText(field.gqlType, text.replace("!", ""));
@@ -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';
5
4
  import 'graphql';
6
5
  import 'graphql-config';
7
6
  import '../../estree-converter/types.js';
7
+ import 'estree';
8
8
  import '../../siblings.js';
9
9
  import '@graphql-tools/utils';
10
10
 
@@ -12,6 +12,7 @@ import { getBaseType } from "../../estree-converter/index.js";
12
12
  import {
13
13
  ARRAY_DEFAULT_OPTIONS,
14
14
  englishJoinWords,
15
+ pluralize,
15
16
  requireGraphQLOperations,
16
17
  requireGraphQLSchema
17
18
  } from "../../utils.js";
@@ -46,7 +47,7 @@ const rule = {
46
47
  type: "suggestion",
47
48
  hasSuggestions: true,
48
49
  docs: {
49
- category: "Operations",
50
+ category: "operations",
50
51
  description: "Enforce selecting specific fields when they are available on the GraphQL type.",
51
52
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
52
53
  requiresSchema: true,
@@ -107,6 +108,7 @@ const rule = {
107
108
  messages: {
108
109
  [RULE_ID]: "Field{{ pluralSuffix }} {{ fieldName }} must be selected when it's available on a type.\nInclude it in your selection set{{ addition }}."
109
110
  },
111
+ // @ts-expect-error -- fixme
110
112
  schema
111
113
  },
112
114
  create(context) {
@@ -212,13 +214,14 @@ const rule = {
212
214
  const fieldName2 = englishJoinWords(
213
215
  idNames2.map((name) => `\`${(parent.alias || parent.name).value}.${name}\``)
214
216
  );
215
- const pluralSuffix = idNames2.length > 1 ? "s" : "";
216
- const addition = checkedFragmentSpreads.size === 0 ? "" : ` or add to used fragment${checkedFragmentSpreads.size > 1 ? "s" : ""} ${englishJoinWords([...checkedFragmentSpreads].map((name) => `\`${name}\``))}`;
217
+ const addition = checkedFragmentSpreads.size === 0 ? "" : ` or add to used fragment${pluralize(
218
+ checkedFragmentSpreads.size
219
+ )} ${englishJoinWords([...checkedFragmentSpreads].map((name) => `\`${name}\``))}`;
217
220
  const problem = {
218
221
  loc,
219
222
  messageId: RULE_ID,
220
223
  data: {
221
- pluralSuffix,
224
+ pluralSuffix: pluralize(idNames2.length),
222
225
  fieldName: fieldName2,
223
226
  addition
224
227
  }
@@ -226,6 +229,7 @@ const rule = {
226
229
  if ("type" in node) {
227
230
  problem.suggest = idNames2.map((idName) => ({
228
231
  desc: `Add \`${idName}\` selection`,
232
+ // @ts-expect-error -- fixme
229
233
  fix: (fixer) => {
230
234
  let insertNode = node.selections[0];
231
235
  insertNode = insertNode.kind === Kind.INLINE_FRAGMENT ? insertNode.selectionSet.selections[0] : insertNode;
@@ -1,10 +1,9 @@
1
1
  import { GraphQLESLintRule } from '../../types.js';
2
2
  import 'eslint';
3
- import 'estree';
4
3
  import 'graphql';
5
4
  import 'graphql-config';
6
- import 'json-schema-to-ts';
7
5
  import '../../estree-converter/types.js';
6
+ import 'estree';
8
7
  import '../../siblings.js';
9
8
  import '@graphql-tools/utils';
10
9
 
@@ -4,7 +4,7 @@ const rule = {
4
4
  meta: {
5
5
  type: "suggestion",
6
6
  docs: {
7
- category: "Schema",
7
+ category: "schema",
8
8
  description: "Enforce types with `@oneOf` directive have `error` and `ok` fields.",
9
9
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
10
10
  examples: [
@@ -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';
5
4
  import 'graphql';
6
5
  import 'graphql-config';
7
6
  import '../../estree-converter/types.js';
7
+ import 'estree';
8
8
  import '../../siblings.js';
9
9
  import '@graphql-tools/utils';
10
10
 
@@ -23,7 +23,7 @@ const rule = {
23
23
  type: "suggestion",
24
24
  hasSuggestions: true,
25
25
  docs: {
26
- category: "Operations",
26
+ category: "operations",
27
27
  description: "Limit the complexity of the GraphQL operations solely by their depth. Based on [graphql-depth-limit](https://npmjs.com/package/graphql-depth-limit).",
28
28
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
29
29
  requiresSiblings: true,
@@ -71,6 +71,7 @@ const rule = {
71
71
  recommended: true,
72
72
  configOptions: [{ maxDepth: 7 }]
73
73
  },
74
+ // @ts-expect-error -- fixme
74
75
  schema
75
76
  },
76
77
  create(context) {
@@ -112,6 +113,7 @@ const rule = {
112
113
  suggest: [
113
114
  {
114
115
  desc: "Remove selections",
116
+ // @ts-expect-error -- fixme
115
117
  fix(fixer) {
116
118
  const sourceCode = context.getSourceCode();
117
119
  const foundNode = sourceCode.getNodeByRangeIndex(token.range[0]);
@@ -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';
5
4
  import 'graphql';
6
5
  import 'graphql-config';
7
6
  import '../../estree-converter/types.js';
7
+ import 'estree';
8
8
  import '../../siblings.js';
9
9
  import '@graphql-tools/utils';
10
10
 
@@ -3,6 +3,7 @@ import {
3
3
  ARRAY_DEFAULT_OPTIONS,
4
4
  displayNodeName,
5
5
  englishJoinWords,
6
+ pluralize,
6
7
  requireGraphQLSchema
7
8
  } from "../../utils.js";
8
9
  const RULE_ID = "strict-id-in-types";
@@ -43,7 +44,7 @@ const rule = {
43
44
  type: "suggestion",
44
45
  docs: {
45
46
  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.",
46
- category: "Schema",
47
+ category: "schema",
47
48
  recommended: true,
48
49
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
49
50
  requiresSchema: true,
@@ -115,6 +116,7 @@ const rule = {
115
116
  }
116
117
  ]
117
118
  },
119
+ // @ts-expect-error -- fixme
118
120
  schema
119
121
  },
120
122
  create(context) {
@@ -148,13 +150,11 @@ const rule = {
148
150
  return isValidIdName && isValidIdType;
149
151
  });
150
152
  if (validIds?.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: `${displayNodeName(node)} must have exactly one non-nullable unique identifier.
156
- Accepted name${pluralNamesSuffix}: ${englishJoinWords(options.acceptedIdNames)}.
157
- Accepted type${pluralTypesSuffix}: ${englishJoinWords(options.acceptedIdTypes)}.`
156
+ Accepted name${pluralize(options.acceptedIdNames.length)}: ${englishJoinWords(options.acceptedIdNames)}.
157
+ Accepted type${pluralize(options.acceptedIdTypes.length)}: ${englishJoinWords(options.acceptedIdTypes)}.`
158
158
  });
159
159
  }
160
160
  }
@@ -1,10 +1,9 @@
1
1
  import { GraphQLESLintRule } from '../../types.js';
2
2
  import 'eslint';
3
- import 'estree';
4
3
  import 'graphql';
5
4
  import 'graphql-config';
6
- import 'json-schema-to-ts';
7
5
  import '../../estree-converter/types.js';
6
+ import 'estree';
8
7
  import '../../siblings.js';
9
8
  import '@graphql-tools/utils';
10
9
 
@@ -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,6 +58,7 @@ const rule = {
58
58
  suggest: [
59
59
  {
60
60
  desc: `Remove \`${enumName}\` enum value`,
61
+ // @ts-expect-error -- fixme
61
62
  fix: (fixer) => fixer.remove(duplicate)
62
63
  }
63
64
  ]
@@ -4,7 +4,6 @@ import { GraphQLESLintRuleContext, GraphQLESLintRule } from '../../types.js';
4
4
  import 'eslint';
5
5
  import 'estree';
6
6
  import 'graphql-config';
7
- import 'json-schema-to-ts';
8
7
  import '../../siblings.js';
9
8
  import '@graphql-tools/utils';
10
9
 
@@ -19,7 +19,6 @@ const checkNode = (context, node, ruleId) => {
19
19
  documentName,
20
20
  summary: conflictingDocuments.map((f) => ` ${relative(CWD, f.filePath.replace(VIRTUAL_DOCUMENT_REGEX, ""))}`).join("\n")
21
21
  },
22
- // @ts-expect-error name will exist
23
22
  node: node.name
24
23
  });
25
24
  }
@@ -28,7 +27,7 @@ const rule = {
28
27
  meta: {
29
28
  type: "suggestion",
30
29
  docs: {
31
- category: "Operations",
30
+ category: "operations",
32
31
  description: "Enforce unique fragment names across your project.",
33
32
  url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
34
33
  requiresSiblings: true,
@@ -1,10 +1,9 @@
1
1
  import { GraphQLESLintRule } from '../../types.js';
2
2
  import 'eslint';
3
- import 'estree';
4
3
  import 'graphql';
5
4
  import 'graphql-config';
6
- import 'json-schema-to-ts';
7
5
  import '../../estree-converter/types.js';
6
+ import 'estree';
8
7
  import '../../siblings.js';
9
8
  import '@graphql-tools/utils';
10
9
 
@@ -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/esm/schema.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { GraphQLProjectConfig } from 'graphql-config';
2
2
  import { Schema } from './types.js';
3
3
  import 'eslint';
4
- import 'estree';
5
4
  import 'graphql';
6
- import 'json-schema-to-ts';
7
5
  import './estree-converter/types.js';
6
+ import 'estree';
8
7
  import './siblings.js';
9
8
  import '@graphql-tools/utils';
10
9
 
package/esm/types.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { Linter, Rule, AST } from 'eslint';
2
- import * as ESTree from 'estree';
1
+ import { Linter, Rule } from 'eslint';
3
2
  import { GraphQLSchema, ASTKindToNode } from 'graphql';
4
3
  import { IGraphQLConfig } from 'graphql-config';
5
- import { JSONSchema } from 'json-schema-to-ts';
6
4
  import { GraphQLESTreeNode } from './estree-converter/types.js';
7
5
  import { SiblingOperations } from './siblings.js';
6
+ import 'estree';
8
7
  import '@graphql-tools/utils';
9
8
 
10
9
  type Schema = GraphQLSchema | null;
@@ -21,24 +20,16 @@ type ParserServices = {
21
20
  type GraphQLESLintParseResult = Linter.ESLintParseResult & {
22
21
  services: ParserServices;
23
22
  };
24
- type Location = AST.SourceLocation | ESTree.Position;
25
- type ReportDescriptorLocation = {
26
- loc: Location;
27
- } | {
28
- node: {
29
- loc: Location;
30
- };
31
- };
23
+ type ReportDescriptorLocation = any;
32
24
  type ReportDescriptor = ReportDescriptorLocation & Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions;
33
- type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'options' | 'parserServices' | 'report'> & {
25
+ type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'options' | 'report'> & {
34
26
  options: Options;
35
- parserServices: ParserServices;
36
27
  report(descriptor: ReportDescriptor): void;
37
28
  };
38
- type CategoryType = 'Operations' | 'Schema';
29
+ type CategoryType = 'schema' | 'operations' | 'schema-and-operations';
39
30
  type RuleMetaDataDocs = Required<Rule.RuleMetaData>['docs'];
40
31
  type RuleDocsInfo<T> = Omit<RuleMetaDataDocs, 'category' | 'suggestion'> & {
41
- category: CategoryType | CategoryType[];
32
+ category?: string;
42
33
  requiresSchema?: true;
43
34
  requiresSiblings?: true;
44
35
  examples?: {
@@ -58,9 +49,8 @@ type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = Record<st
58
49
  [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
59
50
  };
60
51
  type GraphQLESLintRule<Options = [], WithTypeInfo extends boolean = false> = {
61
- meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & {
52
+ meta?: Omit<Rule.RuleMetaData, 'docs'> & {
62
53
  docs?: RuleDocsInfo<Options>;
63
- schema: Readonly<JSONSchema> | [];
64
54
  };
65
55
  create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
66
56
  };
package/esm/utils.d.ts CHANGED
@@ -6,7 +6,6 @@ import { SiblingOperations } from './siblings.js';
6
6
  import { GraphQLESLintRuleContext } from './types.js';
7
7
  import '@graphql-tools/utils';
8
8
  import 'graphql-config';
9
- import 'json-schema-to-ts';
10
9
 
11
10
  declare function requireGraphQLOperations(ruleId: string, context: GraphQLESLintRuleContext): SiblingOperations | never;
12
11
  declare function requireGraphQLSchema(ruleId: string, context: GraphQLESLintRuleContext): GraphQLSchema | never;
@@ -40,5 +39,6 @@ declare const englishJoinWords: (words: string[]) => string;
40
39
  declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
41
40
  declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
42
41
  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, 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, pluralize, requireGraphQLOperations, requireGraphQLSchema, slash };
package/esm/utils.js CHANGED
@@ -158,6 +158,9 @@ 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
+ }
161
164
  export {
162
165
  ARRAY_DEFAULT_OPTIONS,
163
166
  CWD,
@@ -174,6 +177,7 @@ export {
174
177
  getTypeName,
175
178
  logger,
176
179
  pascalCase,
180
+ pluralize,
177
181
  requireGraphQLOperations,
178
182
  requireGraphQLSchema,
179
183
  slash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "4.4.0-alpha-20241207210859-41eb4549764dc0314b5bd4f257ea6667b178540e",
3
+ "version": "4.4.0-alpha-20241210121000-22133a7d66f4a5d831e5588ca0ce4fc789bca4ed",
4
4
  "type": "module",
5
5
  "description": "GraphQL plugin for ESLint",
6
6
  "repository": "https://github.com/dimaMachina/graphql-eslint",
@@ -20,6 +20,16 @@
20
20
  "types": "./esm/index.d.ts",
21
21
  "default": "./esm/index.js"
22
22
  }
23
+ },
24
+ "./*": {
25
+ "require": {
26
+ "types": "./cjs/*.d.cts",
27
+ "default": "./cjs/*.js"
28
+ },
29
+ "import": {
30
+ "types": "./esm/*.d.ts",
31
+ "default": "./esm/*.js"
32
+ }
23
33
  }
24
34
  },
25
35
  "types": "esm/index.d.ts",