@graphql-eslint/eslint-plugin 3.0.0-alpha-3168a9b.0 → 3.0.0-alpha-7462f3d.0
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/configs/all.d.ts +9 -6
- package/configs/index.d.ts +10 -8
- package/configs/recommended.d.ts +1 -2
- package/docs/README.md +3 -5
- package/docs/deprecated-rules.md +21 -0
- package/docs/rules/naming-convention.md +25 -25
- package/docs/rules/{avoid-duplicate-fields.md → no-duplicate-fields.md} +7 -7
- package/docs/rules/no-root-type.md +6 -0
- package/docs/rules/{avoid-scalar-result-type-on-mutation.md → no-scalar-result-type-on-mutation.md} +6 -6
- package/docs/rules/{avoid-typename-prefix.md → no-typename-prefix.md} +6 -6
- package/docs/rules/require-description.md +35 -6
- package/index.js +341 -472
- package/index.mjs +342 -473
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +5 -6
- package/rules/index.d.ts +21 -11
- package/rules/{avoid-duplicate-fields.d.ts → no-duplicate-fields.d.ts} +0 -0
- package/rules/{avoid-scalar-result-type-on-mutation.d.ts → no-scalar-result-type-on-mutation.d.ts} +0 -0
- package/rules/{avoid-typename-prefix.d.ts → no-typename-prefix.d.ts} +0 -0
- package/rules/require-description.d.ts +10 -6
- package/utils.d.ts +1 -1
- package/docs/rules/avoid-operation-name-prefix.md +0 -50
- package/docs/rules/no-operation-name-suffix.md +0 -38
- package/rules/avoid-operation-name-prefix.d.ts +0 -9
- package/rules/no-operation-name-suffix.d.ts +0 -3
package/configs/all.d.ts
CHANGED
@@ -7,27 +7,30 @@ export declare const allConfig: {
|
|
7
7
|
variables: string[];
|
8
8
|
arguments: string[];
|
9
9
|
})[];
|
10
|
-
'@graphql-eslint/avoid-duplicate-fields': string;
|
11
|
-
'@graphql-eslint/avoid-operation-name-prefix': string;
|
12
|
-
'@graphql-eslint/avoid-scalar-result-type-on-mutation': string;
|
13
10
|
'@graphql-eslint/description-style': string;
|
14
11
|
'@graphql-eslint/input-name': string;
|
15
12
|
'@graphql-eslint/match-document-filename': string;
|
16
13
|
'@graphql-eslint/no-deprecated': string;
|
14
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
17
15
|
'@graphql-eslint/no-hashtag-description': string;
|
18
16
|
'@graphql-eslint/no-root-type': (string | {
|
19
17
|
disallow: string[];
|
20
18
|
})[];
|
19
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
21
20
|
'@graphql-eslint/no-unreachable-types': string;
|
22
21
|
'@graphql-eslint/no-unused-fields': string;
|
23
22
|
'@graphql-eslint/require-deprecation-date': string;
|
24
|
-
'@graphql-eslint/require-description': string
|
23
|
+
'@graphql-eslint/require-description': (string | {
|
24
|
+
types: boolean;
|
25
|
+
overrides: {
|
26
|
+
DirectiveDefinition: boolean;
|
27
|
+
};
|
28
|
+
})[];
|
25
29
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
26
30
|
'@graphql-eslint/require-id-when-available': string;
|
27
31
|
'@graphql-eslint/selection-set-depth': string;
|
28
32
|
'@graphql-eslint/unique-fragment-name': string;
|
29
33
|
'@graphql-eslint/unique-operation-name': string;
|
30
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
31
34
|
'@graphql-eslint/executable-definitions': string;
|
32
35
|
'@graphql-eslint/fields-on-correct-type': string;
|
33
36
|
'@graphql-eslint/fragments-on-composite-type': string;
|
@@ -69,7 +72,7 @@ export declare const allConfig: {
|
|
69
72
|
'@graphql-eslint/no-anonymous-operations': string;
|
70
73
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
71
74
|
'@graphql-eslint/no-fragment-cycles': string;
|
72
|
-
'@graphql-eslint/no-
|
75
|
+
'@graphql-eslint/no-typename-prefix': string;
|
73
76
|
'@graphql-eslint/no-undefined-variables': string;
|
74
77
|
'@graphql-eslint/no-unused-fragments': string;
|
75
78
|
'@graphql-eslint/no-unused-variables': string;
|
package/configs/index.d.ts
CHANGED
@@ -8,27 +8,30 @@ export declare const configs: {
|
|
8
8
|
variables: string[];
|
9
9
|
arguments: string[];
|
10
10
|
})[];
|
11
|
-
'@graphql-eslint/avoid-duplicate-fields': string;
|
12
|
-
'@graphql-eslint/avoid-operation-name-prefix': string;
|
13
|
-
'@graphql-eslint/avoid-scalar-result-type-on-mutation': string;
|
14
11
|
'@graphql-eslint/description-style': string;
|
15
12
|
'@graphql-eslint/input-name': string;
|
16
13
|
'@graphql-eslint/match-document-filename': string;
|
17
14
|
'@graphql-eslint/no-deprecated': string;
|
15
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
18
16
|
'@graphql-eslint/no-hashtag-description': string;
|
19
17
|
'@graphql-eslint/no-root-type': (string | {
|
20
18
|
disallow: string[];
|
21
19
|
})[];
|
20
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
22
21
|
'@graphql-eslint/no-unreachable-types': string;
|
23
22
|
'@graphql-eslint/no-unused-fields': string;
|
24
23
|
'@graphql-eslint/require-deprecation-date': string;
|
25
|
-
'@graphql-eslint/require-description': string
|
24
|
+
'@graphql-eslint/require-description': (string | {
|
25
|
+
types: boolean;
|
26
|
+
overrides: {
|
27
|
+
DirectiveDefinition: boolean;
|
28
|
+
};
|
29
|
+
})[];
|
26
30
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
27
31
|
'@graphql-eslint/require-id-when-available': string;
|
28
32
|
'@graphql-eslint/selection-set-depth': string;
|
29
33
|
'@graphql-eslint/unique-fragment-name': string;
|
30
34
|
'@graphql-eslint/unique-operation-name': string;
|
31
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
32
35
|
'@graphql-eslint/executable-definitions': string;
|
33
36
|
'@graphql-eslint/fields-on-correct-type': string;
|
34
37
|
'@graphql-eslint/fragments-on-composite-type': string;
|
@@ -70,7 +73,7 @@ export declare const configs: {
|
|
70
73
|
'@graphql-eslint/no-anonymous-operations': string;
|
71
74
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
72
75
|
'@graphql-eslint/no-fragment-cycles': string;
|
73
|
-
'@graphql-eslint/no-
|
76
|
+
'@graphql-eslint/no-typename-prefix': string;
|
74
77
|
'@graphql-eslint/no-undefined-variables': string;
|
75
78
|
'@graphql-eslint/no-unused-fragments': string;
|
76
79
|
'@graphql-eslint/no-unused-variables': string;
|
@@ -102,7 +105,6 @@ export declare const configs: {
|
|
102
105
|
parser: string;
|
103
106
|
plugins: string[];
|
104
107
|
rules: {
|
105
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
106
108
|
'@graphql-eslint/executable-definitions': string;
|
107
109
|
'@graphql-eslint/fields-on-correct-type': string;
|
108
110
|
'@graphql-eslint/fragments-on-composite-type': string;
|
@@ -144,7 +146,7 @@ export declare const configs: {
|
|
144
146
|
'@graphql-eslint/no-anonymous-operations': string;
|
145
147
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
146
148
|
'@graphql-eslint/no-fragment-cycles': string;
|
147
|
-
'@graphql-eslint/no-
|
149
|
+
'@graphql-eslint/no-typename-prefix': string;
|
148
150
|
'@graphql-eslint/no-undefined-variables': string;
|
149
151
|
'@graphql-eslint/no-unused-fragments': string;
|
150
152
|
'@graphql-eslint/no-unused-variables': string;
|
package/configs/recommended.d.ts
CHANGED
@@ -2,7 +2,6 @@ export declare const recommendedConfig: {
|
|
2
2
|
parser: string;
|
3
3
|
plugins: string[];
|
4
4
|
rules: {
|
5
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
6
5
|
'@graphql-eslint/executable-definitions': string;
|
7
6
|
'@graphql-eslint/fields-on-correct-type': string;
|
8
7
|
'@graphql-eslint/fragments-on-composite-type': string;
|
@@ -44,7 +43,7 @@ export declare const recommendedConfig: {
|
|
44
43
|
'@graphql-eslint/no-anonymous-operations': string;
|
45
44
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
46
45
|
'@graphql-eslint/no-fragment-cycles': string;
|
47
|
-
'@graphql-eslint/no-
|
46
|
+
'@graphql-eslint/no-typename-prefix': string;
|
48
47
|
'@graphql-eslint/no-undefined-variables': string;
|
49
48
|
'@graphql-eslint/no-unused-fragments': string;
|
50
49
|
'@graphql-eslint/no-unused-variables': string;
|
package/docs/README.md
CHANGED
@@ -12,10 +12,6 @@ Each rule has emojis denoting:
|
|
12
12
|
Name |Description|🚀 / 🔮|🔧|✅
|
13
13
|
-|-|:-:|-|-
|
14
14
|
[alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.|🚀||
|
15
|
-
[avoid-duplicate-fields](rules/avoid-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|🚀||
|
16
|
-
[avoid-operation-name-prefix](rules/avoid-operation-name-prefix.md)|Enforce/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema.|🚀||
|
17
|
-
[avoid-scalar-result-type-on-mutation](rules/avoid-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|🚀||
|
18
|
-
[avoid-typename-prefix](rules/avoid-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|🚀||✅
|
19
15
|
[description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline).|🚀||
|
20
16
|
[executable-definitions](rules/executable-definitions.md)|A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.|🔮||✅
|
21
17
|
[fields-on-correct-type](rules/fields-on-correct-type.md)|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`.|🔮||✅
|
@@ -32,10 +28,12 @@ Name &nbs
|
|
32
28
|
[no-anonymous-operations](rules/no-anonymous-operations.md)|Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.|🚀||✅
|
33
29
|
[no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md)|Disallow case-insensitive enum values duplicates.|🚀|🔧|✅
|
34
30
|
[no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations.|🚀||
|
31
|
+
[no-duplicate-fields](rules/no-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|🚀||
|
35
32
|
[no-fragment-cycles](rules/no-fragment-cycles.md)|A GraphQL fragment is only valid when it does not have cycles in fragments usage.|🔮||✅
|
36
33
|
[no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.|🚀||
|
37
|
-
[no-operation-name-suffix](rules/no-operation-name-suffix.md)|Makes sure you are not adding the operation type to the name of the operation.|🚀|🔧|✅
|
38
34
|
[no-root-type](rules/no-root-type.md)|Disallow using root types for `read-only` or `write-only` schemas.|🚀||
|
35
|
+
[no-scalar-result-type-on-mutation](rules/no-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|🚀||
|
36
|
+
[no-typename-prefix](rules/no-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|🚀||✅
|
39
37
|
[no-undefined-variables](rules/no-undefined-variables.md)|A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.|🔮||✅
|
40
38
|
[no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields.|🚀|🔧|
|
41
39
|
[no-unused-fields](rules/no-unused-fields.md)|Requires all fields to be used at some level by siblings operations.|🚀|🔧|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Deprecated Rules
|
2
|
+
|
3
|
+
## avoid-duplicate-fields
|
4
|
+
|
5
|
+
This rule was renamed to [`no-duplicate-fields`](rules/no-duplicate-fields.md).
|
6
|
+
|
7
|
+
## avoid-scalar-result-type-on-mutation
|
8
|
+
|
9
|
+
This rule was renamed to [`no-scalar-result-type-on-mutation`](rules/no-scalar-result-type-on-mutation.md).
|
10
|
+
|
11
|
+
## avoid-typename-prefix
|
12
|
+
|
13
|
+
This rule was renamed to [`no-typename-prefix`](rules/no-typename-prefix.md).
|
14
|
+
|
15
|
+
## avoid-operation-name-prefix
|
16
|
+
|
17
|
+
This rule was removed because the same things can be validated using [`naming-convention`](rules/naming-convention.md).
|
18
|
+
|
19
|
+
## no-operation-name-suffix
|
20
|
+
|
21
|
+
This rule was removed because the same things can be validated using [`naming-convention`](rules/naming-convention.md).
|
@@ -39,12 +39,12 @@ The schema defines the following properties:
|
|
39
39
|
|
40
40
|
Includes:
|
41
41
|
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
42
|
+
- [ObjectTypeDefinition](https://spec.graphql.org/October2021/#ObjectTypeDefinition)
|
43
|
+
- [InterfaceTypeDefinition](https://spec.graphql.org/October2021/#InterfaceTypeDefinition)
|
44
|
+
- [EnumTypeDefinition](https://spec.graphql.org/October2021/#EnumTypeDefinition)
|
45
|
+
- [ScalarTypeDefinition](https://spec.graphql.org/October2021/#ScalarTypeDefinition)
|
46
|
+
- [InputObjectTypeDefinition](https://spec.graphql.org/October2021/#InputObjectTypeDefinition)
|
47
|
+
- [UnionTypeDefinition](https://spec.graphql.org/October2021/#UnionTypeDefinition)
|
48
48
|
|
49
49
|
The object must be one of the following types:
|
50
50
|
|
@@ -55,11 +55,11 @@ The object must be one of the following types:
|
|
55
55
|
|
56
56
|
Includes:
|
57
57
|
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
58
|
+
- [FieldDefinition](https://spec.graphql.org/October2021/#FieldDefinition)
|
59
|
+
- [InputValueDefinition](https://spec.graphql.org/October2021/#InputValueDefinition)
|
60
|
+
- [VariableDefinition](https://spec.graphql.org/October2021/#VariableDefinition)
|
61
|
+
- [Argument](https://spec.graphql.org/October2021/#Argument)
|
62
|
+
- [DirectiveDefinition](https://spec.graphql.org/October2021/#DirectiveDefinition)
|
63
63
|
|
64
64
|
The object must be one of the following types:
|
65
65
|
|
@@ -78,20 +78,20 @@ Default: `false`
|
|
78
78
|
|
79
79
|
May contain the following `ASTNode` names:
|
80
80
|
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
-
|
81
|
+
- [Argument](https://spec.graphql.org/October2021/#Argument)
|
82
|
+
- [DirectiveDefinition](https://spec.graphql.org/October2021/#DirectiveDefinition)
|
83
|
+
- [EnumTypeDefinition](https://spec.graphql.org/October2021/#EnumTypeDefinition)
|
84
|
+
- [EnumValueDefinition](https://spec.graphql.org/October2021/#EnumValueDefinition)
|
85
|
+
- [FieldDefinition](https://spec.graphql.org/October2021/#FieldDefinition)
|
86
|
+
- [FragmentDefinition](https://spec.graphql.org/October2021/#FragmentDefinition)
|
87
|
+
- [InputObjectTypeDefinition](https://spec.graphql.org/October2021/#InputObjectTypeDefinition)
|
88
|
+
- [InputValueDefinition](https://spec.graphql.org/October2021/#InputValueDefinition)
|
89
|
+
- [InterfaceTypeDefinition](https://spec.graphql.org/October2021/#InterfaceTypeDefinition)
|
90
|
+
- [ObjectTypeDefinition](https://spec.graphql.org/October2021/#ObjectTypeDefinition)
|
91
|
+
- [OperationDefinition](https://spec.graphql.org/October2021/#OperationDefinition)
|
92
|
+
- [ScalarTypeDefinition](https://spec.graphql.org/October2021/#ScalarTypeDefinition)
|
93
|
+
- [UnionTypeDefinition](https://spec.graphql.org/October2021/#UnionTypeDefinition)
|
94
|
+
- [VariableDefinition](https://spec.graphql.org/October2021/#VariableDefinition)
|
95
95
|
|
96
96
|
> It's also possible to use a [`selector`](https://eslint.org/docs/developer-guide/selectors) that starts with `ASTNode` name
|
97
97
|
>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
# `
|
1
|
+
# `no-duplicate-fields`
|
2
2
|
|
3
3
|
- Category: `Stylistic Issues`
|
4
|
-
- Rule name: `@graphql-eslint/
|
4
|
+
- Rule name: `@graphql-eslint/no-duplicate-fields`
|
5
5
|
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
6
6
|
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
7
7
|
|
@@ -12,7 +12,7 @@ Checks for duplicate fields in selection set, variables in operation definition,
|
|
12
12
|
### Incorrect
|
13
13
|
|
14
14
|
```graphql
|
15
|
-
# eslint @graphql-eslint/
|
15
|
+
# eslint @graphql-eslint/no-duplicate-fields: 'error'
|
16
16
|
|
17
17
|
query {
|
18
18
|
user {
|
@@ -26,7 +26,7 @@ query {
|
|
26
26
|
### Incorrect
|
27
27
|
|
28
28
|
```graphql
|
29
|
-
# eslint @graphql-eslint/
|
29
|
+
# eslint @graphql-eslint/no-duplicate-fields: 'error'
|
30
30
|
|
31
31
|
query {
|
32
32
|
users(
|
@@ -43,7 +43,7 @@ query {
|
|
43
43
|
### Incorrect
|
44
44
|
|
45
45
|
```graphql
|
46
|
-
# eslint @graphql-eslint/
|
46
|
+
# eslint @graphql-eslint/no-duplicate-fields: 'error'
|
47
47
|
|
48
48
|
query (
|
49
49
|
$first: Int!
|
@@ -57,5 +57,5 @@ query (
|
|
57
57
|
|
58
58
|
## Resources
|
59
59
|
|
60
|
-
- [Rule source](../../packages/plugin/src/rules/
|
61
|
-
- [Test source](../../packages/plugin/tests/
|
60
|
+
- [Rule source](../../packages/plugin/src/rules/no-duplicate-fields.ts)
|
61
|
+
- [Test source](../../packages/plugin/tests/no-duplicate-fields.spec.ts)
|
@@ -45,6 +45,12 @@ The schema defines the following properties:
|
|
45
45
|
|
46
46
|
### `disallow` (array, required)
|
47
47
|
|
48
|
+
The elements of the array can contain the following enum values:
|
49
|
+
|
50
|
+
- `query`
|
51
|
+
- `mutation`
|
52
|
+
- `subscription`
|
53
|
+
|
48
54
|
Additional restrictions:
|
49
55
|
|
50
56
|
* Minimum items: `1`
|
package/docs/rules/{avoid-scalar-result-type-on-mutation.md → no-scalar-result-type-on-mutation.md}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
|
-
# `
|
1
|
+
# `no-scalar-result-type-on-mutation`
|
2
2
|
|
3
3
|
- Category: `Best Practices`
|
4
|
-
- Rule name: `@graphql-eslint/
|
4
|
+
- Rule name: `@graphql-eslint/no-scalar-result-type-on-mutation`
|
5
5
|
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
6
6
|
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
7
7
|
|
@@ -12,7 +12,7 @@ Avoid scalar result type on mutation type to make sure to return a valid state.
|
|
12
12
|
### Incorrect
|
13
13
|
|
14
14
|
```graphql
|
15
|
-
# eslint @graphql-eslint/
|
15
|
+
# eslint @graphql-eslint/no-scalar-result-type-on-mutation: 'error'
|
16
16
|
|
17
17
|
type Mutation {
|
18
18
|
createUser: Boolean
|
@@ -22,7 +22,7 @@ type Mutation {
|
|
22
22
|
### Correct
|
23
23
|
|
24
24
|
```graphql
|
25
|
-
# eslint @graphql-eslint/
|
25
|
+
# eslint @graphql-eslint/no-scalar-result-type-on-mutation: 'error'
|
26
26
|
|
27
27
|
type Mutation {
|
28
28
|
createUser: User!
|
@@ -31,5 +31,5 @@ type Mutation {
|
|
31
31
|
|
32
32
|
## Resources
|
33
33
|
|
34
|
-
- [Rule source](../../packages/plugin/src/rules/
|
35
|
-
- [Test source](../../packages/plugin/tests/
|
34
|
+
- [Rule source](../../packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts)
|
35
|
+
- [Test source](../../packages/plugin/tests/no-scalar-result-type-on-mutation.spec.ts)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# `
|
1
|
+
# `no-typename-prefix`
|
2
2
|
|
3
3
|
✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
|
4
4
|
|
5
5
|
- Category: `Best Practices`
|
6
|
-
- Rule name: `@graphql-eslint/
|
6
|
+
- Rule name: `@graphql-eslint/no-typename-prefix`
|
7
7
|
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
8
8
|
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
9
9
|
|
@@ -14,7 +14,7 @@ Enforces users to avoid using the type name in a field name while defining your
|
|
14
14
|
### Incorrect
|
15
15
|
|
16
16
|
```graphql
|
17
|
-
# eslint @graphql-eslint/
|
17
|
+
# eslint @graphql-eslint/no-typename-prefix: 'error'
|
18
18
|
|
19
19
|
type User {
|
20
20
|
userId: ID!
|
@@ -24,7 +24,7 @@ type User {
|
|
24
24
|
### Correct
|
25
25
|
|
26
26
|
```graphql
|
27
|
-
# eslint @graphql-eslint/
|
27
|
+
# eslint @graphql-eslint/no-typename-prefix: 'error'
|
28
28
|
|
29
29
|
type User {
|
30
30
|
id: ID!
|
@@ -33,5 +33,5 @@ type User {
|
|
33
33
|
|
34
34
|
## Resources
|
35
35
|
|
36
|
-
- [Rule source](../../packages/plugin/src/rules/
|
37
|
-
- [Test source](../../packages/plugin/tests/
|
36
|
+
- [Rule source](../../packages/plugin/src/rules/no-typename-prefix.ts)
|
37
|
+
- [Test source](../../packages/plugin/tests/no-typename-prefix.spec.ts)
|
@@ -12,7 +12,7 @@ Enforce descriptions in your type definitions.
|
|
12
12
|
### Incorrect
|
13
13
|
|
14
14
|
```graphql
|
15
|
-
# eslint @graphql-eslint/require-description: ['error', {
|
15
|
+
# eslint @graphql-eslint/require-description: ['error', { types: true, overrides: { FieldDefinition: true } }]
|
16
16
|
|
17
17
|
type someTypeName {
|
18
18
|
name: String
|
@@ -22,7 +22,7 @@ type someTypeName {
|
|
22
22
|
### Correct
|
23
23
|
|
24
24
|
```graphql
|
25
|
-
# eslint @graphql-eslint/require-description: ['error', {
|
25
|
+
# eslint @graphql-eslint/require-description: ['error', { types: true, overrides: { FieldDefinition: true } }]
|
26
26
|
|
27
27
|
"""
|
28
28
|
Some type description
|
@@ -39,13 +39,42 @@ type someTypeName {
|
|
39
39
|
|
40
40
|
The schema defines the following properties:
|
41
41
|
|
42
|
-
### `
|
42
|
+
### `types` (boolean)
|
43
43
|
|
44
|
-
|
44
|
+
Includes:
|
45
45
|
|
46
|
-
|
46
|
+
- [ObjectTypeDefinition](https://spec.graphql.org/October2021/#ObjectTypeDefinition)
|
47
|
+
- [InterfaceTypeDefinition](https://spec.graphql.org/October2021/#InterfaceTypeDefinition)
|
48
|
+
- [EnumTypeDefinition](https://spec.graphql.org/October2021/#EnumTypeDefinition)
|
49
|
+
- [ScalarTypeDefinition](https://spec.graphql.org/October2021/#ScalarTypeDefinition)
|
50
|
+
- [InputObjectTypeDefinition](https://spec.graphql.org/October2021/#InputObjectTypeDefinition)
|
51
|
+
- [UnionTypeDefinition](https://spec.graphql.org/October2021/#UnionTypeDefinition)
|
47
52
|
|
48
|
-
|
53
|
+
### `overrides` (object)
|
54
|
+
|
55
|
+
Configuration for precise `ASTNode`
|
56
|
+
|
57
|
+
Properties of the `overrides` object:
|
58
|
+
|
59
|
+
#### `ObjectTypeDefinition` (boolean)
|
60
|
+
|
61
|
+
#### `InterfaceTypeDefinition` (boolean)
|
62
|
+
|
63
|
+
#### `EnumTypeDefinition` (boolean)
|
64
|
+
|
65
|
+
#### `ScalarTypeDefinition` (boolean)
|
66
|
+
|
67
|
+
#### `InputObjectTypeDefinition` (boolean)
|
68
|
+
|
69
|
+
#### `UnionTypeDefinition` (boolean)
|
70
|
+
|
71
|
+
#### `FieldDefinition` (boolean)
|
72
|
+
|
73
|
+
#### `InputValueDefinition` (boolean)
|
74
|
+
|
75
|
+
#### `EnumValueDefinition` (boolean)
|
76
|
+
|
77
|
+
#### `DirectiveDefinition` (boolean)
|
49
78
|
|
50
79
|
## Resources
|
51
80
|
|