@graphql-eslint/eslint-plugin 3.14.4-alpha-20230111221804-f30b422 → 3.14.4-alpha-20230111225020-02d9c28
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/README.md +5 -288
- package/cjs/documents.js +2 -105
- package/cjs/graphql-config.js +1 -1
- package/cjs/parser.js +9 -3
- package/cjs/rules/alphabetize.js +1 -1
- package/cjs/rules/description-style.js +1 -1
- package/cjs/rules/graphql-js-validation.js +1 -1
- package/cjs/rules/input-name.js +4 -4
- package/cjs/rules/lone-executable-definition.js +1 -1
- package/cjs/rules/match-document-filename.js +2 -3
- package/cjs/rules/naming-convention.js +1 -1
- package/cjs/rules/no-anonymous-operations.js +1 -1
- package/cjs/rules/no-case-insensitive-enum-values-duplicates.js +1 -1
- package/cjs/rules/no-deprecated.js +1 -1
- package/cjs/rules/no-duplicate-fields.js +1 -1
- package/cjs/rules/no-hashtag-description.js +1 -1
- package/cjs/rules/no-one-place-fragments.js +1 -1
- package/cjs/rules/no-root-type.js +1 -1
- package/cjs/rules/no-scalar-result-type-on-mutation.js +1 -1
- package/cjs/rules/no-typename-prefix.js +1 -1
- package/cjs/rules/no-unreachable-types.js +1 -1
- package/cjs/rules/no-unused-fields.js +1 -1
- package/cjs/rules/relay-arguments.js +4 -4
- package/cjs/rules/relay-connection-types.js +1 -1
- package/cjs/rules/relay-edge-types.js +1 -1
- package/cjs/rules/relay-page-info.js +1 -1
- package/cjs/rules/require-deprecation-date.js +1 -1
- package/cjs/rules/require-deprecation-reason.js +1 -1
- package/cjs/rules/require-description.js +1 -1
- package/cjs/rules/require-field-of-type-query-in-mutation-result.js +1 -1
- package/cjs/rules/require-id-when-available.js +1 -1
- package/cjs/rules/require-nullable-fields-with-oneof.js +1 -1
- package/cjs/rules/require-type-pattern-with-oneof.js +1 -1
- package/cjs/rules/selection-set-depth.js +1 -1
- package/cjs/rules/strict-id-in-types.js +1 -1
- package/cjs/rules/unique-fragment-name.js +1 -1
- package/cjs/rules/unique-operation-name.js +1 -1
- package/cjs/siblings.js +113 -0
- package/cjs/utils.js +3 -2
- package/docs/README.md +1 -85
- package/docs/custom-rules.md +1 -184
- package/docs/deprecated-rules.md +1 -24
- package/docs/parser-options.md +1 -107
- package/docs/parser.md +1 -67
- package/esm/documents.js +2 -105
- package/esm/graphql-config.js +1 -1
- package/esm/parser.js +10 -4
- package/esm/rules/alphabetize.js +1 -1
- package/esm/rules/description-style.js +1 -1
- package/esm/rules/graphql-js-validation.js +1 -1
- package/esm/rules/input-name.js +4 -4
- package/esm/rules/lone-executable-definition.js +1 -1
- package/esm/rules/match-document-filename.js +3 -4
- package/esm/rules/naming-convention.js +1 -1
- package/esm/rules/no-anonymous-operations.js +1 -1
- package/esm/rules/no-case-insensitive-enum-values-duplicates.js +1 -1
- package/esm/rules/no-deprecated.js +1 -1
- package/esm/rules/no-duplicate-fields.js +1 -1
- package/esm/rules/no-hashtag-description.js +1 -1
- package/esm/rules/no-one-place-fragments.js +1 -1
- package/esm/rules/no-root-type.js +1 -1
- package/esm/rules/no-scalar-result-type-on-mutation.js +1 -1
- package/esm/rules/no-typename-prefix.js +1 -1
- package/esm/rules/no-unreachable-types.js +1 -1
- package/esm/rules/no-unused-fields.js +1 -1
- package/esm/rules/relay-arguments.js +4 -4
- package/esm/rules/relay-connection-types.js +1 -1
- package/esm/rules/relay-edge-types.js +1 -1
- package/esm/rules/relay-page-info.js +1 -1
- package/esm/rules/require-deprecation-date.js +1 -1
- package/esm/rules/require-deprecation-reason.js +1 -1
- package/esm/rules/require-description.js +1 -1
- package/esm/rules/require-field-of-type-query-in-mutation-result.js +1 -1
- package/esm/rules/require-id-when-available.js +1 -1
- package/esm/rules/require-nullable-fields-with-oneof.js +1 -1
- package/esm/rules/require-type-pattern-with-oneof.js +1 -1
- package/esm/rules/selection-set-depth.js +1 -1
- package/esm/rules/strict-id-in-types.js +1 -1
- package/esm/rules/unique-fragment-name.js +1 -1
- package/esm/rules/unique-operation-name.js +1 -1
- package/esm/siblings.js +109 -0
- package/esm/utils.js +2 -1
- package/package.json +1 -1
- package/typings/documents.d.cts +2 -20
- package/typings/documents.d.ts +2 -20
- package/typings/rules/input-name.d.cts +1 -1
- package/typings/rules/input-name.d.ts +1 -1
- package/typings/siblings.d.cts +22 -0
- package/typings/siblings.d.ts +22 -0
- package/typings/types.d.cts +3 -2
- package/typings/types.d.ts +3 -2
- package/typings/utils.d.cts +2 -1
- package/typings/utils.d.ts +2 -1
- package/docs/rules/alphabetize.md +0 -194
- package/docs/rules/description-style.md +0 -57
- package/docs/rules/executable-definitions.md +0 -20
- package/docs/rules/fields-on-correct-type.md +0 -23
- package/docs/rules/fragments-on-composite-type.md +0 -20
- package/docs/rules/input-name.md +0 -80
- package/docs/rules/known-argument-names.md +0 -23
- package/docs/rules/known-directives.md +0 -48
- package/docs/rules/known-fragment-names.md +0 -72
- package/docs/rules/known-type-names.md +0 -24
- package/docs/rules/lone-anonymous-operation.md +0 -20
- package/docs/rules/lone-executable-definition.md +0 -59
- package/docs/rules/lone-schema-definition.md +0 -19
- package/docs/rules/match-document-filename.md +0 -181
- package/docs/rules/naming-convention.md +0 -320
- package/docs/rules/no-anonymous-operations.md +0 -43
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +0 -46
- package/docs/rules/no-deprecated.md +0 -88
- package/docs/rules/no-duplicate-fields.md +0 -69
- package/docs/rules/no-fragment-cycles.md +0 -19
- package/docs/rules/no-hashtag-description.md +0 -62
- package/docs/rules/no-one-place-fragments.md +0 -51
- package/docs/rules/no-root-type.md +0 -55
- package/docs/rules/no-scalar-result-type-on-mutation.md +0 -39
- package/docs/rules/no-typename-prefix.md +0 -42
- package/docs/rules/no-undefined-variables.md +0 -20
- package/docs/rules/no-unreachable-types.md +0 -52
- package/docs/rules/no-unused-fields.md +0 -64
- package/docs/rules/no-unused-fragments.md +0 -20
- package/docs/rules/no-unused-variables.md +0 -20
- package/docs/rules/one-field-subscriptions.md +0 -19
- package/docs/rules/overlapping-fields-can-be-merged.md +0 -20
- package/docs/rules/possible-fragment-spread.md +0 -21
- package/docs/rules/possible-type-extension.md +0 -19
- package/docs/rules/provided-required-arguments.md +0 -21
- package/docs/rules/relay-arguments.md +0 -59
- package/docs/rules/relay-connection-types.md +0 -43
- package/docs/rules/relay-edge-types.md +0 -60
- package/docs/rules/relay-page-info.md +0 -34
- package/docs/rules/require-deprecation-date.md +0 -59
- package/docs/rules/require-deprecation-reason.md +0 -49
- package/docs/rules/require-description.md +0 -147
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +0 -50
- package/docs/rules/require-id-when-available.md +0 -91
- package/docs/rules/require-nullable-fields-with-oneof.md +0 -38
- package/docs/rules/require-type-pattern-with-oneof.md +0 -39
- package/docs/rules/scalar-leafs.md +0 -23
- package/docs/rules/selection-set-depth.md +0 -86
- package/docs/rules/strict-id-in-types.md +0 -129
- package/docs/rules/unique-argument-names.md +0 -19
- package/docs/rules/unique-directive-names-per-location.md +0 -21
- package/docs/rules/unique-directive-names.md +0 -19
- package/docs/rules/unique-enum-value-names.md +0 -16
- package/docs/rules/unique-field-definition-names.md +0 -19
- package/docs/rules/unique-fragment-name.md +0 -52
- package/docs/rules/unique-input-field-names.md +0 -19
- package/docs/rules/unique-operation-name.md +0 -56
- package/docs/rules/unique-operation-types.md +0 -19
- package/docs/rules/unique-type-names.md +0 -19
- package/docs/rules/unique-variable-names.md +0 -19
- package/docs/rules/value-literals-of-correct-type.md +0 -22
- package/docs/rules/variables-are-input-types.md +0 -20
- package/docs/rules/variables-in-allowed-position.md +0 -19
@@ -1,86 +0,0 @@
|
|
1
|
-
# `selection-set-depth`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
💡 This rule provides
|
7
|
-
[suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
|
8
|
-
|
9
|
-
- Category: `Operations`
|
10
|
-
- Rule name: `@graphql-eslint/selection-set-depth`
|
11
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
12
|
-
- Requires GraphQL Operations: `true`
|
13
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
14
|
-
|
15
|
-
Limit the complexity of the GraphQL operations solely by their depth. Based on
|
16
|
-
[graphql-depth-limit](https://npmjs.com/package/graphql-depth-limit).
|
17
|
-
|
18
|
-
## Usage Examples
|
19
|
-
|
20
|
-
### Incorrect
|
21
|
-
|
22
|
-
```graphql
|
23
|
-
# eslint @graphql-eslint/selection-set-depth: ['error', { maxDepth: 1 }]
|
24
|
-
|
25
|
-
query deep2 {
|
26
|
-
viewer {
|
27
|
-
# Level 0
|
28
|
-
albums {
|
29
|
-
# Level 1
|
30
|
-
title # Level 2
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
```
|
35
|
-
|
36
|
-
### Correct
|
37
|
-
|
38
|
-
```graphql
|
39
|
-
# eslint @graphql-eslint/selection-set-depth: ['error', { maxDepth: 4 }]
|
40
|
-
|
41
|
-
query deep2 {
|
42
|
-
viewer {
|
43
|
-
# Level 0
|
44
|
-
albums {
|
45
|
-
# Level 1
|
46
|
-
title # Level 2
|
47
|
-
}
|
48
|
-
}
|
49
|
-
}
|
50
|
-
```
|
51
|
-
|
52
|
-
### Correct (ignored field)
|
53
|
-
|
54
|
-
```graphql
|
55
|
-
# eslint @graphql-eslint/selection-set-depth: ['error', { maxDepth: 1, ignore: ['albums'] }]
|
56
|
-
|
57
|
-
query deep2 {
|
58
|
-
viewer {
|
59
|
-
# Level 0
|
60
|
-
albums {
|
61
|
-
# Level 1
|
62
|
-
title # Level 2
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
```
|
67
|
-
|
68
|
-
## Config Schema
|
69
|
-
|
70
|
-
The schema defines the following properties:
|
71
|
-
|
72
|
-
### `maxDepth` (number, required)
|
73
|
-
|
74
|
-
### `ignore` (array)
|
75
|
-
|
76
|
-
The object is an array with all elements of the type `string`.
|
77
|
-
|
78
|
-
Additional restrictions:
|
79
|
-
|
80
|
-
- Minimum items: `1`
|
81
|
-
- Unique items: `true`
|
82
|
-
|
83
|
-
## Resources
|
84
|
-
|
85
|
-
- [Rule source](../../packages/plugin/src/rules/selection-set-depth.ts)
|
86
|
-
- [Test source](../../packages/plugin/tests/selection-set-depth.spec.ts)
|
@@ -1,129 +0,0 @@
|
|
1
|
-
# `strict-id-in-types`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Schema`
|
7
|
-
- Rule name: `@graphql-eslint/strict-id-in-types`
|
8
|
-
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
Requires output types to have one unique identifier unless they do not have a logical one.
|
13
|
-
Exceptions can be used to ignore output types that do not have unique identifiers.
|
14
|
-
|
15
|
-
## Usage Examples
|
16
|
-
|
17
|
-
### Incorrect
|
18
|
-
|
19
|
-
```graphql
|
20
|
-
# eslint @graphql-eslint/strict-id-in-types: ['error', { acceptedIdNames: ['id', '_id'], acceptedIdTypes: ['ID'], exceptions: { suffixes: ['Payload'] } }]
|
21
|
-
|
22
|
-
# Incorrect field name
|
23
|
-
type InvalidFieldName {
|
24
|
-
key: ID!
|
25
|
-
}
|
26
|
-
|
27
|
-
# Incorrect field type
|
28
|
-
type InvalidFieldType {
|
29
|
-
id: String!
|
30
|
-
}
|
31
|
-
|
32
|
-
# Incorrect exception suffix
|
33
|
-
type InvalidSuffixResult {
|
34
|
-
data: String!
|
35
|
-
}
|
36
|
-
|
37
|
-
# Too many unique identifiers. Must only contain one.
|
38
|
-
type InvalidFieldName {
|
39
|
-
id: ID!
|
40
|
-
_id: ID!
|
41
|
-
}
|
42
|
-
```
|
43
|
-
|
44
|
-
### Correct
|
45
|
-
|
46
|
-
```graphql
|
47
|
-
# eslint @graphql-eslint/strict-id-in-types: ['error', { acceptedIdNames: ['id', '_id'], acceptedIdTypes: ['ID'], exceptions: { types: ['Error'], suffixes: ['Payload'] } }]
|
48
|
-
|
49
|
-
type User {
|
50
|
-
id: ID!
|
51
|
-
}
|
52
|
-
|
53
|
-
type Post {
|
54
|
-
_id: ID!
|
55
|
-
}
|
56
|
-
|
57
|
-
type CreateUserPayload {
|
58
|
-
data: String!
|
59
|
-
}
|
60
|
-
|
61
|
-
type Error {
|
62
|
-
message: String!
|
63
|
-
}
|
64
|
-
```
|
65
|
-
|
66
|
-
## Config Schema
|
67
|
-
|
68
|
-
The schema defines the following properties:
|
69
|
-
|
70
|
-
### `acceptedIdNames` (array)
|
71
|
-
|
72
|
-
The object is an array with all elements of the type `string`.
|
73
|
-
|
74
|
-
Default:
|
75
|
-
|
76
|
-
```json
|
77
|
-
["id"]
|
78
|
-
```
|
79
|
-
|
80
|
-
Additional restrictions:
|
81
|
-
|
82
|
-
- Minimum items: `1`
|
83
|
-
- Unique items: `true`
|
84
|
-
|
85
|
-
### `acceptedIdTypes` (array)
|
86
|
-
|
87
|
-
The object is an array with all elements of the type `string`.
|
88
|
-
|
89
|
-
Default:
|
90
|
-
|
91
|
-
```json
|
92
|
-
["ID"]
|
93
|
-
```
|
94
|
-
|
95
|
-
Additional restrictions:
|
96
|
-
|
97
|
-
- Minimum items: `1`
|
98
|
-
- Unique items: `true`
|
99
|
-
|
100
|
-
### `exceptions` (object)
|
101
|
-
|
102
|
-
Properties of the `exceptions` object:
|
103
|
-
|
104
|
-
#### `types` (array)
|
105
|
-
|
106
|
-
This is used to exclude types with names that match one of the specified values.
|
107
|
-
|
108
|
-
The object is an array with all elements of the type `string`.
|
109
|
-
|
110
|
-
Additional restrictions:
|
111
|
-
|
112
|
-
- Minimum items: `1`
|
113
|
-
- Unique items: `true`
|
114
|
-
|
115
|
-
#### `suffixes` (array)
|
116
|
-
|
117
|
-
This is used to exclude types with names with suffixes that match one of the specified values.
|
118
|
-
|
119
|
-
The object is an array with all elements of the type `string`.
|
120
|
-
|
121
|
-
Additional restrictions:
|
122
|
-
|
123
|
-
- Minimum items: `1`
|
124
|
-
- Unique items: `true`
|
125
|
-
|
126
|
-
## Resources
|
127
|
-
|
128
|
-
- [Rule source](../../packages/plugin/src/rules/strict-id-in-types.ts)
|
129
|
-
- [Test source](../../packages/plugin/tests/strict-id-in-types.spec.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `unique-argument-names`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Operations`
|
7
|
-
- Rule name: `@graphql-eslint/unique-argument-names`
|
8
|
-
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL field or directive is only valid if all supplied arguments are uniquely named.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueArgumentNamesRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueArgumentNamesRule-test.ts)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# `unique-directive-names-per-location`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` and
|
4
|
-
`"plugin:@graphql-eslint/operations-recommended"` property in a configuration file enables this
|
5
|
-
rule.
|
6
|
-
|
7
|
-
- Category: `Schema & Operations`
|
8
|
-
- Rule name: `@graphql-eslint/unique-directive-names-per-location`
|
9
|
-
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
10
|
-
- Requires GraphQL Operations: `false`
|
11
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
12
|
-
|
13
|
-
A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely
|
14
|
-
named.
|
15
|
-
|
16
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
17
|
-
|
18
|
-
## Resources
|
19
|
-
|
20
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectivesPerLocationRule.ts)
|
21
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `unique-directive-names`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Schema`
|
7
|
-
- Rule name: `@graphql-eslint/unique-directive-names`
|
8
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL document is only valid if all defined directives have unique names.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectiveNamesRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts)
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# `unique-enum-value-names`
|
2
|
-
|
3
|
-
- Category: `Schema`
|
4
|
-
- Rule name: `@graphql-eslint/unique-enum-value-names`
|
5
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
6
|
-
- Requires GraphQL Operations: `false`
|
7
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
8
|
-
|
9
|
-
A GraphQL enum type is only valid if all its values are uniquely named.
|
10
|
-
|
11
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
12
|
-
|
13
|
-
## Resources
|
14
|
-
|
15
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueEnumValueNamesRule.ts)
|
16
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `unique-field-definition-names`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Schema`
|
7
|
-
- Rule name: `@graphql-eslint/unique-field-definition-names`
|
8
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL complex type is only valid if all its fields are uniquely named.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueFieldDefinitionNamesRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts)
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# `unique-fragment-name`
|
2
|
-
|
3
|
-
- Category: `Operations`
|
4
|
-
- Rule name: `@graphql-eslint/unique-fragment-name`
|
5
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
6
|
-
- Requires GraphQL Operations: `true`
|
7
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
8
|
-
|
9
|
-
Enforce unique fragment names across your project.
|
10
|
-
|
11
|
-
## Usage Examples
|
12
|
-
|
13
|
-
### Incorrect
|
14
|
-
|
15
|
-
```graphql
|
16
|
-
# eslint @graphql-eslint/unique-fragment-name: 'error'
|
17
|
-
|
18
|
-
# user.fragment.graphql
|
19
|
-
fragment UserFields on User {
|
20
|
-
id
|
21
|
-
name
|
22
|
-
fullName
|
23
|
-
}
|
24
|
-
|
25
|
-
# user-fields.graphql
|
26
|
-
fragment UserFields on User {
|
27
|
-
id
|
28
|
-
}
|
29
|
-
```
|
30
|
-
|
31
|
-
### Correct
|
32
|
-
|
33
|
-
```graphql
|
34
|
-
# eslint @graphql-eslint/unique-fragment-name: 'error'
|
35
|
-
|
36
|
-
# user.fragment.graphql
|
37
|
-
fragment AllUserFields on User {
|
38
|
-
id
|
39
|
-
name
|
40
|
-
fullName
|
41
|
-
}
|
42
|
-
|
43
|
-
# user-fields.graphql
|
44
|
-
fragment UserFields on User {
|
45
|
-
id
|
46
|
-
}
|
47
|
-
```
|
48
|
-
|
49
|
-
## Resources
|
50
|
-
|
51
|
-
- [Rule source](../../packages/plugin/src/rules/unique-fragment-name.ts)
|
52
|
-
- [Test source](../../packages/plugin/tests/unique-fragment-name.spec.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `unique-input-field-names`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Operations`
|
7
|
-
- Rule name: `@graphql-eslint/unique-input-field-names`
|
8
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL input object value is only valid if all supplied fields are uniquely named.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueInputFieldNamesRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts)
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# `unique-operation-name`
|
2
|
-
|
3
|
-
- Category: `Operations`
|
4
|
-
- Rule name: `@graphql-eslint/unique-operation-name`
|
5
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
6
|
-
- Requires GraphQL Operations: `true`
|
7
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
8
|
-
|
9
|
-
Enforce unique operation names across your project.
|
10
|
-
|
11
|
-
## Usage Examples
|
12
|
-
|
13
|
-
### Incorrect
|
14
|
-
|
15
|
-
```graphql
|
16
|
-
# eslint @graphql-eslint/unique-operation-name: 'error'
|
17
|
-
|
18
|
-
# foo.query.graphql
|
19
|
-
query user {
|
20
|
-
user {
|
21
|
-
id
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
# bar.query.graphql
|
26
|
-
query user {
|
27
|
-
me {
|
28
|
-
id
|
29
|
-
}
|
30
|
-
}
|
31
|
-
```
|
32
|
-
|
33
|
-
### Correct
|
34
|
-
|
35
|
-
```graphql
|
36
|
-
# eslint @graphql-eslint/unique-operation-name: 'error'
|
37
|
-
|
38
|
-
# foo.query.graphql
|
39
|
-
query user {
|
40
|
-
user {
|
41
|
-
id
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
# bar.query.graphql
|
46
|
-
query me {
|
47
|
-
me {
|
48
|
-
id
|
49
|
-
}
|
50
|
-
}
|
51
|
-
```
|
52
|
-
|
53
|
-
## Resources
|
54
|
-
|
55
|
-
- [Rule source](../../packages/plugin/src/rules/unique-operation-name.ts)
|
56
|
-
- [Test source](../../packages/plugin/tests/unique-operation-name.spec.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `unique-operation-types`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Schema`
|
7
|
-
- Rule name: `@graphql-eslint/unique-operation-types`
|
8
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL document is only valid if it has only one type per operation.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueOperationTypesRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueOperationTypesRule-test.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `unique-type-names`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Schema`
|
7
|
-
- Rule name: `@graphql-eslint/unique-type-names`
|
8
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL document is only valid if all defined types have unique names.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueTypeNamesRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueTypeNamesRule-test.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `unique-variable-names`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Operations`
|
7
|
-
- Rule name: `@graphql-eslint/unique-variable-names`
|
8
|
-
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL operation is only valid if all its variables are uniquely named.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueVariableNamesRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueVariableNamesRule-test.ts)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# `value-literals-of-correct-type`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
💡 This rule provides
|
7
|
-
[suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
|
8
|
-
|
9
|
-
- Category: `Operations`
|
10
|
-
- Rule name: `@graphql-eslint/value-literals-of-correct-type`
|
11
|
-
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
12
|
-
- Requires GraphQL Operations: `false`
|
13
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
14
|
-
|
15
|
-
A GraphQL document is only valid if all value literals are of the type expected at their position.
|
16
|
-
|
17
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
18
|
-
|
19
|
-
## Resources
|
20
|
-
|
21
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ValuesOfCorrectTypeRule.ts)
|
22
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts)
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# `variables-are-input-types`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Operations`
|
7
|
-
- Rule name: `@graphql-eslint/variables-are-input-types`
|
8
|
-
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum,
|
13
|
-
or input object).
|
14
|
-
|
15
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
16
|
-
|
17
|
-
## Resources
|
18
|
-
|
19
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesAreInputTypesRule.ts)
|
20
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/VariablesAreInputTypesRule-test.ts)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# `variables-in-allowed-position`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/operations-recommended"` property in a configuration file
|
4
|
-
enables this rule.
|
5
|
-
|
6
|
-
- Category: `Operations`
|
7
|
-
- Rule name: `@graphql-eslint/variables-in-allowed-position`
|
8
|
-
- Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
9
|
-
- Requires GraphQL Operations: `false`
|
10
|
-
[ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
Variables passed to field arguments conform to type.
|
13
|
-
|
14
|
-
> This rule is a wrapper around a `graphql-js` validation function.
|
15
|
-
|
16
|
-
## Resources
|
17
|
-
|
18
|
-
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/VariablesInAllowedPositionRule.ts)
|
19
|
-
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts)
|