@graphql-eslint/eslint-plugin 4.4.0-alpha-20241210130004-c86c74902285624344165bb32d972962226b7df8 → 4.4.0-alpha-20241210205144-662e65e39b519504be52c4dba23aaa08280b6322
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/{programmatic.js → browser.js} +73 -104
- package/cjs/graphql-config.d.cts +2 -1
- package/cjs/index.d.cts +1 -0
- package/cjs/meta.js +1 -1
- package/cjs/parser.d.cts +2 -1
- package/cjs/rules/alphabetize/index.d.cts +1 -1
- package/cjs/rules/alphabetize/index.js +1 -2
- package/cjs/rules/description-style/index.d.cts +1 -1
- package/cjs/rules/description-style/index.js +1 -3
- package/cjs/rules/graphql-js-validation.d.cts +2 -1
- package/cjs/rules/graphql-js-validation.js +30 -31
- package/cjs/rules/index.d.cts +1 -0
- package/cjs/rules/input-name/index.d.cts +1 -1
- package/cjs/rules/input-name/index.js +1 -3
- package/cjs/rules/lone-executable-definition/index.d.cts +1 -1
- package/cjs/rules/lone-executable-definition/index.js +1 -2
- package/cjs/rules/match-document-filename/index.d.cts +1 -1
- package/cjs/rules/match-document-filename/index.js +1 -2
- package/cjs/rules/naming-convention/index.d.cts +1 -1
- package/cjs/rules/naming-convention/index.js +1 -3
- package/cjs/rules/no-anonymous-operations/index.d.cts +2 -1
- package/cjs/rules/no-anonymous-operations/index.js +1 -2
- package/cjs/rules/no-deprecated/index.d.cts +2 -1
- package/cjs/rules/no-deprecated/index.js +1 -2
- package/cjs/rules/no-duplicate-fields/index.d.cts +2 -1
- package/cjs/rules/no-duplicate-fields/index.js +1 -2
- package/cjs/rules/no-hashtag-description/index.d.cts +2 -1
- package/cjs/rules/no-hashtag-description/index.js +1 -2
- package/cjs/rules/no-one-place-fragments/index.d.cts +2 -1
- 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 +1 -3
- package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +2 -1
- package/cjs/rules/no-scalar-result-type-on-mutation/index.js +1 -2
- package/cjs/rules/no-typename-prefix/index.d.cts +2 -1
- package/cjs/rules/no-typename-prefix/index.js +1 -2
- package/cjs/rules/no-unreachable-types/index.d.cts +2 -1
- package/cjs/rules/no-unreachable-types/index.js +1 -2
- package/cjs/rules/no-unused-fields/index.d.cts +1 -1
- package/cjs/rules/no-unused-fields/index.js +1 -2
- 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 +2 -1
- 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 +2 -1
- 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 +1 -2
- package/cjs/rules/require-deprecation-reason/index.d.cts +2 -1
- 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 +1 -2
- package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +2 -1
- package/cjs/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
- package/cjs/rules/require-import-fragment/index.d.cts +2 -1
- package/cjs/rules/require-import-fragment/index.js +1 -2
- package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +2 -1
- package/cjs/rules/require-nullable-fields-with-oneof/index.js +1 -1
- package/cjs/rules/require-nullable-result-in-root/index.d.cts +2 -1
- package/cjs/rules/require-nullable-result-in-root/index.js +1 -2
- package/cjs/rules/require-selections/index.d.cts +1 -1
- package/cjs/rules/require-selections/index.js +4 -8
- package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +2 -1
- 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 +1 -3
- 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 +2 -1
- package/cjs/rules/unique-enum-value-names/index.js +1 -2
- package/cjs/rules/unique-fragment-name/index.d.cts +1 -0
- package/cjs/rules/unique-fragment-name/index.js +2 -1
- package/cjs/rules/unique-operation-name/index.d.cts +2 -1
- package/cjs/rules/unique-operation-name/index.js +1 -1
- package/cjs/schema.d.cts +2 -1
- package/cjs/types.d.cts +17 -7
- package/cjs/utils.d.cts +2 -2
- package/cjs/utils.js +1 -5
- package/esm/graphql-config.d.ts +2 -1
- package/esm/index.d.ts +1 -0
- package/esm/meta.js +1 -1
- package/esm/parser.d.ts +2 -1
- package/esm/rules/alphabetize/index.d.ts +1 -1
- package/esm/rules/alphabetize/index.js +1 -2
- package/esm/rules/description-style/index.d.ts +1 -1
- package/esm/rules/description-style/index.js +1 -3
- package/esm/rules/graphql-js-validation.d.ts +2 -1
- package/esm/rules/graphql-js-validation.js +30 -31
- package/esm/rules/index.d.ts +1 -0
- package/esm/rules/input-name/index.d.ts +1 -1
- package/esm/rules/input-name/index.js +1 -3
- package/esm/rules/lone-executable-definition/index.d.ts +1 -1
- package/esm/rules/lone-executable-definition/index.js +1 -2
- package/esm/rules/match-document-filename/index.d.ts +1 -1
- package/esm/rules/match-document-filename/index.js +1 -2
- package/esm/rules/naming-convention/index.d.ts +1 -1
- package/esm/rules/naming-convention/index.js +1 -3
- package/esm/rules/no-anonymous-operations/index.d.ts +2 -1
- package/esm/rules/no-anonymous-operations/index.js +1 -2
- package/esm/rules/no-deprecated/index.d.ts +2 -1
- package/esm/rules/no-deprecated/index.js +1 -2
- package/esm/rules/no-duplicate-fields/index.d.ts +2 -1
- package/esm/rules/no-duplicate-fields/index.js +1 -2
- package/esm/rules/no-hashtag-description/index.d.ts +2 -1
- package/esm/rules/no-hashtag-description/index.js +1 -2
- package/esm/rules/no-one-place-fragments/index.d.ts +2 -1
- 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 +1 -3
- package/esm/rules/no-scalar-result-type-on-mutation/index.d.ts +2 -1
- package/esm/rules/no-scalar-result-type-on-mutation/index.js +1 -2
- package/esm/rules/no-typename-prefix/index.d.ts +2 -1
- package/esm/rules/no-typename-prefix/index.js +1 -2
- package/esm/rules/no-unreachable-types/index.d.ts +2 -1
- package/esm/rules/no-unreachable-types/index.js +1 -2
- package/esm/rules/no-unused-fields/index.d.ts +1 -1
- package/esm/rules/no-unused-fields/index.js +1 -2
- 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 +2 -1
- 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 +2 -1
- 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 +1 -2
- package/esm/rules/require-deprecation-reason/index.d.ts +2 -1
- 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 +1 -2
- package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +2 -1
- package/esm/rules/require-field-of-type-query-in-mutation-result/index.js +1 -1
- package/esm/rules/require-import-fragment/index.d.ts +2 -1
- package/esm/rules/require-import-fragment/index.js +1 -2
- package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +2 -1
- package/esm/rules/require-nullable-fields-with-oneof/index.js +1 -1
- package/esm/rules/require-nullable-result-in-root/index.d.ts +2 -1
- package/esm/rules/require-nullable-result-in-root/index.js +1 -2
- package/esm/rules/require-selections/index.d.ts +1 -1
- package/esm/rules/require-selections/index.js +4 -8
- package/esm/rules/require-type-pattern-with-oneof/index.d.ts +2 -1
- 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 +1 -3
- 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 +2 -1
- package/esm/rules/unique-enum-value-names/index.js +1 -2
- package/esm/rules/unique-fragment-name/index.d.ts +1 -0
- package/esm/rules/unique-fragment-name/index.js +2 -1
- package/esm/rules/unique-operation-name/index.d.ts +2 -1
- package/esm/rules/unique-operation-name/index.js +1 -1
- package/esm/schema.d.ts +2 -1
- package/esm/types.d.ts +17 -7
- package/esm/utils.d.ts +2 -2
- package/esm/utils.js +0 -4
- package/package.json +10 -4
- package/programmatic.d.ts +0 -1323
@@ -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
|
|
@@ -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';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -22,7 +22,7 @@ const rule = {
|
|
22
22
|
type: "suggestion",
|
23
23
|
hasSuggestions: true,
|
24
24
|
docs: {
|
25
|
-
category: "
|
25
|
+
category: "Schema",
|
26
26
|
description: "Disallow using root types `mutation` and/or `subscription`.",
|
27
27
|
url: "https://the-guild.dev/graphql/eslint/rules/no-root-type",
|
28
28
|
requiresSchema: true,
|
@@ -54,7 +54,6 @@ const rule = {
|
|
54
54
|
],
|
55
55
|
configOptions: [{ disallow: ["mutation", "subscription"] }]
|
56
56
|
},
|
57
|
-
// @ts-expect-error -- fixme
|
58
57
|
schema
|
59
58
|
},
|
60
59
|
create(context) {
|
@@ -77,7 +76,6 @@ const rule = {
|
|
77
76
|
suggest: [
|
78
77
|
{
|
79
78
|
desc: `Remove \`${typeName}\` type`,
|
80
|
-
// @ts-expect-error -- fixme
|
81
79
|
fix: (fixer) => fixer.remove(node.parent)
|
82
80
|
}
|
83
81
|
]
|
@@ -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
|
type: "suggestion",
|
7
7
|
hasSuggestions: true,
|
8
8
|
docs: {
|
9
|
-
category: "
|
9
|
+
category: "Schema",
|
10
10
|
description: "Avoid scalar result type on mutation type to make sure to return a valid state.",
|
11
11
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
12
12
|
requiresSchema: true,
|
@@ -62,7 +62,6 @@ const rule = {
|
|
62
62
|
suggest: [
|
63
63
|
{
|
64
64
|
desc: `Remove \`${typeName}\``,
|
65
|
-
// @ts-expect-error -- fixme
|
66
65
|
fix: (fixer) => fixer.remove(node)
|
67
66
|
}
|
68
67
|
]
|
@@ -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
|
type: "suggestion",
|
5
5
|
hasSuggestions: true,
|
6
6
|
docs: {
|
7
|
-
category: "
|
7
|
+
category: "Schema",
|
8
8
|
description: "Enforces users to avoid using the type name in a field name while defining your schema.",
|
9
9
|
recommended: true,
|
10
10
|
url: "https://the-guild.dev/graphql/eslint/rules/no-typename-prefix",
|
@@ -56,7 +56,6 @@ const rule = {
|
|
56
56
|
suggest: [
|
57
57
|
{
|
58
58
|
desc: `Remove \`${fieldName.slice(0, typeName.length)}\` prefix`,
|
59
|
-
// @ts-expect-error -- fixme
|
60
59
|
fix: (fixer) => fixer.replaceText(
|
61
60
|
field.name,
|
62
61
|
fieldName.replace(new RegExp(`^${typeName}`, "i"), "")
|
@@ -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
|
|
@@ -95,7 +95,7 @@ const rule = {
|
|
95
95
|
},
|
96
96
|
docs: {
|
97
97
|
description: "Requires all types to be reachable at some level by root level fields.",
|
98
|
-
category: "
|
98
|
+
category: "Schema",
|
99
99
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
100
100
|
requiresSchema: true,
|
101
101
|
examples: [
|
@@ -156,7 +156,6 @@ const rule = {
|
|
156
156
|
suggest: [
|
157
157
|
{
|
158
158
|
desc: `Remove \`${typeName}\``,
|
159
|
-
// @ts-expect-error -- fixme
|
160
159
|
fix: (fixer) => fixer.remove(node.parent)
|
161
160
|
}
|
162
161
|
]
|
@@ -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';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -130,7 +130,7 @@ const rule = {
|
|
130
130
|
},
|
131
131
|
docs: {
|
132
132
|
description: "Requires all fields to be used at some level by siblings operations.",
|
133
|
-
category: "
|
133
|
+
category: "Schema",
|
134
134
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
135
135
|
requiresSiblings: true,
|
136
136
|
requiresSchema: true,
|
@@ -228,7 +228,6 @@ const rule = {
|
|
228
228
|
suggest: [
|
229
229
|
{
|
230
230
|
desc: `Remove \`${fieldName}\` field`,
|
231
|
-
// @ts-expect-error -- fixme
|
232
231
|
fix(fixer) {
|
233
232
|
const sourceCode = context.getSourceCode();
|
234
233
|
const tokenBefore = sourceCode.getTokenBefore(node);
|
@@ -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';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { Kind } from 'graphql';
|
2
2
|
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import 'eslint';
|
4
|
+
import 'estree';
|
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
|
|
@@ -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';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -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
|
|
@@ -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';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
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: "
|
26
|
+
category: "Schema",
|
27
27
|
description: "Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date.",
|
28
28
|
url: "https://the-guild.dev/graphql/eslint/rules/require-deprecation-date",
|
29
29
|
examples: [
|
@@ -125,7 +125,6 @@ const rule = {
|
|
125
125
|
suggest: [
|
126
126
|
{
|
127
127
|
desc: `Remove \`${nodeName}\``,
|
128
|
-
// @ts-expect-error -- fixme
|
129
128
|
fix: (fixer) => fixer.remove(parent)
|
130
129
|
}
|
131
130
|
]
|
@@ -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
|
docs: {
|
6
6
|
description: "Require all deprecation directives to specify a reason.",
|
7
|
-
category: "
|
7
|
+
category: "Schema",
|
8
8
|
url: "https://the-guild.dev/graphql/eslint/rules/require-deprecation-reason",
|
9
9
|
recommended: true,
|
10
10
|
examples: [
|
@@ -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';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -64,7 +64,7 @@ ${_utilsjs.TYPES_KINDS.map((kind) => `- \`${kind}\``).join("\n")}`
|
|
64
64
|
const rule = {
|
65
65
|
meta: {
|
66
66
|
docs: {
|
67
|
-
category: "
|
67
|
+
category: "Schema",
|
68
68
|
description: "Enforce descriptions in type definitions and operations.",
|
69
69
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
70
70
|
examples: [
|
@@ -172,7 +172,6 @@ const rule = {
|
|
172
172
|
messages: {
|
173
173
|
[RULE_ID]: "Description is required for {{ nodeName }}"
|
174
174
|
},
|
175
|
-
// @ts-expect-error -- fixme
|
176
175
|
schema
|
177
176
|
},
|
178
177
|
create(context) {
|
@@ -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
|
|
@@ -5,7 +5,7 @@ const rule = {
|
|
5
5
|
meta: {
|
6
6
|
type: "suggestion",
|
7
7
|
docs: {
|
8
|
-
category: "
|
8
|
+
category: "Schema",
|
9
9
|
description: "Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.\n> Currently, no errors are reported for result type `union`, `interface` and `scalar`.",
|
10
10
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
11
11
|
requiresSchema: 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
|
|
@@ -6,7 +6,7 @@ const rule = {
|
|
6
6
|
meta: {
|
7
7
|
type: "suggestion",
|
8
8
|
docs: {
|
9
|
-
category: "
|
9
|
+
category: "Operations",
|
10
10
|
description: "Require fragments to be imported via an import expression.",
|
11
11
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
12
12
|
examples: [
|
@@ -114,7 +114,6 @@ const rule = {
|
|
114
114
|
suggest: suggestedFilePaths.map((suggestedPath) => ({
|
115
115
|
messageId: SUGGESTION_ID,
|
116
116
|
data: { fragmentName },
|
117
|
-
// @ts-expect-error -- fixme
|
118
117
|
fix: (fixer) => fixer.insertTextBeforeRange(
|
119
118
|
[0, 0],
|
120
119
|
`# import ${fragmentName} from '${suggestedPath}'
|
@@ -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
|
|
@@ -5,7 +5,7 @@ const rule = {
|
|
5
5
|
meta: {
|
6
6
|
type: "suggestion",
|
7
7
|
docs: {
|
8
|
-
category: "
|
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,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
|
type: "suggestion",
|
7
7
|
hasSuggestions: true,
|
8
8
|
docs: {
|
9
|
-
category: "
|
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,7 +67,6 @@ const rule = {
|
|
67
67
|
suggest: [
|
68
68
|
{
|
69
69
|
desc: `Make ${resultType} nullable`,
|
70
|
-
// @ts-expect-error -- fixme
|
71
70
|
fix(fixer) {
|
72
71
|
const text = sourceCode.getText(field.gqlType);
|
73
72
|
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.cjs';
|
3
3
|
import 'eslint';
|
4
|
+
import 'estree';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -14,7 +14,6 @@ var _indexjs = require('../../estree-converter/index.js');
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
|
18
17
|
var _utilsjs = require('../../utils.js');
|
19
18
|
const RULE_ID = "require-selections";
|
20
19
|
const DEFAULT_ID_FIELD_NAME = "id";
|
@@ -47,7 +46,7 @@ const rule = {
|
|
47
46
|
type: "suggestion",
|
48
47
|
hasSuggestions: true,
|
49
48
|
docs: {
|
50
|
-
category: "
|
49
|
+
category: "Operations",
|
51
50
|
description: "Enforce selecting specific fields when they are available on the GraphQL type.",
|
52
51
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
53
52
|
requiresSchema: true,
|
@@ -108,7 +107,6 @@ const rule = {
|
|
108
107
|
messages: {
|
109
108
|
[RULE_ID]: "Field{{ pluralSuffix }} {{ fieldName }} must be selected when it's available on a type.\nInclude it in your selection set{{ addition }}."
|
110
109
|
},
|
111
|
-
// @ts-expect-error -- fixme
|
112
110
|
schema
|
113
111
|
},
|
114
112
|
create(context) {
|
@@ -214,14 +212,13 @@ const rule = {
|
|
214
212
|
const fieldName2 = _utilsjs.englishJoinWords.call(void 0,
|
215
213
|
idNames2.map((name) => `\`${(parent.alias || parent.name).value}.${name}\``)
|
216
214
|
);
|
217
|
-
const
|
218
|
-
|
219
|
-
)} ${_utilsjs.englishJoinWords.call(void 0, [...checkedFragmentSpreads].map((name) => `\`${name}\``))}`;
|
215
|
+
const pluralSuffix = idNames2.length > 1 ? "s" : "";
|
216
|
+
const addition = checkedFragmentSpreads.size === 0 ? "" : ` or add to used fragment${checkedFragmentSpreads.size > 1 ? "s" : ""} ${_utilsjs.englishJoinWords.call(void 0, [...checkedFragmentSpreads].map((name) => `\`${name}\``))}`;
|
220
217
|
const problem = {
|
221
218
|
loc,
|
222
219
|
messageId: RULE_ID,
|
223
220
|
data: {
|
224
|
-
pluralSuffix
|
221
|
+
pluralSuffix,
|
225
222
|
fieldName: fieldName2,
|
226
223
|
addition
|
227
224
|
}
|
@@ -229,7 +226,6 @@ const rule = {
|
|
229
226
|
if ("type" in node) {
|
230
227
|
problem.suggest = idNames2.map((idName) => ({
|
231
228
|
desc: `Add \`${idName}\` selection`,
|
232
|
-
// @ts-expect-error -- fixme
|
233
229
|
fix: (fixer) => {
|
234
230
|
let insertNode = node.selections[0];
|
235
231
|
insertNode = insertNode.kind === _graphql.Kind.INLINE_FRAGMENT ? insertNode.selectionSet.selections[0] : insertNode;
|
@@ -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
|
|
@@ -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';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
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: "
|
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,7 +71,6 @@ const rule = {
|
|
71
71
|
recommended: true,
|
72
72
|
configOptions: [{ maxDepth: 7 }]
|
73
73
|
},
|
74
|
-
// @ts-expect-error -- fixme
|
75
74
|
schema
|
76
75
|
},
|
77
76
|
create(context) {
|
@@ -113,7 +112,6 @@ const rule = {
|
|
113
112
|
suggest: [
|
114
113
|
{
|
115
114
|
desc: "Remove selections",
|
116
|
-
// @ts-expect-error -- fixme
|
117
115
|
fix(fixer) {
|
118
116
|
const sourceCode = context.getSourceCode();
|
119
117
|
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.cjs';
|
3
3
|
import 'eslint';
|
4
|
+
import 'estree';
|
4
5
|
import 'graphql';
|
5
6
|
import 'graphql-config';
|
6
7
|
import '../../estree-converter/types.cjs';
|
7
|
-
import 'estree';
|
8
8
|
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
@@ -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: "
|
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${
|
157
|
-
Accepted type${
|
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
|
}
|