@graphql-eslint/eslint-plugin 2.3.0-alpha-f7157af.0 → 2.3.2-alpha-2901045.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/README.md +1 -1
- package/docs/README.md +1 -1
- package/docs/custom-rules.md +3 -3
- package/docs/rules/alphabetize.md +6 -1
- package/docs/rules/avoid-duplicate-fields.md +6 -1
- package/docs/rules/avoid-operation-name-prefix.md +5 -1
- package/docs/rules/avoid-scalar-result-type-on-mutation.md +6 -1
- package/docs/rules/avoid-typename-prefix.md +6 -1
- package/docs/rules/description-style.md +6 -1
- package/docs/rules/executable-definitions.md +6 -1
- package/docs/rules/fields-on-correct-type.md +6 -1
- package/docs/rules/fragments-on-composite-type.md +6 -1
- package/docs/rules/input-name.md +6 -1
- package/docs/rules/known-argument-names.md +6 -1
- package/docs/rules/known-directives.md +6 -1
- package/docs/rules/known-fragment-names.md +6 -1
- package/docs/rules/known-type-names.md +6 -1
- package/docs/rules/lone-anonymous-operation.md +6 -1
- package/docs/rules/lone-schema-definition.md +6 -1
- package/docs/rules/match-document-filename.md +6 -1
- package/docs/rules/naming-convention.md +6 -1
- package/docs/rules/no-anonymous-operations.md +6 -1
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
- package/docs/rules/no-deprecated.md +6 -1
- package/docs/rules/no-fragment-cycles.md +6 -1
- package/docs/rules/no-hashtag-description.md +6 -1
- package/docs/rules/no-operation-name-suffix.md +5 -1
- package/docs/rules/no-undefined-variables.md +6 -1
- package/docs/rules/no-unreachable-types.md +6 -1
- package/docs/rules/no-unused-fields.md +6 -1
- package/docs/rules/no-unused-fragments.md +6 -1
- package/docs/rules/no-unused-variables.md +6 -1
- package/docs/rules/one-field-subscriptions.md +6 -1
- package/docs/rules/overlapping-fields-can-be-merged.md +6 -1
- package/docs/rules/possible-fragment-spread.md +6 -1
- package/docs/rules/possible-type-extension.md +6 -1
- package/docs/rules/provided-required-arguments.md +6 -1
- package/docs/rules/require-deprecation-date.md +6 -1
- package/docs/rules/require-deprecation-reason.md +6 -1
- package/docs/rules/require-description.md +6 -1
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +6 -1
- package/docs/rules/require-id-when-available.md +6 -1
- package/docs/rules/scalar-leafs.md +6 -1
- package/docs/rules/selection-set-depth.md +6 -1
- package/docs/rules/strict-id-in-types.md +6 -1
- package/docs/rules/unique-argument-names.md +6 -1
- package/docs/rules/unique-directive-names-per-location.md +6 -1
- package/docs/rules/unique-directive-names.md +6 -1
- package/docs/rules/unique-enum-value-names.md +6 -1
- package/docs/rules/unique-field-definition-names.md +6 -1
- package/docs/rules/unique-fragment-name.md +6 -1
- package/docs/rules/unique-input-field-names.md +6 -1
- package/docs/rules/unique-operation-name.md +6 -1
- package/docs/rules/unique-operation-types.md +6 -1
- package/docs/rules/unique-type-names.md +6 -1
- package/docs/rules/unique-variable-names.md +6 -1
- package/docs/rules/value-literals-of-correct-type.md +6 -1
- package/docs/rules/variables-are-input-types.md +6 -1
- package/docs/rules/variables-in-allowed-position.md +6 -1
- package/index.js +167 -55
- package/index.mjs +167 -55
- package/package.json +1 -1
- package/testkit.d.ts +5 -3
- package/types.d.ts +2 -0
- package/utils.d.ts +4 -0
package/README.md
CHANGED
@@ -46,7 +46,7 @@ npm install --save-dev @graphql-eslint/eslint-plugin
|
|
46
46
|
|
47
47
|
### Configuration
|
48
48
|
|
49
|
-
To get started, create an override configuration for your ESLint, while applying it to
|
49
|
+
To get started, create an override configuration for your ESLint, while applying it to `.graphql` files (do that even if you are declaring your operations in code files):
|
50
50
|
|
51
51
|
```json
|
52
52
|
{
|
package/docs/README.md
CHANGED
package/docs/custom-rules.md
CHANGED
@@ -38,7 +38,7 @@ const rule: GraphQLESLintRule = {
|
|
38
38
|
So what happens here?
|
39
39
|
|
40
40
|
1. `@graphql-eslint/eslint-plugin` handles the parsing process for your GraphQL content. It will load the GraphQL files (either from code files or from `.graphql` files with SDL), parse it using GraphQL parser, converts it to ESTree structure and let ESLint do the rest.
|
41
|
-
1.
|
41
|
+
1. Your rule is being loaded by ESLint, and executes just like any other ESLint rule.
|
42
42
|
1. Our custom rule asks ESLint to run our function for every `OperationDefinition` found.
|
43
43
|
1. If the `OperationDefinition` node doesn't have a valid `name` - we report an error to ESLint.
|
44
44
|
|
@@ -49,7 +49,7 @@ You can scan the `packages/plugin/src/rules` directory in this repo for referenc
|
|
49
49
|
## Accessing original GraphQL AST nodes
|
50
50
|
|
51
51
|
Since our parser converts GraphQL AST to ESTree structure, there are some minor differences in the structure of the objects.
|
52
|
-
If you are using TypeScript, and you typed your rule with `GraphQLESLintRule` - you'll see that each `node` is a bit different from
|
52
|
+
If you are using TypeScript, and you typed your rule with `GraphQLESLintRule` - you'll see that each `node` is a bit different from the AST nodes of GraphQL (you can read more about that in [graphql-eslint parser documentation](./parser.md)).
|
53
53
|
|
54
54
|
If you need access to the original GraphQL AST `node`, you can use `.rawNode()` method on each node you get from the AST structure of ESLint.
|
55
55
|
|
@@ -58,7 +58,7 @@ This is useful if you wish to use other GraphQL tools that works with the origin
|
|
58
58
|
Here's an example for using original `graphql-js` validate method to validate `OperationDefinition`:
|
59
59
|
|
60
60
|
```ts
|
61
|
-
import { validate } from 'graphql
|
61
|
+
import { validate } from 'graphql';
|
62
62
|
import { requireGraphQLSchemaFromContext } from '@graphql-eslint/eslint-plugin';
|
63
63
|
|
64
64
|
export const rule = {
|
@@ -137,4 +137,9 @@ The elements of the array must contain the following properties:
|
|
137
137
|
- `FieldDefinition`
|
138
138
|
- `Field`
|
139
139
|
- `DirectiveDefinition`
|
140
|
-
- `Directive`
|
140
|
+
- `Directive`
|
141
|
+
|
142
|
+
## Resources
|
143
|
+
|
144
|
+
- [Rule source](../../packages/plugin/src/rules/alphabetize.ts)
|
145
|
+
- [Test source](../../packages/plugin/tests/alphabetize.spec.ts)
|
@@ -27,4 +27,9 @@ type Mutation {
|
|
27
27
|
type Mutation {
|
28
28
|
createUser: User!
|
29
29
|
}
|
30
|
-
```
|
30
|
+
```
|
31
|
+
|
32
|
+
## Resources
|
33
|
+
|
34
|
+
- [Rule source](../../packages/plugin/src/rules/avoid-scalar-result-type-on-mutation.ts)
|
35
|
+
- [Test source](../../packages/plugin/tests/avoid-scalar-result-type-on-mutation.spec.ts)
|
@@ -42,4 +42,9 @@ This element must be one of the following enum values:
|
|
42
42
|
* `block`
|
43
43
|
* `inline`
|
44
44
|
|
45
|
-
Default: `"inline"`
|
45
|
+
Default: `"inline"`
|
46
|
+
|
47
|
+
## Resources
|
48
|
+
|
49
|
+
- [Rule source](../../packages/plugin/src/rules/description-style.ts)
|
50
|
+
- [Test source](../../packages/plugin/tests/description-style.spec.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ExecutableDefinitionsRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ExecutableDefinitionsRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ExecutableDefinitionsRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ExecutableDefinitionsRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
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`.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FieldsOnCorrectTypeRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FieldsOnCorrectTypeRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FieldsOnCorrectTypeRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
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.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FragmentsOnCompositeTypesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FragmentsOnCompositeTypesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/FragmentsOnCompositeTypesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts)
|
package/docs/rules/input-name.md
CHANGED
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL field is only valid if all supplied arguments are defined by that field.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownArgumentNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownArgumentNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownArgumentNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownArgumentNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownDirectivesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownDirectivesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownDirectivesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownDirectivesRule-test.ts)
|
@@ -82,4 +82,9 @@ const GET_USER = /* GraphQL */ `
|
|
82
82
|
# Will give false positive error 'Unknown fragment "UserFields"'
|
83
83
|
${USER_FIELDS}
|
84
84
|
`
|
85
|
-
```
|
85
|
+
```
|
86
|
+
|
87
|
+
## Resources
|
88
|
+
|
89
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownFragmentNamesRule.ts)
|
90
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownFragmentNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownTypeNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownTypeNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/KnownTypeNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/KnownTypeNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneAnonymousOperationRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneAnonymousOperationRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneAnonymousOperationRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/LoneAnonymousOperationRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if it contains only one schema definition.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneSchemaDefinitionRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneSchemaDefinitionRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/LoneSchemaDefinitionRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts)
|
@@ -145,4 +145,9 @@ This element must be one of the following enum values:
|
|
145
145
|
* `PascalCase`
|
146
146
|
* `snake_case`
|
147
147
|
* `UPPER_CASE`
|
148
|
-
* `kebab-case`
|
148
|
+
* `kebab-case`
|
149
|
+
|
150
|
+
## Resources
|
151
|
+
|
152
|
+
- [Rule source](../../packages/plugin/src/rules/match-document-filename.ts)
|
153
|
+
- [Test source](../../packages/plugin/tests/match-document-filename.spec.ts)
|
@@ -178,4 +178,9 @@ The object is an array with all elements of the type `string`.
|
|
178
178
|
|
179
179
|
Additional restrictions:
|
180
180
|
|
181
|
-
* Minimum items: `1`
|
181
|
+
* Minimum items: `1`
|
182
|
+
|
183
|
+
## Resources
|
184
|
+
|
185
|
+
- [Rule source](../../packages/plugin/src/rules/naming-convention.ts)
|
186
|
+
- [Test source](../../packages/plugin/tests/naming-convention.spec.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL fragment is only valid when it does not have cycles in fragments usage.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoFragmentCyclesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoFragmentCyclesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoFragmentCyclesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoFragmentCyclesRule-test.ts)
|
@@ -47,4 +47,9 @@ type User {
|
|
47
47
|
id: ID! # This one is also valid, since it comes after the AST object
|
48
48
|
name: String
|
49
49
|
}
|
50
|
-
```
|
50
|
+
```
|
51
|
+
|
52
|
+
## Resources
|
53
|
+
|
54
|
+
- [Rule source](../../packages/plugin/src/rules/no-hashtag-description.ts)
|
55
|
+
- [Test source](../../packages/plugin/tests/no-hashtag-description.spec.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUndefinedVariablesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUndefinedVariablesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUndefinedVariablesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoUndefinedVariablesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedFragmentsRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedFragmentsRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedFragmentsRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoUnusedFragmentsRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedVariablesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedVariablesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/NoUnusedVariablesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/NoUnusedVariablesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL subscription is valid only if it contains a single root field.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/SingleFieldSubscriptionsRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/SingleFieldSubscriptionsRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/SingleFieldSubscriptionsRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
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.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
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.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleFragmentSpreadsRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleFragmentSpreadsRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleFragmentSpreadsRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A type extension is only valid if the type is defined and has the same kind.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleTypeExtensionsRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleTypeExtensionsRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/PossibleTypeExtensionsRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ProvidedRequiredArgumentsRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ProvidedRequiredArgumentsRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ProvidedRequiredArgumentsRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts)
|
@@ -46,4 +46,9 @@ type User {
|
|
46
46
|
|
47
47
|
The schema defines the following properties:
|
48
48
|
|
49
|
-
### `argumentName` (string)
|
49
|
+
### `argumentName` (string)
|
50
|
+
|
51
|
+
## Resources
|
52
|
+
|
53
|
+
- [Rule source](../../packages/plugin/src/rules/require-deprecation-date.ts)
|
54
|
+
- [Test source](../../packages/plugin/tests/require-deprecation-date.spec.ts)
|
@@ -39,4 +39,9 @@ type MyType {
|
|
39
39
|
type MyType {
|
40
40
|
name: String @deprecated(reason: "no longer relevant, please use fullName field")
|
41
41
|
}
|
42
|
-
```
|
42
|
+
```
|
43
|
+
|
44
|
+
## Resources
|
45
|
+
|
46
|
+
- [Rule source](../../packages/plugin/src/rules/require-deprecation-reason.ts)
|
47
|
+
- [Test source](../../packages/plugin/tests/require-deprecation-reason.spec.ts)
|
@@ -45,4 +45,9 @@ The object is an array with all elements of the type `string`.
|
|
45
45
|
|
46
46
|
Additional restrictions:
|
47
47
|
|
48
|
-
* Minimum items: `1`
|
48
|
+
* Minimum items: `1`
|
49
|
+
|
50
|
+
## Resources
|
51
|
+
|
52
|
+
- [Rule source](../../packages/plugin/src/rules/require-description.ts)
|
53
|
+
- [Test source](../../packages/plugin/tests/require-description.spec.ts)
|
@@ -39,4 +39,9 @@ type CreateUserPayload {
|
|
39
39
|
type Mutation {
|
40
40
|
createUser: CreateUserPayload!
|
41
41
|
}
|
42
|
-
```
|
42
|
+
```
|
43
|
+
|
44
|
+
## Resources
|
45
|
+
|
46
|
+
- [Rule source](../../packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts)
|
47
|
+
- [Test source](../../packages/plugin/tests/require-field-of-type-query-in-mutation-result.spec.ts)
|
@@ -54,4 +54,9 @@ The schema defines the following properties:
|
|
54
54
|
|
55
55
|
### `fieldName` (string)
|
56
56
|
|
57
|
-
Default: `"id"`
|
57
|
+
Default: `"id"`
|
58
|
+
|
59
|
+
## Resources
|
60
|
+
|
61
|
+
- [Rule source](../../packages/plugin/src/rules/require-id-when-available.ts)
|
62
|
+
- [Test source](../../packages/plugin/tests/require-id-when-available.spec.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ScalarLeafsRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ScalarLeafsRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/ScalarLeafsRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/ScalarLeafsRule-test.ts)
|
@@ -59,4 +59,9 @@ The schema defines the following properties:
|
|
59
59
|
|
60
60
|
### `ignore` (array)
|
61
61
|
|
62
|
-
The object is an array with all elements of the type `string`.
|
62
|
+
The object is an array with all elements of the type `string`.
|
63
|
+
|
64
|
+
## Resources
|
65
|
+
|
66
|
+
- [Rule source](../../packages/plugin/src/rules/selection-set-depth.ts)
|
67
|
+
- [Test source](../../packages/plugin/tests/selection-set-depth.spec.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL field or directive is only valid if all supplied arguments are uniquely named.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueArgumentNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueArgumentNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueArgumentNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueArgumentNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectivesPerLocationRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectivesPerLocationRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectivesPerLocationRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL document is only valid if all defined directives have unique names.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectiveNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectiveNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueDirectiveNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL enum type is only valid if all its values are uniquely named.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueEnumValueNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueEnumValueNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueEnumValueNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts)
|
@@ -9,4 +9,9 @@
|
|
9
9
|
|
10
10
|
A GraphQL complex type is only valid if all its fields are uniquely named.
|
11
11
|
|
12
|
-
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueFieldDefinitionNamesRule.ts).
|
12
|
+
> This rule is a wrapper around a `graphql-js` validation function. [You can find its source code here](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueFieldDefinitionNamesRule.ts).
|
13
|
+
|
14
|
+
## Resources
|
15
|
+
|
16
|
+
- [Rule source](https://github.com/graphql/graphql-js/blob/main/src/validation/rules/UniqueFieldDefinitionNamesRule.ts)
|
17
|
+
- [Test source](https://github.com/graphql/graphql-js/tree/main/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts)
|