@graphql-eslint/eslint-plugin 3.14.0-alpha-20221221133443-5be7fc6 → 3.14.0-alpha-20221222012949-5caade4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +309 -0
- package/cjs/cache.js +30 -0
- package/cjs/configs/base.js +7 -0
- package/cjs/configs/index.js +16 -0
- package/cjs/configs/operations-all.js +31 -0
- package/cjs/configs/operations-recommended.js +56 -0
- package/cjs/configs/relay.js +12 -0
- package/cjs/configs/schema-all.js +23 -0
- package/cjs/configs/schema-recommended.js +52 -0
- package/cjs/documents.js +149 -0
- package/cjs/estree-converter/converter.js +62 -0
- package/cjs/estree-converter/index.js +6 -0
- package/cjs/estree-converter/types.js +2 -0
- package/cjs/estree-converter/utils.js +109 -0
- package/cjs/graphql-config.js +55 -0
- package/cjs/index.js +17 -0
- package/cjs/parser.js +61 -0
- package/cjs/processor.js +78 -0
- package/cjs/rules/alphabetize.js +348 -0
- package/cjs/rules/description-style.js +78 -0
- package/cjs/rules/graphql-js-validation.js +499 -0
- package/cjs/rules/index.js +68 -0
- package/cjs/rules/input-name.js +136 -0
- package/cjs/rules/lone-executable-definition.js +88 -0
- package/cjs/rules/match-document-filename.js +235 -0
- package/cjs/rules/naming-convention.js +310 -0
- package/cjs/rules/no-anonymous-operations.js +67 -0
- package/cjs/rules/no-case-insensitive-enum-values-duplicates.js +61 -0
- package/cjs/rules/no-deprecated.js +124 -0
- package/cjs/rules/no-duplicate-fields.js +112 -0
- package/cjs/rules/no-hashtag-description.js +89 -0
- package/cjs/rules/no-root-type.js +86 -0
- package/cjs/rules/no-scalar-result-type-on-mutation.js +66 -0
- package/cjs/rules/no-typename-prefix.js +65 -0
- package/cjs/rules/no-unreachable-types.js +158 -0
- package/cjs/rules/no-unused-fields.js +130 -0
- package/cjs/rules/relay-arguments.js +121 -0
- package/cjs/rules/relay-connection-types.js +107 -0
- package/cjs/rules/relay-edge-types.js +189 -0
- package/cjs/rules/relay-page-info.js +100 -0
- package/cjs/rules/require-deprecation-date.js +123 -0
- package/cjs/rules/require-deprecation-reason.js +56 -0
- package/cjs/rules/require-description.js +193 -0
- package/cjs/rules/require-field-of-type-query-in-mutation-result.js +72 -0
- package/cjs/rules/require-id-when-available.js +199 -0
- package/cjs/rules/selection-set-depth.js +135 -0
- package/cjs/rules/strict-id-in-types.js +162 -0
- package/cjs/rules/unique-fragment-name.js +90 -0
- package/cjs/rules/unique-operation-name.js +65 -0
- package/cjs/schema.js +42 -0
- package/cjs/testkit.js +183 -0
- package/cjs/types.js +2 -0
- package/cjs/utils.js +96 -0
- package/docs/README.md +82 -0
- package/docs/custom-rules.md +184 -0
- package/docs/deprecated-rules.md +24 -0
- package/docs/parser-options.md +95 -0
- package/docs/parser.md +67 -0
- package/docs/rules/alphabetize.md +194 -0
- package/docs/rules/description-style.md +57 -0
- package/docs/rules/executable-definitions.md +20 -0
- package/docs/rules/fields-on-correct-type.md +23 -0
- package/docs/rules/fragments-on-composite-type.md +20 -0
- package/docs/rules/input-name.md +80 -0
- package/docs/rules/known-argument-names.md +23 -0
- package/docs/rules/known-directives.md +48 -0
- package/docs/rules/known-fragment-names.md +72 -0
- package/docs/rules/known-type-names.md +24 -0
- package/docs/rules/lone-anonymous-operation.md +20 -0
- package/docs/rules/lone-executable-definition.md +59 -0
- package/docs/rules/lone-schema-definition.md +19 -0
- package/docs/rules/match-document-filename.md +181 -0
- package/docs/rules/naming-convention.md +320 -0
- package/docs/rules/no-anonymous-operations.md +43 -0
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +46 -0
- package/docs/rules/no-deprecated.md +88 -0
- package/docs/rules/no-duplicate-fields.md +69 -0
- package/docs/rules/no-fragment-cycles.md +19 -0
- package/docs/rules/no-hashtag-description.md +62 -0
- package/docs/rules/no-root-type.md +55 -0
- package/docs/rules/no-scalar-result-type-on-mutation.md +39 -0
- package/docs/rules/no-typename-prefix.md +42 -0
- package/docs/rules/no-undefined-variables.md +20 -0
- package/docs/rules/no-unreachable-types.md +52 -0
- package/docs/rules/no-unused-fields.md +64 -0
- package/docs/rules/no-unused-fragments.md +20 -0
- package/docs/rules/no-unused-variables.md +20 -0
- package/docs/rules/one-field-subscriptions.md +19 -0
- package/docs/rules/overlapping-fields-can-be-merged.md +20 -0
- package/docs/rules/possible-fragment-spread.md +21 -0
- package/docs/rules/possible-type-extension.md +19 -0
- package/docs/rules/provided-required-arguments.md +21 -0
- package/docs/rules/relay-arguments.md +59 -0
- package/docs/rules/relay-connection-types.md +43 -0
- package/docs/rules/relay-edge-types.md +60 -0
- package/docs/rules/relay-page-info.md +34 -0
- package/docs/rules/require-deprecation-date.md +59 -0
- package/docs/rules/require-deprecation-reason.md +49 -0
- package/docs/rules/require-description.md +147 -0
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +50 -0
- package/docs/rules/require-id-when-available.md +91 -0
- package/docs/rules/scalar-leafs.md +23 -0
- package/docs/rules/selection-set-depth.md +86 -0
- package/docs/rules/strict-id-in-types.md +129 -0
- package/docs/rules/unique-argument-names.md +19 -0
- package/docs/rules/unique-directive-names-per-location.md +21 -0
- package/docs/rules/unique-directive-names.md +19 -0
- package/docs/rules/unique-enum-value-names.md +16 -0
- package/docs/rules/unique-field-definition-names.md +19 -0
- package/docs/rules/unique-fragment-name.md +52 -0
- package/docs/rules/unique-input-field-names.md +19 -0
- package/docs/rules/unique-operation-name.md +56 -0
- package/docs/rules/unique-operation-types.md +19 -0
- package/docs/rules/unique-type-names.md +19 -0
- package/docs/rules/unique-variable-names.md +19 -0
- package/docs/rules/value-literals-of-correct-type.md +22 -0
- package/docs/rules/variables-are-input-types.md +20 -0
- package/docs/rules/variables-in-allowed-position.md +19 -0
- package/package.json +8 -11
- package/{cache.d.ts → typings/cache.d.cts} +0 -0
- package/typings/cache.d.ts +10 -0
- package/typings/configs/base.d.cts +5 -0
- package/typings/configs/base.d.ts +5 -0
- package/typings/configs/index.d.cts +139 -0
- package/typings/configs/index.d.ts +139 -0
- package/typings/configs/operations-all.d.cts +20 -0
- package/typings/configs/operations-all.d.ts +20 -0
- package/typings/configs/operations-recommended.d.cts +50 -0
- package/typings/configs/operations-recommended.d.ts +50 -0
- package/typings/configs/relay.d.cts +10 -0
- package/typings/configs/relay.d.ts +10 -0
- package/typings/configs/schema-all.d.cts +15 -0
- package/typings/configs/schema-all.d.ts +15 -0
- package/typings/configs/schema-recommended.d.cts +47 -0
- package/typings/configs/schema-recommended.d.ts +47 -0
- package/{documents.d.ts → typings/documents.d.cts} +0 -0
- package/typings/documents.d.ts +21 -0
- package/{estree-converter/converter.d.ts → typings/estree-converter/converter.d.cts} +0 -0
- package/typings/estree-converter/converter.d.ts +3 -0
- package/{estree-converter/index.d.ts → typings/estree-converter/index.d.cts} +0 -0
- package/typings/estree-converter/index.d.ts +3 -0
- package/{estree-converter/types.d.ts → typings/estree-converter/types.d.cts} +0 -0
- package/typings/estree-converter/types.d.ts +40 -0
- package/{estree-converter/utils.d.ts → typings/estree-converter/utils.d.cts} +0 -0
- package/typings/estree-converter/utils.d.ts +13 -0
- package/{graphql-config.d.ts → typings/graphql-config.d.cts} +0 -0
- package/typings/graphql-config.d.ts +4 -0
- package/typings/index.d.cts +9 -0
- package/{index.d.ts → typings/index.d.ts} +1 -5
- package/{parser.d.ts → typings/parser.d.cts} +0 -0
- package/typings/parser.d.ts +2 -0
- package/{processor.d.ts → typings/processor.d.cts} +0 -0
- package/typings/processor.d.ts +6 -0
- package/{rules/alphabetize.d.ts → typings/rules/alphabetize.d.cts} +0 -0
- package/typings/rules/alphabetize.d.ts +76 -0
- package/{rules/description-style.d.ts → typings/rules/description-style.d.cts} +0 -0
- package/typings/rules/description-style.d.ts +20 -0
- package/{rules/graphql-js-validation.d.ts → typings/rules/graphql-js-validation.d.cts} +0 -0
- package/typings/rules/graphql-js-validation.d.ts +2 -0
- package/{rules/index.d.ts → typings/rules/index.d.cts} +0 -0
- package/typings/rules/index.d.ts +104 -0
- package/{rules/input-name.d.ts → typings/rules/input-name.d.cts} +0 -0
- package/typings/rules/input-name.d.ts +35 -0
- package/{rules/lone-executable-definition.d.ts → typings/rules/lone-executable-definition.d.cts} +0 -0
- package/typings/rules/lone-executable-definition.d.ts +26 -0
- package/{rules/match-document-filename.d.ts → typings/rules/match-document-filename.d.cts} +0 -0
- package/typings/rules/match-document-filename.d.ts +72 -0
- package/{rules/naming-convention.d.ts → typings/rules/naming-convention.d.cts} +0 -0
- package/typings/rules/naming-convention.d.ts +83 -0
- package/{rules/no-anonymous-operations.d.ts → typings/rules/no-anonymous-operations.d.cts} +0 -0
- package/{rules/no-case-insensitive-enum-values-duplicates.d.ts → typings/rules/no-anonymous-operations.d.ts} +0 -0
- package/{rules/no-hashtag-description.d.ts → typings/rules/no-case-insensitive-enum-values-duplicates.d.cts} +0 -0
- package/{rules/no-scalar-result-type-on-mutation.d.ts → typings/rules/no-case-insensitive-enum-values-duplicates.d.ts} +0 -0
- package/{rules/no-deprecated.d.ts → typings/rules/no-deprecated.d.cts} +0 -0
- package/typings/rules/no-deprecated.d.ts +2 -0
- package/{rules/no-duplicate-fields.d.ts → typings/rules/no-duplicate-fields.d.cts} +0 -0
- package/{rules/relay-page-info.d.ts → typings/rules/no-duplicate-fields.d.ts} +0 -0
- package/{rules/no-typename-prefix.d.ts → typings/rules/no-hashtag-description.d.cts} +0 -0
- package/{rules/no-unreachable-types.d.ts → typings/rules/no-hashtag-description.d.ts} +0 -0
- package/{rules/no-root-type.d.ts → typings/rules/no-root-type.d.cts} +0 -0
- package/typings/rules/no-root-type.d.ts +25 -0
- package/{rules/no-unused-fields.d.ts → typings/rules/no-scalar-result-type-on-mutation.d.cts} +0 -0
- package/{rules/unique-operation-name.d.ts → typings/rules/no-scalar-result-type-on-mutation.d.ts} +0 -0
- package/typings/rules/no-typename-prefix.d.cts +2 -0
- package/typings/rules/no-typename-prefix.d.ts +2 -0
- package/typings/rules/no-unreachable-types.d.cts +2 -0
- package/typings/rules/no-unreachable-types.d.ts +2 -0
- package/typings/rules/no-unused-fields.d.cts +2 -0
- package/typings/rules/no-unused-fields.d.ts +2 -0
- package/{rules/relay-arguments.d.ts → typings/rules/relay-arguments.d.cts} +0 -0
- package/typings/rules/relay-arguments.d.ts +21 -0
- package/{rules/relay-connection-types.d.ts → typings/rules/relay-connection-types.d.cts} +0 -0
- package/typings/rules/relay-connection-types.d.ts +4 -0
- package/{rules/relay-edge-types.d.ts → typings/rules/relay-edge-types.d.cts} +0 -0
- package/typings/rules/relay-edge-types.d.ts +31 -0
- package/{rules/require-deprecation-reason.d.ts → typings/rules/relay-page-info.d.cts} +0 -0
- package/{rules/require-field-of-type-query-in-mutation-result.d.ts → typings/rules/relay-page-info.d.ts} +0 -0
- package/{rules/require-deprecation-date.d.ts → typings/rules/require-deprecation-date.d.cts} +0 -0
- package/typings/rules/require-deprecation-date.d.ts +18 -0
- package/typings/rules/require-deprecation-reason.d.cts +2 -0
- package/typings/rules/require-deprecation-reason.d.ts +2 -0
- package/{rules/require-description.d.ts → typings/rules/require-description.d.cts} +0 -0
- package/typings/rules/require-description.d.ts +14 -0
- package/typings/rules/require-field-of-type-query-in-mutation-result.d.cts +2 -0
- package/typings/rules/require-field-of-type-query-in-mutation-result.d.ts +2 -0
- package/{rules/require-id-when-available.d.ts → typings/rules/require-id-when-available.d.cts} +0 -0
- package/typings/rules/require-id-when-available.d.ts +36 -0
- package/{rules/selection-set-depth.d.ts → typings/rules/selection-set-depth.d.cts} +0 -0
- package/typings/rules/selection-set-depth.d.ts +28 -0
- package/{rules/strict-id-in-types.d.ts → typings/rules/strict-id-in-types.d.cts} +0 -0
- package/typings/rules/strict-id-in-types.d.ts +57 -0
- package/{rules/unique-fragment-name.d.ts → typings/rules/unique-fragment-name.d.cts} +0 -0
- package/typings/rules/unique-fragment-name.d.ts +5 -0
- package/typings/rules/unique-operation-name.d.cts +2 -0
- package/typings/rules/unique-operation-name.d.ts +2 -0
- package/{schema.d.ts → typings/schema.d.cts} +0 -0
- package/typings/schema.d.ts +3 -0
- package/{testkit.d.ts → typings/testkit.d.cts} +0 -0
- package/typings/testkit.d.ts +27 -0
- package/{types.d.ts → typings/types.d.cts} +0 -0
- package/typings/types.d.ts +81 -0
- package/{utils.d.ts → typings/utils.d.cts} +0 -0
- package/typings/utils.d.ts +34 -0
- package/configs/base.json +0 -4
- package/configs/operations-all.json +0 -25
- package/configs/operations-recommended.json +0 -50
- package/configs/relay.json +0 -9
- package/configs/schema-all.json +0 -17
- package/configs/schema-recommended.json +0 -49
- package/index.js +0 -4995
- package/index.mjs +0 -4983
@@ -0,0 +1,56 @@
|
|
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)
|
@@ -0,0 +1,19 @@
|
|
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)
|
@@ -0,0 +1,19 @@
|
|
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)
|
@@ -0,0 +1,19 @@
|
|
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)
|
@@ -0,0 +1,22 @@
|
|
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)
|
@@ -0,0 +1,20 @@
|
|
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)
|
@@ -0,0 +1,19 @@
|
|
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)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "3.14.0-alpha-
|
3
|
+
"version": "3.14.0-alpha-20221222012949-5caade4",
|
4
4
|
"description": "GraphQL plugin for ESLint",
|
5
5
|
"sideEffects": false,
|
6
6
|
"peerDependencies": {
|
@@ -27,21 +27,18 @@
|
|
27
27
|
],
|
28
28
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
29
29
|
"license": "MIT",
|
30
|
-
"main": "index.js",
|
31
|
-
"
|
32
|
-
"typings": "index.d.ts",
|
30
|
+
"main": "cjs/index.js",
|
31
|
+
"typings": "typings/index.d.ts",
|
33
32
|
"typescript": {
|
34
|
-
"definition": "index.d.ts"
|
33
|
+
"definition": "typings/index.d.ts"
|
35
34
|
},
|
36
35
|
"exports": {
|
37
36
|
"./package.json": "./package.json",
|
38
37
|
".": {
|
39
|
-
"require":
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"require": "./*.js",
|
44
|
-
"import": "./*.mjs"
|
38
|
+
"require": {
|
39
|
+
"types": "./typings/index.d.cts",
|
40
|
+
"default": "./cjs/index.js"
|
41
|
+
}
|
45
42
|
}
|
46
43
|
}
|
47
44
|
}
|
File without changes
|
@@ -0,0 +1,139 @@
|
|
1
|
+
export declare const configs: {
|
2
|
+
'schema-recommended': {
|
3
|
+
extends: string;
|
4
|
+
rules: {
|
5
|
+
'@graphql-eslint/description-style': string;
|
6
|
+
'@graphql-eslint/known-argument-names': string;
|
7
|
+
'@graphql-eslint/known-directives': string;
|
8
|
+
'@graphql-eslint/known-type-names': string;
|
9
|
+
'@graphql-eslint/lone-schema-definition': string;
|
10
|
+
'@graphql-eslint/naming-convention': (string | {
|
11
|
+
types: string;
|
12
|
+
FieldDefinition: string;
|
13
|
+
InputValueDefinition: string;
|
14
|
+
Argument: string;
|
15
|
+
DirectiveDefinition: string;
|
16
|
+
EnumValueDefinition: string;
|
17
|
+
'FieldDefinition[parent.name.value=Query]': {
|
18
|
+
forbiddenPrefixes: string[];
|
19
|
+
forbiddenSuffixes: string[];
|
20
|
+
};
|
21
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
22
|
+
forbiddenPrefixes: string[];
|
23
|
+
forbiddenSuffixes: string[];
|
24
|
+
};
|
25
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
26
|
+
forbiddenPrefixes: string[];
|
27
|
+
forbiddenSuffixes: string[];
|
28
|
+
};
|
29
|
+
})[];
|
30
|
+
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
31
|
+
'@graphql-eslint/no-hashtag-description': string;
|
32
|
+
'@graphql-eslint/no-typename-prefix': string;
|
33
|
+
'@graphql-eslint/no-unreachable-types': string;
|
34
|
+
'@graphql-eslint/provided-required-arguments': string;
|
35
|
+
'@graphql-eslint/require-deprecation-reason': string;
|
36
|
+
'@graphql-eslint/require-description': (string | {
|
37
|
+
types: boolean;
|
38
|
+
DirectiveDefinition: boolean;
|
39
|
+
})[];
|
40
|
+
'@graphql-eslint/strict-id-in-types': string;
|
41
|
+
'@graphql-eslint/unique-directive-names': string;
|
42
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
43
|
+
'@graphql-eslint/unique-field-definition-names': string;
|
44
|
+
'@graphql-eslint/unique-operation-types': string;
|
45
|
+
'@graphql-eslint/unique-type-names': string;
|
46
|
+
};
|
47
|
+
};
|
48
|
+
'schema-all': {
|
49
|
+
extends: string[];
|
50
|
+
rules: {
|
51
|
+
'@graphql-eslint/alphabetize': (string | {
|
52
|
+
fields: string[];
|
53
|
+
values: string[];
|
54
|
+
arguments: string[];
|
55
|
+
})[];
|
56
|
+
'@graphql-eslint/input-name': string;
|
57
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
58
|
+
'@graphql-eslint/require-deprecation-date': string;
|
59
|
+
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
'operations-recommended': {
|
63
|
+
extends: string;
|
64
|
+
rules: {
|
65
|
+
'@graphql-eslint/executable-definitions': string;
|
66
|
+
'@graphql-eslint/fields-on-correct-type': string;
|
67
|
+
'@graphql-eslint/fragments-on-composite-type': string;
|
68
|
+
'@graphql-eslint/known-argument-names': string;
|
69
|
+
'@graphql-eslint/known-directives': string;
|
70
|
+
'@graphql-eslint/known-fragment-names': string;
|
71
|
+
'@graphql-eslint/known-type-names': string;
|
72
|
+
'@graphql-eslint/lone-anonymous-operation': string;
|
73
|
+
'@graphql-eslint/naming-convention': (string | {
|
74
|
+
VariableDefinition: string;
|
75
|
+
OperationDefinition: {
|
76
|
+
style: string;
|
77
|
+
forbiddenPrefixes: string[];
|
78
|
+
forbiddenSuffixes: string[];
|
79
|
+
};
|
80
|
+
FragmentDefinition: {
|
81
|
+
style: string;
|
82
|
+
forbiddenPrefixes: string[];
|
83
|
+
forbiddenSuffixes: string[];
|
84
|
+
};
|
85
|
+
})[];
|
86
|
+
'@graphql-eslint/no-anonymous-operations': string;
|
87
|
+
'@graphql-eslint/no-deprecated': string;
|
88
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
89
|
+
'@graphql-eslint/no-fragment-cycles': string;
|
90
|
+
'@graphql-eslint/no-undefined-variables': string;
|
91
|
+
'@graphql-eslint/no-unused-fragments': string;
|
92
|
+
'@graphql-eslint/no-unused-variables': string;
|
93
|
+
'@graphql-eslint/one-field-subscriptions': string;
|
94
|
+
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
95
|
+
'@graphql-eslint/possible-fragment-spread': string;
|
96
|
+
'@graphql-eslint/provided-required-arguments': string;
|
97
|
+
'@graphql-eslint/require-id-when-available': string;
|
98
|
+
'@graphql-eslint/scalar-leafs': string;
|
99
|
+
'@graphql-eslint/selection-set-depth': (string | {
|
100
|
+
maxDepth: number;
|
101
|
+
})[];
|
102
|
+
'@graphql-eslint/unique-argument-names': string;
|
103
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
104
|
+
'@graphql-eslint/unique-input-field-names': string;
|
105
|
+
'@graphql-eslint/unique-variable-names': string;
|
106
|
+
'@graphql-eslint/value-literals-of-correct-type': string;
|
107
|
+
'@graphql-eslint/variables-are-input-types': string;
|
108
|
+
'@graphql-eslint/variables-in-allowed-position': string;
|
109
|
+
};
|
110
|
+
};
|
111
|
+
'operations-all': {
|
112
|
+
extends: string[];
|
113
|
+
rules: {
|
114
|
+
'@graphql-eslint/alphabetize': (string | {
|
115
|
+
selections: string[];
|
116
|
+
variables: string[];
|
117
|
+
arguments: string[];
|
118
|
+
})[];
|
119
|
+
'@graphql-eslint/lone-executable-definition': string;
|
120
|
+
'@graphql-eslint/match-document-filename': (string | {
|
121
|
+
query: string;
|
122
|
+
mutation: string;
|
123
|
+
subscription: string;
|
124
|
+
fragment: string;
|
125
|
+
})[];
|
126
|
+
'@graphql-eslint/unique-fragment-name': string;
|
127
|
+
'@graphql-eslint/unique-operation-name': string;
|
128
|
+
};
|
129
|
+
};
|
130
|
+
relay: {
|
131
|
+
extends: string;
|
132
|
+
rules: {
|
133
|
+
'@graphql-eslint/relay-arguments': string;
|
134
|
+
'@graphql-eslint/relay-connection-types': string;
|
135
|
+
'@graphql-eslint/relay-edge-types': string;
|
136
|
+
'@graphql-eslint/relay-page-info': string;
|
137
|
+
};
|
138
|
+
};
|
139
|
+
};
|
@@ -0,0 +1,139 @@
|
|
1
|
+
export declare const configs: {
|
2
|
+
'schema-recommended': {
|
3
|
+
extends: string;
|
4
|
+
rules: {
|
5
|
+
'@graphql-eslint/description-style': string;
|
6
|
+
'@graphql-eslint/known-argument-names': string;
|
7
|
+
'@graphql-eslint/known-directives': string;
|
8
|
+
'@graphql-eslint/known-type-names': string;
|
9
|
+
'@graphql-eslint/lone-schema-definition': string;
|
10
|
+
'@graphql-eslint/naming-convention': (string | {
|
11
|
+
types: string;
|
12
|
+
FieldDefinition: string;
|
13
|
+
InputValueDefinition: string;
|
14
|
+
Argument: string;
|
15
|
+
DirectiveDefinition: string;
|
16
|
+
EnumValueDefinition: string;
|
17
|
+
'FieldDefinition[parent.name.value=Query]': {
|
18
|
+
forbiddenPrefixes: string[];
|
19
|
+
forbiddenSuffixes: string[];
|
20
|
+
};
|
21
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
22
|
+
forbiddenPrefixes: string[];
|
23
|
+
forbiddenSuffixes: string[];
|
24
|
+
};
|
25
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
26
|
+
forbiddenPrefixes: string[];
|
27
|
+
forbiddenSuffixes: string[];
|
28
|
+
};
|
29
|
+
})[];
|
30
|
+
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
31
|
+
'@graphql-eslint/no-hashtag-description': string;
|
32
|
+
'@graphql-eslint/no-typename-prefix': string;
|
33
|
+
'@graphql-eslint/no-unreachable-types': string;
|
34
|
+
'@graphql-eslint/provided-required-arguments': string;
|
35
|
+
'@graphql-eslint/require-deprecation-reason': string;
|
36
|
+
'@graphql-eslint/require-description': (string | {
|
37
|
+
types: boolean;
|
38
|
+
DirectiveDefinition: boolean;
|
39
|
+
})[];
|
40
|
+
'@graphql-eslint/strict-id-in-types': string;
|
41
|
+
'@graphql-eslint/unique-directive-names': string;
|
42
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
43
|
+
'@graphql-eslint/unique-field-definition-names': string;
|
44
|
+
'@graphql-eslint/unique-operation-types': string;
|
45
|
+
'@graphql-eslint/unique-type-names': string;
|
46
|
+
};
|
47
|
+
};
|
48
|
+
'schema-all': {
|
49
|
+
extends: string[];
|
50
|
+
rules: {
|
51
|
+
'@graphql-eslint/alphabetize': (string | {
|
52
|
+
fields: string[];
|
53
|
+
values: string[];
|
54
|
+
arguments: string[];
|
55
|
+
})[];
|
56
|
+
'@graphql-eslint/input-name': string;
|
57
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
58
|
+
'@graphql-eslint/require-deprecation-date': string;
|
59
|
+
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
'operations-recommended': {
|
63
|
+
extends: string;
|
64
|
+
rules: {
|
65
|
+
'@graphql-eslint/executable-definitions': string;
|
66
|
+
'@graphql-eslint/fields-on-correct-type': string;
|
67
|
+
'@graphql-eslint/fragments-on-composite-type': string;
|
68
|
+
'@graphql-eslint/known-argument-names': string;
|
69
|
+
'@graphql-eslint/known-directives': string;
|
70
|
+
'@graphql-eslint/known-fragment-names': string;
|
71
|
+
'@graphql-eslint/known-type-names': string;
|
72
|
+
'@graphql-eslint/lone-anonymous-operation': string;
|
73
|
+
'@graphql-eslint/naming-convention': (string | {
|
74
|
+
VariableDefinition: string;
|
75
|
+
OperationDefinition: {
|
76
|
+
style: string;
|
77
|
+
forbiddenPrefixes: string[];
|
78
|
+
forbiddenSuffixes: string[];
|
79
|
+
};
|
80
|
+
FragmentDefinition: {
|
81
|
+
style: string;
|
82
|
+
forbiddenPrefixes: string[];
|
83
|
+
forbiddenSuffixes: string[];
|
84
|
+
};
|
85
|
+
})[];
|
86
|
+
'@graphql-eslint/no-anonymous-operations': string;
|
87
|
+
'@graphql-eslint/no-deprecated': string;
|
88
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
89
|
+
'@graphql-eslint/no-fragment-cycles': string;
|
90
|
+
'@graphql-eslint/no-undefined-variables': string;
|
91
|
+
'@graphql-eslint/no-unused-fragments': string;
|
92
|
+
'@graphql-eslint/no-unused-variables': string;
|
93
|
+
'@graphql-eslint/one-field-subscriptions': string;
|
94
|
+
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
95
|
+
'@graphql-eslint/possible-fragment-spread': string;
|
96
|
+
'@graphql-eslint/provided-required-arguments': string;
|
97
|
+
'@graphql-eslint/require-id-when-available': string;
|
98
|
+
'@graphql-eslint/scalar-leafs': string;
|
99
|
+
'@graphql-eslint/selection-set-depth': (string | {
|
100
|
+
maxDepth: number;
|
101
|
+
})[];
|
102
|
+
'@graphql-eslint/unique-argument-names': string;
|
103
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
104
|
+
'@graphql-eslint/unique-input-field-names': string;
|
105
|
+
'@graphql-eslint/unique-variable-names': string;
|
106
|
+
'@graphql-eslint/value-literals-of-correct-type': string;
|
107
|
+
'@graphql-eslint/variables-are-input-types': string;
|
108
|
+
'@graphql-eslint/variables-in-allowed-position': string;
|
109
|
+
};
|
110
|
+
};
|
111
|
+
'operations-all': {
|
112
|
+
extends: string[];
|
113
|
+
rules: {
|
114
|
+
'@graphql-eslint/alphabetize': (string | {
|
115
|
+
selections: string[];
|
116
|
+
variables: string[];
|
117
|
+
arguments: string[];
|
118
|
+
})[];
|
119
|
+
'@graphql-eslint/lone-executable-definition': string;
|
120
|
+
'@graphql-eslint/match-document-filename': (string | {
|
121
|
+
query: string;
|
122
|
+
mutation: string;
|
123
|
+
subscription: string;
|
124
|
+
fragment: string;
|
125
|
+
})[];
|
126
|
+
'@graphql-eslint/unique-fragment-name': string;
|
127
|
+
'@graphql-eslint/unique-operation-name': string;
|
128
|
+
};
|
129
|
+
};
|
130
|
+
relay: {
|
131
|
+
extends: string;
|
132
|
+
rules: {
|
133
|
+
'@graphql-eslint/relay-arguments': string;
|
134
|
+
'@graphql-eslint/relay-connection-types': string;
|
135
|
+
'@graphql-eslint/relay-edge-types': string;
|
136
|
+
'@graphql-eslint/relay-page-info': string;
|
137
|
+
};
|
138
|
+
};
|
139
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
extends: string[];
|
3
|
+
rules: {
|
4
|
+
'@graphql-eslint/alphabetize': (string | {
|
5
|
+
selections: string[];
|
6
|
+
variables: string[];
|
7
|
+
arguments: string[];
|
8
|
+
})[];
|
9
|
+
'@graphql-eslint/lone-executable-definition': string;
|
10
|
+
'@graphql-eslint/match-document-filename': (string | {
|
11
|
+
query: string;
|
12
|
+
mutation: string;
|
13
|
+
subscription: string;
|
14
|
+
fragment: string;
|
15
|
+
})[];
|
16
|
+
'@graphql-eslint/unique-fragment-name': string;
|
17
|
+
'@graphql-eslint/unique-operation-name': string;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
export default _default;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
extends: string[];
|
3
|
+
rules: {
|
4
|
+
'@graphql-eslint/alphabetize': (string | {
|
5
|
+
selections: string[];
|
6
|
+
variables: string[];
|
7
|
+
arguments: string[];
|
8
|
+
})[];
|
9
|
+
'@graphql-eslint/lone-executable-definition': string;
|
10
|
+
'@graphql-eslint/match-document-filename': (string | {
|
11
|
+
query: string;
|
12
|
+
mutation: string;
|
13
|
+
subscription: string;
|
14
|
+
fragment: string;
|
15
|
+
})[];
|
16
|
+
'@graphql-eslint/unique-fragment-name': string;
|
17
|
+
'@graphql-eslint/unique-operation-name': string;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
export default _default;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
extends: string;
|
3
|
+
rules: {
|
4
|
+
'@graphql-eslint/executable-definitions': string;
|
5
|
+
'@graphql-eslint/fields-on-correct-type': string;
|
6
|
+
'@graphql-eslint/fragments-on-composite-type': string;
|
7
|
+
'@graphql-eslint/known-argument-names': string;
|
8
|
+
'@graphql-eslint/known-directives': string;
|
9
|
+
'@graphql-eslint/known-fragment-names': string;
|
10
|
+
'@graphql-eslint/known-type-names': string;
|
11
|
+
'@graphql-eslint/lone-anonymous-operation': string;
|
12
|
+
'@graphql-eslint/naming-convention': (string | {
|
13
|
+
VariableDefinition: string;
|
14
|
+
OperationDefinition: {
|
15
|
+
style: string;
|
16
|
+
forbiddenPrefixes: string[];
|
17
|
+
forbiddenSuffixes: string[];
|
18
|
+
};
|
19
|
+
FragmentDefinition: {
|
20
|
+
style: string;
|
21
|
+
forbiddenPrefixes: string[];
|
22
|
+
forbiddenSuffixes: string[];
|
23
|
+
};
|
24
|
+
})[];
|
25
|
+
'@graphql-eslint/no-anonymous-operations': string;
|
26
|
+
'@graphql-eslint/no-deprecated': string;
|
27
|
+
'@graphql-eslint/no-duplicate-fields': string;
|
28
|
+
'@graphql-eslint/no-fragment-cycles': string;
|
29
|
+
'@graphql-eslint/no-undefined-variables': string;
|
30
|
+
'@graphql-eslint/no-unused-fragments': string;
|
31
|
+
'@graphql-eslint/no-unused-variables': string;
|
32
|
+
'@graphql-eslint/one-field-subscriptions': string;
|
33
|
+
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
34
|
+
'@graphql-eslint/possible-fragment-spread': string;
|
35
|
+
'@graphql-eslint/provided-required-arguments': string;
|
36
|
+
'@graphql-eslint/require-id-when-available': string;
|
37
|
+
'@graphql-eslint/scalar-leafs': string;
|
38
|
+
'@graphql-eslint/selection-set-depth': (string | {
|
39
|
+
maxDepth: number;
|
40
|
+
})[];
|
41
|
+
'@graphql-eslint/unique-argument-names': string;
|
42
|
+
'@graphql-eslint/unique-directive-names-per-location': string;
|
43
|
+
'@graphql-eslint/unique-input-field-names': string;
|
44
|
+
'@graphql-eslint/unique-variable-names': string;
|
45
|
+
'@graphql-eslint/value-literals-of-correct-type': string;
|
46
|
+
'@graphql-eslint/variables-are-input-types': string;
|
47
|
+
'@graphql-eslint/variables-in-allowed-position': string;
|
48
|
+
};
|
49
|
+
};
|
50
|
+
export default _default;
|