@graphql-eslint/eslint-plugin 4.4.0-alpha-20241207211207-bb82835bf9da71bdd9bedaeadb75c8c1625ecd87 → 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.
- package/cjs/graphql-config.d.cts +1 -2
- package/cjs/index.d.cts +1 -2
- package/cjs/meta.js +1 -1
- package/cjs/parser.d.cts +1 -2
- package/cjs/rules/alphabetize/index.d.cts +1 -1
- package/cjs/rules/alphabetize/index.js +2 -1
- package/cjs/rules/description-style/index.d.cts +1 -1
- package/cjs/rules/description-style/index.js +3 -1
- package/cjs/rules/graphql-js-validation.d.cts +1 -2
- package/cjs/rules/graphql-js-validation.js +31 -30
- package/cjs/rules/index.d.cts +1 -2
- package/cjs/rules/input-name/index.d.cts +1 -1
- package/cjs/rules/input-name/index.js +3 -1
- package/cjs/rules/lone-executable-definition/index.d.cts +1 -1
- package/cjs/rules/lone-executable-definition/index.js +2 -1
- package/cjs/rules/match-document-filename/index.d.cts +1 -1
- package/cjs/rules/match-document-filename/index.js +2 -1
- package/cjs/rules/naming-convention/index.d.cts +1 -1
- package/cjs/rules/naming-convention/index.js +3 -1
- package/cjs/rules/no-anonymous-operations/index.d.cts +1 -2
- package/cjs/rules/no-anonymous-operations/index.js +2 -1
- package/cjs/rules/no-deprecated/index.d.cts +1 -2
- package/cjs/rules/no-deprecated/index.js +2 -1
- package/cjs/rules/no-duplicate-fields/index.d.cts +1 -2
- package/cjs/rules/no-duplicate-fields/index.js +2 -1
- package/cjs/rules/no-hashtag-description/index.d.cts +1 -2
- package/cjs/rules/no-hashtag-description/index.js +2 -1
- package/cjs/rules/no-one-place-fragments/index.d.cts +1 -2
- package/cjs/rules/no-one-place-fragments/index.js +1 -1
- package/cjs/rules/no-root-type/index.d.cts +1 -1
- package/cjs/rules/no-root-type/index.js +3 -1
- package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +1 -2
- package/cjs/rules/no-scalar-result-type-on-mutation/index.js +2 -1
- package/cjs/rules/no-typename-prefix/index.d.cts +1 -2
- package/cjs/rules/no-typename-prefix/index.js +2 -1
- package/cjs/rules/no-unreachable-types/index.d.cts +1 -2
- package/cjs/rules/no-unreachable-types/index.js +2 -1
- package/cjs/rules/no-unused-fields/index.d.cts +1 -1
- package/cjs/rules/no-unused-fields/index.js +2 -1
- package/cjs/rules/relay-arguments/index.d.cts +1 -1
- package/cjs/rules/relay-arguments/index.js +1 -1
- package/cjs/rules/relay-connection-types/index.d.cts +1 -2
- package/cjs/rules/relay-connection-types/index.js +1 -1
- package/cjs/rules/relay-edge-types/index.d.cts +1 -1
- package/cjs/rules/relay-edge-types/index.js +1 -1
- package/cjs/rules/relay-page-info/index.d.cts +1 -2
- package/cjs/rules/relay-page-info/index.js +1 -1
- package/cjs/rules/require-deprecation-date/index.d.cts +1 -1
- package/cjs/rules/require-deprecation-date/index.js +2 -1
- package/cjs/rules/require-deprecation-reason/index.d.cts +1 -2
- package/cjs/rules/require-deprecation-reason/index.js +1 -1
- package/cjs/rules/require-description/index.d.cts +1 -1
- package/cjs/rules/require-description/index.js +2 -1
- package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +1 -2
- package/cjs/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
- package/cjs/rules/require-import-fragment/index.d.cts +1 -2
- package/cjs/rules/require-import-fragment/index.js +2 -1
- package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +1 -2
- package/cjs/rules/require-nullable-fields-with-oneof/index.js +1 -1
- package/cjs/rules/require-nullable-result-in-root/index.d.cts +1 -2
- package/cjs/rules/require-nullable-result-in-root/index.js +2 -1
- package/cjs/rules/require-selections/index.d.cts +1 -1
- package/cjs/rules/require-selections/index.js +8 -4
- package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +1 -2
- package/cjs/rules/require-type-pattern-with-oneof/index.js +1 -1
- package/cjs/rules/selection-set-depth/index.d.cts +1 -1
- package/cjs/rules/selection-set-depth/index.js +3 -1
- package/cjs/rules/strict-id-in-types/index.d.cts +1 -1
- package/cjs/rules/strict-id-in-types/index.js +5 -5
- package/cjs/rules/unique-enum-value-names/index.d.cts +1 -2
- package/cjs/rules/unique-enum-value-names/index.js +2 -1
- package/cjs/rules/unique-fragment-name/index.d.cts +0 -1
- package/cjs/rules/unique-fragment-name/index.js +1 -2
- package/cjs/rules/unique-operation-name/index.d.cts +1 -2
- package/cjs/rules/unique-operation-name/index.js +1 -1
- package/cjs/schema.d.cts +1 -2
- package/cjs/types.d.cts +7 -17
- package/cjs/utils.d.cts +2 -2
- package/cjs/utils.js +5 -1
- package/esm/graphql-config.d.ts +1 -2
- package/esm/index.d.ts +0 -1
- package/esm/meta.js +1 -1
- package/esm/parser.d.ts +1 -2
- package/esm/rules/alphabetize/index.d.ts +1 -1
- package/esm/rules/alphabetize/index.js +2 -1
- package/esm/rules/description-style/index.d.ts +1 -1
- package/esm/rules/description-style/index.js +3 -1
- package/esm/rules/graphql-js-validation.d.ts +1 -2
- package/esm/rules/graphql-js-validation.js +31 -30
- package/esm/rules/index.d.ts +0 -1
- package/esm/rules/input-name/index.d.ts +1 -1
- package/esm/rules/input-name/index.js +3 -1
- package/esm/rules/lone-executable-definition/index.d.ts +1 -1
- package/esm/rules/lone-executable-definition/index.js +2 -1
- package/esm/rules/match-document-filename/index.d.ts +1 -1
- package/esm/rules/match-document-filename/index.js +2 -1
- package/esm/rules/naming-convention/index.d.ts +1 -1
- package/esm/rules/naming-convention/index.js +3 -1
- package/esm/rules/no-anonymous-operations/index.d.ts +1 -2
- package/esm/rules/no-anonymous-operations/index.js +2 -1
- package/esm/rules/no-deprecated/index.d.ts +1 -2
- package/esm/rules/no-deprecated/index.js +2 -1
- package/esm/rules/no-duplicate-fields/index.d.ts +1 -2
- package/esm/rules/no-duplicate-fields/index.js +2 -1
- package/esm/rules/no-hashtag-description/index.d.ts +1 -2
- package/esm/rules/no-hashtag-description/index.js +2 -1
- package/esm/rules/no-one-place-fragments/index.d.ts +1 -2
- package/esm/rules/no-one-place-fragments/index.js +1 -1
- package/esm/rules/no-root-type/index.d.ts +1 -1
- package/esm/rules/no-root-type/index.js +3 -1
- package/esm/rules/no-scalar-result-type-on-mutation/index.d.ts +1 -2
- package/esm/rules/no-scalar-result-type-on-mutation/index.js +2 -1
- package/esm/rules/no-typename-prefix/index.d.ts +1 -2
- package/esm/rules/no-typename-prefix/index.js +2 -1
- package/esm/rules/no-unreachable-types/index.d.ts +1 -2
- package/esm/rules/no-unreachable-types/index.js +2 -1
- package/esm/rules/no-unused-fields/index.d.ts +1 -1
- package/esm/rules/no-unused-fields/index.js +2 -1
- package/esm/rules/relay-arguments/index.d.ts +1 -1
- package/esm/rules/relay-arguments/index.js +1 -1
- package/esm/rules/relay-connection-types/index.d.ts +1 -2
- package/esm/rules/relay-connection-types/index.js +1 -1
- package/esm/rules/relay-edge-types/index.d.ts +1 -1
- package/esm/rules/relay-edge-types/index.js +1 -1
- package/esm/rules/relay-page-info/index.d.ts +1 -2
- package/esm/rules/relay-page-info/index.js +1 -1
- package/esm/rules/require-deprecation-date/index.d.ts +1 -1
- package/esm/rules/require-deprecation-date/index.js +2 -1
- package/esm/rules/require-deprecation-reason/index.d.ts +1 -2
- package/esm/rules/require-deprecation-reason/index.js +1 -1
- package/esm/rules/require-description/index.d.ts +1 -1
- package/esm/rules/require-description/index.js +2 -1
- package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +1 -2
- package/esm/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
- package/esm/rules/require-import-fragment/index.d.ts +1 -2
- package/esm/rules/require-import-fragment/index.js +2 -1
- package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +1 -2
- package/esm/rules/require-nullable-fields-with-oneof/index.js +1 -1
- package/esm/rules/require-nullable-result-in-root/index.d.ts +1 -2
- package/esm/rules/require-nullable-result-in-root/index.js +2 -1
- package/esm/rules/require-selections/index.d.ts +1 -1
- package/esm/rules/require-selections/index.js +8 -4
- package/esm/rules/require-type-pattern-with-oneof/index.d.ts +1 -2
- package/esm/rules/require-type-pattern-with-oneof/index.js +1 -1
- package/esm/rules/selection-set-depth/index.d.ts +1 -1
- package/esm/rules/selection-set-depth/index.js +3 -1
- package/esm/rules/strict-id-in-types/index.d.ts +1 -1
- package/esm/rules/strict-id-in-types/index.js +5 -5
- package/esm/rules/unique-enum-value-names/index.d.ts +1 -2
- package/esm/rules/unique-enum-value-names/index.js +2 -1
- package/esm/rules/unique-fragment-name/index.d.ts +0 -1
- package/esm/rules/unique-fragment-name/index.js +1 -2
- package/esm/rules/unique-operation-name/index.d.ts +1 -2
- package/esm/rules/unique-operation-name/index.js +1 -1
- package/esm/schema.d.ts +1 -2
- package/esm/types.d.ts +7 -17
- package/esm/utils.d.ts +2 -2
- package/esm/utils.js +4 -0
- package/package.json +11 -1
- package/{index.browser.js → programmatic.js} +104 -73
package/cjs/graphql-config.d.cts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import { GraphQLConfig } from 'graphql-config';
|
2
2
|
import { ParserOptions } from './types.cjs';
|
3
3
|
import 'eslint';
|
4
|
-
import 'estree';
|
5
4
|
import 'graphql';
|
6
|
-
import 'json-schema-to-ts';
|
7
5
|
import './estree-converter/types.cjs';
|
6
|
+
import 'estree';
|
8
7
|
import './siblings.cjs';
|
9
8
|
import '@graphql-tools/utils';
|
10
9
|
|
package/cjs/index.d.cts
CHANGED
@@ -15,7 +15,6 @@ export { GraphQLESTreeNode } from './estree-converter/types.cjs';
|
|
15
15
|
import 'estree';
|
16
16
|
import './siblings.cjs';
|
17
17
|
import '@graphql-tools/utils';
|
18
|
-
import 'json-schema-to-ts';
|
19
18
|
|
20
19
|
declare const processors: {
|
21
20
|
graphql: {
|
@@ -48,10 +47,10 @@ declare const _default: {
|
|
48
47
|
};
|
49
48
|
rules: {
|
50
49
|
alphabetize: GraphQLESLintRule<{
|
50
|
+
values?: boolean | undefined;
|
51
51
|
definitions?: boolean | undefined;
|
52
52
|
selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
|
53
53
|
arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
|
54
|
-
values?: boolean | undefined;
|
55
54
|
fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
|
56
55
|
variables?: boolean | undefined;
|
57
56
|
groups?: string[] | undefined;
|
package/cjs/meta.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});const version = "4.4.0-alpha-
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});const version = "4.4.0-alpha-20241210121000-22133a7d66f4a5d831e5588ca0ce4fc789bca4ed";
|
2
2
|
|
3
3
|
|
4
4
|
exports.version = version;
|
package/cjs/parser.d.cts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import { ParserOptions, GraphQLESLintParseResult } from './types.cjs';
|
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.cjs';
|
6
|
+
import 'estree';
|
8
7
|
import './siblings.cjs';
|
9
8
|
import '@graphql-tools/utils';
|
10
9
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
2
|
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import 'eslint';
|
4
|
-
import 'estree';
|
5
4
|
import 'graphql';
|
6
5
|
import 'graphql-config';
|
7
6
|
import '../../estree-converter/types.cjs';
|
7
|
+
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
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:
|
83
|
+
category: "schema-and-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,6 +278,7 @@ const rule = {
|
|
278
278
|
currNode: _utilsjs.displayNodeName.call(void 0, currNode),
|
279
279
|
prevNode: prevName ? _utilsjs.displayNodeName.call(void 0, prevNode) : _lodashlowercase2.default.call(void 0, prevNode.kind)
|
280
280
|
},
|
281
|
+
// @ts-expect-error -- fixme
|
281
282
|
*fix(fixer) {
|
282
283
|
const prevRange = getRangeWithComments(prevNode);
|
283
284
|
const currRange = getRangeWithComments(currNode);
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
2
|
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import 'eslint';
|
4
|
-
import 'estree';
|
5
4
|
import 'graphql';
|
6
5
|
import 'graphql-config';
|
7
6
|
import '../../estree-converter/types.cjs';
|
7
|
+
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -48,10 +48,11 @@ const rule = {
|
|
48
48
|
}
|
49
49
|
],
|
50
50
|
description: "Require all comments to follow the same style (either block or inline).",
|
51
|
-
category: "
|
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
|
55
56
|
schema
|
56
57
|
},
|
57
58
|
create(context) {
|
@@ -67,6 +68,7 @@ const rule = {
|
|
67
68
|
suggest: [
|
68
69
|
{
|
69
70
|
desc: `Change to ${isBlock ? "block" : "inline"} style description`,
|
71
|
+
// @ts-expect-error -- fixme
|
70
72
|
fix(fixer) {
|
71
73
|
const sourceCode = context.getSourceCode();
|
72
74
|
const originalText = sourceCode.getText(node);
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../types.cjs';
|
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.cjs';
|
6
|
+
import 'estree';
|
8
7
|
import '../siblings.cjs';
|
9
8
|
import '@graphql-tools/utils';
|
10
9
|
|
@@ -78,6 +78,7 @@ function validateDocument({
|
|
78
78
|
const { name } = match.groups;
|
79
79
|
return {
|
80
80
|
desc: `Rename to \`${name}\``,
|
81
|
+
// @ts-expect-error -- fixme
|
81
82
|
fix: (fixer) => fixer.replaceText(token, name)
|
82
83
|
};
|
83
84
|
}) : []
|
@@ -179,7 +180,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
179
180
|
rule: _indexjs.ExecutableDefinitionsRule
|
180
181
|
},
|
181
182
|
{
|
182
|
-
category: "
|
183
|
+
category: "operations",
|
183
184
|
description: "A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.",
|
184
185
|
requiresSchema: true
|
185
186
|
}
|
@@ -191,7 +192,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
191
192
|
hasDidYouMeanSuggestions: true
|
192
193
|
},
|
193
194
|
{
|
194
|
-
category: "
|
195
|
+
category: "operations",
|
195
196
|
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`.",
|
196
197
|
requiresSchema: true
|
197
198
|
}
|
@@ -202,7 +203,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
202
203
|
rule: _indexjs.FragmentsOnCompositeTypesRule
|
203
204
|
},
|
204
205
|
{
|
205
|
-
category: "
|
206
|
+
category: "operations",
|
206
207
|
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.",
|
207
208
|
requiresSchema: true
|
208
209
|
}
|
@@ -214,7 +215,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
214
215
|
hasDidYouMeanSuggestions: true
|
215
216
|
},
|
216
217
|
{
|
217
|
-
category:
|
218
|
+
category: "schema-and-operations",
|
218
219
|
description: "A GraphQL field is only valid if all supplied arguments are defined by that field.",
|
219
220
|
requiresSchema: true
|
220
221
|
}
|
@@ -253,7 +254,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
253
254
|
}
|
254
255
|
},
|
255
256
|
{
|
256
|
-
category:
|
257
|
+
category: "schema-and-operations",
|
257
258
|
description: "A GraphQL document is only valid if all `@directive`s are known by the schema and legally positioned.",
|
258
259
|
requiresSchema: true,
|
259
260
|
examples: [
|
@@ -281,7 +282,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
281
282
|
getDocumentNode: handleMissingFragments
|
282
283
|
},
|
283
284
|
{
|
284
|
-
category: "
|
285
|
+
category: "operations",
|
285
286
|
description: "A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document.",
|
286
287
|
requiresSchema: true,
|
287
288
|
requiresSiblings: true,
|
@@ -349,7 +350,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
349
350
|
hasDidYouMeanSuggestions: true
|
350
351
|
},
|
351
352
|
{
|
352
|
-
category:
|
353
|
+
category: "schema-and-operations",
|
353
354
|
description: "A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.",
|
354
355
|
requiresSchema: true
|
355
356
|
}
|
@@ -360,7 +361,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
360
361
|
rule: _indexjs.LoneAnonymousOperationRule
|
361
362
|
},
|
362
363
|
{
|
363
|
-
category: "
|
364
|
+
category: "operations",
|
364
365
|
description: "A GraphQL document that contains an anonymous operation (the `query` short-hand) is only valid if it contains only that one operation definition.",
|
365
366
|
requiresSchema: true
|
366
367
|
}
|
@@ -371,7 +372,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
371
372
|
rule: _indexjs.LoneSchemaDefinitionRule
|
372
373
|
},
|
373
374
|
{
|
374
|
-
category: "
|
375
|
+
category: "schema",
|
375
376
|
description: "A GraphQL document is only valid if it contains only one schema definition."
|
376
377
|
}
|
377
378
|
),
|
@@ -381,7 +382,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
381
382
|
rule: _indexjs.NoFragmentCyclesRule
|
382
383
|
},
|
383
384
|
{
|
384
|
-
category: "
|
385
|
+
category: "operations",
|
385
386
|
description: "A GraphQL fragment is only valid when it does not have cycles in fragments usage.",
|
386
387
|
requiresSchema: true
|
387
388
|
}
|
@@ -393,7 +394,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
393
394
|
getDocumentNode: handleMissingFragments
|
394
395
|
},
|
395
396
|
{
|
396
|
-
category: "
|
397
|
+
category: "operations",
|
397
398
|
description: "A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.",
|
398
399
|
requiresSchema: true,
|
399
400
|
requiresSiblings: true
|
@@ -440,7 +441,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
440
441
|
}
|
441
442
|
},
|
442
443
|
{
|
443
|
-
category: "
|
444
|
+
category: "operations",
|
444
445
|
description: "A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.",
|
445
446
|
requiresSchema: true,
|
446
447
|
requiresSiblings: true
|
@@ -453,7 +454,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
453
454
|
getDocumentNode: handleMissingFragments
|
454
455
|
},
|
455
456
|
{
|
456
|
-
category: "
|
457
|
+
category: "operations",
|
457
458
|
description: "A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.",
|
458
459
|
requiresSchema: true,
|
459
460
|
requiresSiblings: true
|
@@ -465,7 +466,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
465
466
|
rule: _indexjs.OverlappingFieldsCanBeMergedRule
|
466
467
|
},
|
467
468
|
{
|
468
|
-
category: "
|
469
|
+
category: "operations",
|
469
470
|
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.",
|
470
471
|
requiresSchema: true
|
471
472
|
}
|
@@ -476,7 +477,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
476
477
|
rule: _indexjs.PossibleFragmentSpreadsRule
|
477
478
|
},
|
478
479
|
{
|
479
|
-
category: "
|
480
|
+
category: "operations",
|
480
481
|
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.",
|
481
482
|
requiresSchema: true
|
482
483
|
}
|
@@ -488,7 +489,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
488
489
|
hasDidYouMeanSuggestions: true
|
489
490
|
},
|
490
491
|
{
|
491
|
-
category: "
|
492
|
+
category: "schema",
|
492
493
|
description: "A type extension is only valid if the type is defined and has the same kind.",
|
493
494
|
recommended: true,
|
494
495
|
requiresSchema: true
|
@@ -500,7 +501,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
500
501
|
rule: _indexjs.ProvidedRequiredArgumentsRule
|
501
502
|
},
|
502
503
|
{
|
503
|
-
category:
|
504
|
+
category: "schema-and-operations",
|
504
505
|
description: "A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.",
|
505
506
|
requiresSchema: true
|
506
507
|
}
|
@@ -512,7 +513,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
512
513
|
hasDidYouMeanSuggestions: true
|
513
514
|
},
|
514
515
|
{
|
515
|
-
category: "
|
516
|
+
category: "operations",
|
516
517
|
description: "A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.",
|
517
518
|
requiresSchema: true
|
518
519
|
}
|
@@ -523,7 +524,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
523
524
|
rule: _indexjs.SingleFieldSubscriptionsRule
|
524
525
|
},
|
525
526
|
{
|
526
|
-
category: "
|
527
|
+
category: "operations",
|
527
528
|
description: "A GraphQL subscription is valid only if it contains a single root field.",
|
528
529
|
requiresSchema: true
|
529
530
|
}
|
@@ -534,7 +535,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
534
535
|
rule: _indexjs.UniqueArgumentNamesRule
|
535
536
|
},
|
536
537
|
{
|
537
|
-
category: "
|
538
|
+
category: "operations",
|
538
539
|
description: "A GraphQL field or directive is only valid if all supplied arguments are uniquely named.",
|
539
540
|
requiresSchema: true
|
540
541
|
}
|
@@ -545,7 +546,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
545
546
|
rule: _indexjs.UniqueDirectiveNamesRule
|
546
547
|
},
|
547
548
|
{
|
548
|
-
category: "
|
549
|
+
category: "schema",
|
549
550
|
description: "A GraphQL document is only valid if all defined directives have unique names."
|
550
551
|
}
|
551
552
|
),
|
@@ -555,7 +556,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
555
556
|
rule: _indexjs.UniqueDirectivesPerLocationRule
|
556
557
|
},
|
557
558
|
{
|
558
|
-
category:
|
559
|
+
category: "schema-and-operations",
|
559
560
|
description: "A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.",
|
560
561
|
requiresSchema: true
|
561
562
|
}
|
@@ -566,7 +567,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
566
567
|
rule: _indexjs.UniqueFieldDefinitionNamesRule
|
567
568
|
},
|
568
569
|
{
|
569
|
-
category: "
|
570
|
+
category: "schema",
|
570
571
|
description: "A GraphQL complex type is only valid if all its fields are uniquely named."
|
571
572
|
}
|
572
573
|
),
|
@@ -576,7 +577,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
576
577
|
rule: _indexjs.UniqueInputFieldNamesRule
|
577
578
|
},
|
578
579
|
{
|
579
|
-
category: "
|
580
|
+
category: "operations",
|
580
581
|
description: "A GraphQL input object value is only valid if all supplied fields are uniquely named."
|
581
582
|
}
|
582
583
|
),
|
@@ -586,7 +587,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
586
587
|
rule: _indexjs.UniqueOperationTypesRule
|
587
588
|
},
|
588
589
|
{
|
589
|
-
category: "
|
590
|
+
category: "schema",
|
590
591
|
description: "A GraphQL document is only valid if it has only one type per operation."
|
591
592
|
}
|
592
593
|
),
|
@@ -596,7 +597,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
596
597
|
rule: _indexjs.UniqueTypeNamesRule
|
597
598
|
},
|
598
599
|
{
|
599
|
-
category: "
|
600
|
+
category: "schema",
|
600
601
|
description: "A GraphQL document is only valid if all defined types have unique names."
|
601
602
|
}
|
602
603
|
),
|
@@ -606,7 +607,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
606
607
|
rule: _indexjs.UniqueVariableNamesRule
|
607
608
|
},
|
608
609
|
{
|
609
|
-
category: "
|
610
|
+
category: "operations",
|
610
611
|
description: "A GraphQL operation is only valid if all its variables are uniquely named.",
|
611
612
|
requiresSchema: true
|
612
613
|
}
|
@@ -618,7 +619,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
618
619
|
hasDidYouMeanSuggestions: true
|
619
620
|
},
|
620
621
|
{
|
621
|
-
category: "
|
622
|
+
category: "operations",
|
622
623
|
description: "A GraphQL document is only valid if all value literals are of the type expected at their position.",
|
623
624
|
requiresSchema: true
|
624
625
|
}
|
@@ -629,7 +630,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
629
630
|
rule: _indexjs.VariablesAreInputTypesRule
|
630
631
|
},
|
631
632
|
{
|
632
|
-
category: "
|
633
|
+
category: "operations",
|
633
634
|
description: "A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).",
|
634
635
|
requiresSchema: true
|
635
636
|
}
|
@@ -640,7 +641,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
|
|
640
641
|
rule: _indexjs.VariablesInAllowedPositionRule
|
641
642
|
},
|
642
643
|
{
|
643
|
-
category: "
|
644
|
+
category: "operations",
|
644
645
|
description: "Variables passed to field arguments conform to type.",
|
645
646
|
requiresSchema: true
|
646
647
|
}
|
package/cjs/rules/index.d.cts
CHANGED
@@ -7,14 +7,13 @@ import '../estree-converter/types.cjs';
|
|
7
7
|
import '../siblings.cjs';
|
8
8
|
import '@graphql-tools/utils';
|
9
9
|
import 'graphql-config';
|
10
|
-
import 'json-schema-to-ts';
|
11
10
|
|
12
11
|
declare const rules: {
|
13
12
|
alphabetize: GraphQLESLintRule<{
|
13
|
+
values?: boolean | undefined;
|
14
14
|
definitions?: boolean | undefined;
|
15
15
|
selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
|
16
16
|
arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
|
17
|
-
values?: boolean | undefined;
|
18
17
|
fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
|
19
18
|
variables?: boolean | undefined;
|
20
19
|
groups?: string[] | undefined;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
2
|
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import 'eslint';
|
4
|
-
import 'estree';
|
5
4
|
import 'graphql';
|
6
5
|
import 'graphql-config';
|
7
6
|
import '../../estree-converter/types.cjs';
|
7
|
+
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
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: "
|
46
|
+
category: "schema",
|
47
47
|
url: "https://the-guild.dev/graphql/eslint/rules/input-name",
|
48
48
|
examples: [
|
49
49
|
{
|
@@ -105,6 +105,7 @@ const rule = {
|
|
105
105
|
suggest: [
|
106
106
|
{
|
107
107
|
desc: "Rename to `input`",
|
108
|
+
// @ts-expect-error -- fixme
|
108
109
|
fix: (fixer) => fixer.replaceText(node, "input")
|
109
110
|
}
|
110
111
|
]
|
@@ -132,6 +133,7 @@ const rule = {
|
|
132
133
|
suggest: [
|
133
134
|
{
|
134
135
|
desc: `Rename to \`${mutationName}\``,
|
136
|
+
// @ts-expect-error -- fixme
|
135
137
|
fix: (fixer) => fixer.replaceText(node, mutationName)
|
136
138
|
}
|
137
139
|
]
|
@@ -2,9 +2,9 @@ import { OperationTypeNode } from 'graphql';
|
|
2
2
|
import { FromSchema } from 'json-schema-to-ts';
|
3
3
|
import { GraphQLESLintRule } from '../../types.cjs';
|
4
4
|
import 'eslint';
|
5
|
-
import 'estree';
|
6
5
|
import 'graphql-config';
|
7
6
|
import '../../estree-converter/types.cjs';
|
7
|
+
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -26,7 +26,7 @@ const rule = {
|
|
26
26
|
meta: {
|
27
27
|
type: "suggestion",
|
28
28
|
docs: {
|
29
|
-
category: "
|
29
|
+
category: "operations",
|
30
30
|
description: "Require queries, mutations, subscriptions or fragments to be located in separate files.",
|
31
31
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
32
32
|
examples: [
|
@@ -60,6 +60,7 @@ const rule = {
|
|
60
60
|
messages: {
|
61
61
|
[RULE_ID]: "{{name}} should be in a separate file."
|
62
62
|
},
|
63
|
+
// @ts-expect-error -- fixme
|
63
64
|
schema
|
64
65
|
},
|
65
66
|
create(context) {
|
@@ -2,10 +2,10 @@ import { FromSchema } from 'json-schema-to-ts';
|
|
2
2
|
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import { CaseStyle as CaseStyle$1 } from '../../utils.cjs';
|
4
4
|
import 'eslint';
|
5
|
-
import 'estree';
|
6
5
|
import 'graphql';
|
7
6
|
import 'graphql-config';
|
8
7
|
import '../../estree-converter/types.cjs';
|
8
|
+
import 'estree';
|
9
9
|
import '../../siblings.cjs';
|
10
10
|
import '@graphql-tools/utils';
|
11
11
|
|
@@ -56,7 +56,7 @@ const rule = {
|
|
56
56
|
meta: {
|
57
57
|
type: "suggestion",
|
58
58
|
docs: {
|
59
|
-
category: "
|
59
|
+
category: "operations",
|
60
60
|
description: "This rule allows you to enforce that the file name should match the operation name.",
|
61
61
|
url: "https://the-guild.dev/graphql/eslint/rules/match-document-filename",
|
62
62
|
examples: [
|
@@ -187,6 +187,7 @@ const rule = {
|
|
187
187
|
[MATCH_EXTENSION]: `File extension "{{ fileExtension }}" don't match extension "{{ expectedFileExtension }}"`,
|
188
188
|
[MATCH_STYLE]: 'Unexpected filename "{{ filename }}". Rename it to "{{ expectedFilename }}"'
|
189
189
|
},
|
190
|
+
// @ts-expect-error -- fixme
|
190
191
|
schema
|
191
192
|
},
|
192
193
|
create(context) {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
2
|
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import 'eslint';
|
4
|
-
import 'estree';
|
5
4
|
import 'graphql';
|
6
5
|
import 'graphql-config';
|
7
6
|
import '../../estree-converter/types.cjs';
|
7
|
+
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -135,7 +135,7 @@ const rule = {
|
|
135
135
|
type: "suggestion",
|
136
136
|
docs: {
|
137
137
|
description: "Require names to follow specified conventions.",
|
138
|
-
category:
|
138
|
+
category: "schema-and-operations",
|
139
139
|
recommended: true,
|
140
140
|
url: "https://the-guild.dev/graphql/eslint/rules/naming-convention",
|
141
141
|
examples: [
|
@@ -361,6 +361,7 @@ const rule = {
|
|
361
361
|
}
|
362
362
|
},
|
363
363
|
hasSuggestions: true,
|
364
|
+
// @ts-expect-error -- fixme
|
364
365
|
schema
|
365
366
|
},
|
366
367
|
create(context) {
|
@@ -377,6 +378,7 @@ const rule = {
|
|
377
378
|
message,
|
378
379
|
suggest: suggestedNames.map((suggestedName) => ({
|
379
380
|
desc: `Rename to \`${suggestedName}\``,
|
381
|
+
// @ts-expect-error -- fixme
|
380
382
|
fix: (fixer) => fixer.replaceText(node, suggestedName)
|
381
383
|
}))
|
382
384
|
});
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../../types.cjs';
|
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.cjs';
|
6
|
+
import 'estree';
|
8
7
|
import '../../siblings.cjs';
|
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: "
|
9
|
+
category: "operations",
|
10
10
|
description: "Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.",
|
11
11
|
recommended: true,
|
12
12
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
@@ -54,6 +54,7 @@ const rule = {
|
|
54
54
|
suggest: [
|
55
55
|
{
|
56
56
|
desc: `Rename to \`${suggestedName}\``,
|
57
|
+
// @ts-expect-error -- fixme
|
57
58
|
fix(fixer) {
|
58
59
|
const sourceCode = context.getSourceCode();
|
59
60
|
const hasQueryKeyword = sourceCode.getText({ range: [node.range[0], node.range[0] + 1] }) !== "{";
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../../types.cjs';
|
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.cjs';
|
6
|
+
import 'estree';
|
8
7
|
import '../../siblings.cjs';
|
9
8
|
import '@graphql-tools/utils';
|
10
9
|
|
@@ -5,7 +5,7 @@ const rule = {
|
|
5
5
|
type: "suggestion",
|
6
6
|
hasSuggestions: true,
|
7
7
|
docs: {
|
8
|
-
category: "
|
8
|
+
category: "operations",
|
9
9
|
description: "Enforce that deprecated fields or enum values are not in use by operations.",
|
10
10
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
11
11
|
requiresSchema: true,
|
@@ -101,6 +101,7 @@ const rule = {
|
|
101
101
|
suggest: [
|
102
102
|
{
|
103
103
|
desc: `Remove ${nodeType}`,
|
104
|
+
// @ts-expect-error -- fixme
|
104
105
|
fix: (fixer) => fixer.remove(node)
|
105
106
|
}
|
106
107
|
]
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../../types.cjs';
|
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.cjs';
|
6
|
+
import 'estree';
|
8
7
|
import '../../siblings.cjs';
|
9
8
|
import '@graphql-tools/utils';
|
10
9
|
|
@@ -6,7 +6,7 @@ const rule = {
|
|
6
6
|
hasSuggestions: true,
|
7
7
|
docs: {
|
8
8
|
description: "Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.",
|
9
|
-
category: "
|
9
|
+
category: "operations",
|
10
10
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
11
11
|
recommended: true,
|
12
12
|
examples: [
|
@@ -81,6 +81,7 @@ const rule = {
|
|
81
81
|
suggest: [
|
82
82
|
{
|
83
83
|
desc: `Remove \`${fieldName}\` ${parent.type.toLowerCase()}`,
|
84
|
+
// @ts-expect-error -- fixme
|
84
85
|
fix(fixer) {
|
85
86
|
return fixer.remove(
|
86
87
|
parent.type === _graphql.Kind.VARIABLE ? parent.parent : parent
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../../types.cjs';
|
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.cjs';
|
6
|
+
import 'estree';
|
8
7
|
import '../../siblings.cjs';
|
9
8
|
import '@graphql-tools/utils';
|
10
9
|
|