@graphql-eslint/eslint-plugin 3.0.1-alpha-86a9e78.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/index.d.ts +0 -4
- package/configs/schema-all.d.ts +0 -3
- package/configs/schema-recommended.d.ts +0 -1
- package/docs/README.md +59 -58
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +1 -2
- package/docs/rules/unique-enum-value-names.md +0 -2
- package/index.js +11 -22
- package/index.mjs +11 -22
- package/package.json +2 -2
package/configs/index.d.ts
CHANGED
@@ -44,7 +44,6 @@ export declare const configs: {
|
|
44
44
|
'@graphql-eslint/strict-id-in-types': string;
|
45
45
|
'@graphql-eslint/unique-directive-names': string;
|
46
46
|
'@graphql-eslint/unique-directive-names-per-location': string;
|
47
|
-
'@graphql-eslint/unique-enum-value-names': string;
|
48
47
|
'@graphql-eslint/unique-field-definition-names': string;
|
49
48
|
'@graphql-eslint/unique-operation-types': string;
|
50
49
|
'@graphql-eslint/unique-type-names': string;
|
@@ -59,10 +58,7 @@ export declare const configs: {
|
|
59
58
|
arguments: string[];
|
60
59
|
})[];
|
61
60
|
'@graphql-eslint/input-name': string;
|
62
|
-
'@graphql-eslint/no-root-type': string;
|
63
61
|
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
64
|
-
'@graphql-eslint/no-unused-fields': string;
|
65
|
-
'@graphql-eslint/possible-type-extension': string;
|
66
62
|
'@graphql-eslint/require-deprecation-date': string;
|
67
63
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
68
64
|
};
|
package/configs/schema-all.d.ts
CHANGED
@@ -7,10 +7,7 @@ declare const _default: {
|
|
7
7
|
arguments: string[];
|
8
8
|
})[];
|
9
9
|
'@graphql-eslint/input-name': string;
|
10
|
-
'@graphql-eslint/no-root-type': string;
|
11
10
|
'@graphql-eslint/no-scalar-result-type-on-mutation': string;
|
12
|
-
'@graphql-eslint/no-unused-fields': string;
|
13
|
-
'@graphql-eslint/possible-type-extension': string;
|
14
11
|
'@graphql-eslint/require-deprecation-date': string;
|
15
12
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': string;
|
16
13
|
};
|
@@ -39,7 +39,6 @@ declare const _default: {
|
|
39
39
|
'@graphql-eslint/strict-id-in-types': string;
|
40
40
|
'@graphql-eslint/unique-directive-names': string;
|
41
41
|
'@graphql-eslint/unique-directive-names-per-location': string;
|
42
|
-
'@graphql-eslint/unique-enum-value-names': string;
|
43
42
|
'@graphql-eslint/unique-field-definition-names': string;
|
44
43
|
'@graphql-eslint/unique-operation-types': string;
|
45
44
|
'@graphql-eslint/unique-type-names': string;
|
package/docs/README.md
CHANGED
@@ -5,65 +5,66 @@ Each rule has emojis denoting:
|
|
5
5
|
- 🚀 `graphql-eslint` rule
|
6
6
|
- 🔮 `graphql-js` rule
|
7
7
|
- 🔧 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
|
8
|
-
- ✅ if it belongs to the `recommended` configuration
|
9
8
|
|
10
9
|
<!-- 🚨 IMPORTANT! Do not manually modify this table. Run: `yarn generate:docs` -->
|
11
10
|
<!-- prettier-ignore-start -->
|
12
|
-
Name |Description
|
13
|
-
|
14
|
-
[alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more
|
15
|
-
[description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline)
|
16
|
-
[executable-definitions](rules/executable-definitions.md)|A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions
|
17
|
-
[fields-on-correct-type](rules/fields-on-correct-type.md)|A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as `__typename
|
18
|
-
[fragments-on-composite-type](rules/fragments-on-composite-type.md)|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
|
19
|
-
[input-name](rules/input-name.md)|Require mutation argument to be always called "input" and input type to be called Mutation name + "Input"
|
20
|
-
[known-argument-names](rules/known-argument-names.md)|A GraphQL field is only valid if all supplied arguments are defined by that field
|
21
|
-
[known-directives](rules/known-directives.md)|A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned
|
22
|
-
[known-fragment-names](rules/known-fragment-names.md)|A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document
|
23
|
-
[known-type-names](rules/known-type-names.md)|A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema
|
24
|
-
[lone-anonymous-operation](rules/lone-anonymous-operation.md)|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
|
25
|
-
[lone-schema-definition](rules/lone-schema-definition.md)|A GraphQL document is only valid if it contains only one schema definition
|
26
|
-
[match-document-filename](rules/match-document-filename.md)|This rule allows you to enforce that the file name should match the operation name
|
27
|
-
[naming-convention](rules/naming-convention.md)|Require names to follow specified conventions
|
28
|
-
[no-anonymous-operations](rules/no-anonymous-operations.md)|Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes
|
29
|
-
[no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md)|Disallow case-insensitive enum values duplicates
|
30
|
-
[no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations
|
31
|
-
[no-duplicate-fields](rules/no-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field
|
32
|
-
[no-fragment-cycles](rules/no-fragment-cycles.md)|A GraphQL fragment is only valid when it does not have cycles in fragments usage
|
33
|
-
[no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of
|
34
|
-
[no-root-type](rules/no-root-type.md)|Disallow using root types `mutation` and/or `subscription
|
35
|
-
[no-scalar-result-type-on-mutation](rules/no-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state
|
36
|
-
[no-typename-prefix](rules/no-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema
|
37
|
-
[no-undefined-variables](rules/no-undefined-variables.md)|A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation
|
38
|
-
[no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields
|
39
|
-
[no-unused-fields](rules/no-unused-fields.md)|Requires all fields to be used at some level by siblings operations
|
40
|
-
[no-unused-fragments](rules/no-unused-fragments.md)|A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations
|
41
|
-
[no-unused-variables](rules/no-unused-variables.md)|A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment
|
42
|
-
[one-field-subscriptions](rules/one-field-subscriptions.md)|A GraphQL subscription is valid only if it contains a single root field
|
43
|
-
[overlapping-fields-can-be-merged](rules/overlapping-fields-can-be-merged.md)|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
|
44
|
-
[possible-fragment-spread](rules/possible-fragment-spread.md)|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
|
45
|
-
[possible-type-extension](rules/possible-type-extension.md)|A type extension is only valid if the type is defined and has the same kind
|
46
|
-
[provided-required-arguments](rules/provided-required-arguments.md)|A field or directive is only valid if all required (non-null without a default value) field arguments have been provided
|
47
|
-
[require-deprecation-date](rules/require-deprecation-date.md)|Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date
|
48
|
-
[require-deprecation-reason](rules/require-deprecation-reason.md)|Require all deprecation directives to specify a reason
|
49
|
-
[require-description](rules/require-description.md)|Enforce descriptions in your type definitions
|
50
|
-
[require-field-of-type-query-in-mutation-result](rules/require-field-of-type-query-in-mutation-result.md)|Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application
|
51
|
-
[require-id-when-available](rules/require-id-when-available.md)|Enforce selecting specific fields when they are available on the GraphQL type
|
52
|
-
[scalar-leafs](rules/scalar-leafs.md)|A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types
|
53
|
-
[selection-set-depth](rules/selection-set-depth.md)|Limit the complexity of the GraphQL operations solely by their depth. Based on [graphql-depth-limit](https://github.com/stems/graphql-depth-limit)
|
54
|
-
[strict-id-in-types](rules/strict-id-in-types.md)|Requires output types to have one unique identifier unless they do not have a logical one. Exceptions can be used to ignore output types that do not have unique identifiers
|
55
|
-
[unique-argument-names](rules/unique-argument-names.md)|A GraphQL field or directive is only valid if all supplied arguments are uniquely named
|
56
|
-
[unique-directive-names](rules/unique-directive-names.md)|A GraphQL document is only valid if all defined directives have unique names
|
57
|
-
[unique-directive-names-per-location](rules/unique-directive-names-per-location.md)|A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named
|
58
|
-
[unique-enum-value-names](rules/unique-enum-value-names.md)|A GraphQL enum type is only valid if all its values are uniquely named
|
59
|
-
[unique-field-definition-names](rules/unique-field-definition-names.md)|A GraphQL complex type is only valid if all its fields are uniquely named
|
60
|
-
[unique-fragment-name](rules/unique-fragment-name.md)|Enforce unique fragment names across your project
|
61
|
-
[unique-input-field-names](rules/unique-input-field-names.md)|A GraphQL input object value is only valid if all supplied fields are uniquely named
|
62
|
-
[unique-operation-name](rules/unique-operation-name.md)|Enforce unique operation names across your project
|
63
|
-
[unique-operation-types](rules/unique-operation-types.md)|A GraphQL document is only valid if it has only one type per operation
|
64
|
-
[unique-type-names](rules/unique-type-names.md)|A GraphQL document is only valid if all defined types have unique names
|
65
|
-
[unique-variable-names](rules/unique-variable-names.md)|A GraphQL operation is only valid if all its variables are uniquely named
|
66
|
-
[value-literals-of-correct-type](rules/value-literals-of-correct-type.md)|A GraphQL document is only valid if all value literals are of the type expected at their position
|
67
|
-
[variables-are-input-types](rules/variables-are-input-types.md)|A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object)
|
68
|
-
[variables-in-allowed-position](rules/variables-in-allowed-position.md)|Variables passed to field arguments conform to type
|
11
|
+
Name |Description| Config |🚀 / 🔮|🔧
|
12
|
+
-|-|:-:|:-:|-
|
13
|
+
[alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.|![all][]|🚀|
|
14
|
+
[description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline).|![recommended][]|🚀|
|
15
|
+
[executable-definitions](rules/executable-definitions.md)|A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.|![recommended][]|🔮|
|
16
|
+
[fields-on-correct-type](rules/fields-on-correct-type.md)|A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as `__typename`.|![recommended][]|🔮|
|
17
|
+
[fragments-on-composite-type](rules/fragments-on-composite-type.md)|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.|![recommended][]|🔮|
|
18
|
+
[input-name](rules/input-name.md)|Require mutation argument to be always called "input" and input type to be called Mutation name + "Input".|![all][]|🚀|
|
19
|
+
[known-argument-names](rules/known-argument-names.md)|A GraphQL field is only valid if all supplied arguments are defined by that field.|![recommended][]|🔮|
|
20
|
+
[known-directives](rules/known-directives.md)|A GraphQL document is only valid if all `@directives` are known by the schema and legally positioned.|![recommended][]|🔮|
|
21
|
+
[known-fragment-names](rules/known-fragment-names.md)|A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document.|![recommended][]|🔮|
|
22
|
+
[known-type-names](rules/known-type-names.md)|A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.|![recommended][]|🔮|
|
23
|
+
[lone-anonymous-operation](rules/lone-anonymous-operation.md)|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.|![recommended][]|🔮|
|
24
|
+
[lone-schema-definition](rules/lone-schema-definition.md)|A GraphQL document is only valid if it contains only one schema definition.|![recommended][]|🔮|
|
25
|
+
[match-document-filename](rules/match-document-filename.md)|This rule allows you to enforce that the file name should match the operation name.|![all][]|🚀|
|
26
|
+
[naming-convention](rules/naming-convention.md)|Require names to follow specified conventions.|![recommended][]|🚀|
|
27
|
+
[no-anonymous-operations](rules/no-anonymous-operations.md)|Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.|![recommended][]|🚀|
|
28
|
+
[no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md)|Disallow case-insensitive enum values duplicates.|![recommended][]|🚀|
|
29
|
+
[no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations.|![recommended][]|🚀|
|
30
|
+
[no-duplicate-fields](rules/no-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|![recommended][]|🚀|
|
31
|
+
[no-fragment-cycles](rules/no-fragment-cycles.md)|A GraphQL fragment is only valid when it does not have cycles in fragments usage.|![recommended][]|🔮|
|
32
|
+
[no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.|![recommended][]|🚀|
|
33
|
+
[no-root-type](rules/no-root-type.md)|Disallow using root types `mutation` and/or `subscription`.||🚀|
|
34
|
+
[no-scalar-result-type-on-mutation](rules/no-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|![all][]|🚀|
|
35
|
+
[no-typename-prefix](rules/no-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|![recommended][]|🚀|
|
36
|
+
[no-undefined-variables](rules/no-undefined-variables.md)|A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.|![recommended][]|🔮|
|
37
|
+
[no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields.|![recommended][]|🚀|🔧
|
38
|
+
[no-unused-fields](rules/no-unused-fields.md)|Requires all fields to be used at some level by siblings operations.||🚀|🔧
|
39
|
+
[no-unused-fragments](rules/no-unused-fragments.md)|A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.|![recommended][]|🔮|
|
40
|
+
[no-unused-variables](rules/no-unused-variables.md)|A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.|![recommended][]|🔮|
|
41
|
+
[one-field-subscriptions](rules/one-field-subscriptions.md)|A GraphQL subscription is valid only if it contains a single root field.|![recommended][]|🔮|
|
42
|
+
[overlapping-fields-can-be-merged](rules/overlapping-fields-can-be-merged.md)|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.|![recommended][]|🔮|
|
43
|
+
[possible-fragment-spread](rules/possible-fragment-spread.md)|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.|![recommended][]|🔮|
|
44
|
+
[possible-type-extension](rules/possible-type-extension.md)|A type extension is only valid if the type is defined and has the same kind.||🔮|
|
45
|
+
[provided-required-arguments](rules/provided-required-arguments.md)|A field or directive is only valid if all required (non-null without a default value) field arguments have been provided.|![recommended][]|🔮|
|
46
|
+
[require-deprecation-date](rules/require-deprecation-date.md)|Require deletion date on `@deprecated` directive. Suggest removing deprecated things after deprecated date.|![all][]|🚀|
|
47
|
+
[require-deprecation-reason](rules/require-deprecation-reason.md)|Require all deprecation directives to specify a reason.|![recommended][]|🚀|
|
48
|
+
[require-description](rules/require-description.md)|Enforce descriptions in your type definitions.|![recommended][]|🚀|
|
49
|
+
[require-field-of-type-query-in-mutation-result](rules/require-field-of-type-query-in-mutation-result.md)|Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.|![all][]|🚀|
|
50
|
+
[require-id-when-available](rules/require-id-when-available.md)|Enforce selecting specific fields when they are available on the GraphQL type.|![recommended][]|🚀|
|
51
|
+
[scalar-leafs](rules/scalar-leafs.md)|A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.|![recommended][]|🔮|
|
52
|
+
[selection-set-depth](rules/selection-set-depth.md)|Limit the complexity of the GraphQL operations solely by their depth. Based on [graphql-depth-limit](https://github.com/stems/graphql-depth-limit).|![recommended][]|🚀|
|
53
|
+
[strict-id-in-types](rules/strict-id-in-types.md)|Requires output types to have one unique identifier unless they do not have a logical one. Exceptions can be used to ignore output types that do not have unique identifiers.|![recommended][]|🚀|
|
54
|
+
[unique-argument-names](rules/unique-argument-names.md)|A GraphQL field or directive is only valid if all supplied arguments are uniquely named.|![recommended][]|🔮|
|
55
|
+
[unique-directive-names](rules/unique-directive-names.md)|A GraphQL document is only valid if all defined directives have unique names.|![recommended][]|🔮|
|
56
|
+
[unique-directive-names-per-location](rules/unique-directive-names-per-location.md)|A GraphQL document is only valid if all non-repeatable directives at a given location are uniquely named.|![recommended][]|🔮|
|
57
|
+
[unique-enum-value-names](rules/unique-enum-value-names.md)|A GraphQL enum type is only valid if all its values are uniquely named.||🔮|
|
58
|
+
[unique-field-definition-names](rules/unique-field-definition-names.md)|A GraphQL complex type is only valid if all its fields are uniquely named.|![recommended][]|🔮|
|
59
|
+
[unique-fragment-name](rules/unique-fragment-name.md)|Enforce unique fragment names across your project.|![all][]|🚀|
|
60
|
+
[unique-input-field-names](rules/unique-input-field-names.md)|A GraphQL input object value is only valid if all supplied fields are uniquely named.|![recommended][]|🔮|
|
61
|
+
[unique-operation-name](rules/unique-operation-name.md)|Enforce unique operation names across your project.|![all][]|🚀|
|
62
|
+
[unique-operation-types](rules/unique-operation-types.md)|A GraphQL document is only valid if it has only one type per operation.|![recommended][]|🔮|
|
63
|
+
[unique-type-names](rules/unique-type-names.md)|A GraphQL document is only valid if all defined types have unique names.|![recommended][]|🔮|
|
64
|
+
[unique-variable-names](rules/unique-variable-names.md)|A GraphQL operation is only valid if all its variables are uniquely named.|![recommended][]|🔮|
|
65
|
+
[value-literals-of-correct-type](rules/value-literals-of-correct-type.md)|A GraphQL document is only valid if all value literals are of the type expected at their position.|![recommended][]|🔮|
|
66
|
+
[variables-are-input-types](rules/variables-are-input-types.md)|A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).|![recommended][]|🔮|
|
67
|
+
[variables-in-allowed-position](rules/variables-in-allowed-position.md)|Variables passed to field arguments conform to type.|![recommended][]|🔮|
|
69
68
|
<!-- prettier-ignore-end -->
|
69
|
+
[recommended]: https://img.shields.io/badge/-recommended-green.svg
|
70
|
+
[all]: https://img.shields.io/badge/-all-blue.svg
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
|
4
4
|
|
5
|
-
🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
|
6
|
-
|
7
5
|
- Category: `Schema`
|
8
6
|
- Rule name: `@graphql-eslint/no-case-insensitive-enum-values-duplicates`
|
9
7
|
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
@@ -40,3 +38,4 @@ enum MyEnum {
|
|
40
38
|
## Resources
|
41
39
|
|
42
40
|
- [Rule source](../../packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts)
|
41
|
+
- [Test source](../../packages/plugin/tests/no-case-insensitive-enum-values-duplicates.spec.ts)
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# `unique-enum-value-names`
|
2
2
|
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/schema-recommended"` property in a configuration file enables this rule.
|
4
|
-
|
5
3
|
- Category: `Schema`
|
6
4
|
- Rule name: `@graphql-eslint/unique-enum-value-names`
|
7
5
|
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
package/index.js
CHANGED
@@ -67,7 +67,6 @@ const schemaRecommendedConfig = {
|
|
67
67
|
'@graphql-eslint/strict-id-in-types': 'error',
|
68
68
|
'@graphql-eslint/unique-directive-names': 'error',
|
69
69
|
'@graphql-eslint/unique-directive-names-per-location': 'error',
|
70
|
-
'@graphql-eslint/unique-enum-value-names': 'error',
|
71
70
|
'@graphql-eslint/unique-field-definition-names': 'error',
|
72
71
|
'@graphql-eslint/unique-operation-types': 'error',
|
73
72
|
'@graphql-eslint/unique-type-names': 'error',
|
@@ -89,10 +88,7 @@ const schemaAllConfig = {
|
|
89
88
|
},
|
90
89
|
],
|
91
90
|
'@graphql-eslint/input-name': 'error',
|
92
|
-
'@graphql-eslint/no-root-type': 'off',
|
93
91
|
'@graphql-eslint/no-scalar-result-type-on-mutation': 'error',
|
94
|
-
'@graphql-eslint/no-unused-fields': 'off',
|
95
|
-
'@graphql-eslint/possible-type-extension': 'off',
|
96
92
|
'@graphql-eslint/require-deprecation-date': 'error',
|
97
93
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': 'error',
|
98
94
|
},
|
@@ -589,6 +585,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
589
585
|
category: 'Schema',
|
590
586
|
description: `A GraphQL enum type is only valid if all its values are uniquely named.`,
|
591
587
|
requiresSchema: false,
|
588
|
+
recommended: false,
|
592
589
|
}), validationToRule('unique-field-definition-names', 'UniqueFieldDefinitionNames', {
|
593
590
|
category: 'Schema',
|
594
591
|
description: `A GraphQL complex type is only valid if all its fields are uniquely named.`,
|
@@ -1575,12 +1572,11 @@ const rule$5 = {
|
|
1575
1572
|
},
|
1576
1573
|
};
|
1577
1574
|
|
1578
|
-
const ERROR_MESSAGE_ID = 'NO_CASE_INSENSITIVE_ENUM_VALUES_DUPLICATES';
|
1579
1575
|
const rule$6 = {
|
1580
1576
|
meta: {
|
1581
1577
|
type: 'suggestion',
|
1582
1578
|
docs: {
|
1583
|
-
url:
|
1579
|
+
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-case-insensitive-enum-values-duplicates.md`,
|
1584
1580
|
category: 'Schema',
|
1585
1581
|
recommended: true,
|
1586
1582
|
description: 'Disallow case-insensitive enum values duplicates.',
|
@@ -1607,23 +1603,18 @@ const rule$6 = {
|
|
1607
1603
|
},
|
1608
1604
|
],
|
1609
1605
|
},
|
1610
|
-
fixable: 'code',
|
1611
|
-
messages: {
|
1612
|
-
[ERROR_MESSAGE_ID]: `Case-insensitive enum values duplicates are not allowed! Found: "{{ found }}"`,
|
1613
|
-
},
|
1614
1606
|
schema: [],
|
1615
1607
|
},
|
1616
1608
|
create(context) {
|
1609
|
+
const selector = [graphql.Kind.ENUM_TYPE_DEFINITION, graphql.Kind.ENUM_TYPE_EXTENSION].join(',');
|
1617
1610
|
return {
|
1618
|
-
|
1619
|
-
const
|
1620
|
-
for (const
|
1611
|
+
[selector](node) {
|
1612
|
+
const duplicates = node.values.filter((item, index, array) => array.findIndex(v => v.name.value.toLowerCase() === item.name.value.toLowerCase()) !== index);
|
1613
|
+
for (const duplicate of duplicates) {
|
1614
|
+
const enumName = duplicate.name.value;
|
1621
1615
|
context.report({
|
1622
|
-
|
1623
|
-
|
1624
|
-
found: dup.name.value,
|
1625
|
-
},
|
1626
|
-
messageId: ERROR_MESSAGE_ID,
|
1616
|
+
loc: getLocation(duplicate.loc, enumName),
|
1617
|
+
message: `Case-insensitive enum values duplicates are not allowed! Found: "${enumName}"`,
|
1627
1618
|
});
|
1628
1619
|
}
|
1629
1620
|
},
|
@@ -2041,13 +2032,11 @@ const rule$b = {
|
|
2041
2032
|
}
|
2042
2033
|
const selector = [
|
2043
2034
|
`:matches(${graphql.Kind.OBJECT_TYPE_DEFINITION}, ${graphql.Kind.OBJECT_TYPE_EXTENSION})[name.value=${mutationType.name}]`,
|
2044
|
-
|
2045
|
-
graphql.Kind.FIELD_DEFINITION,
|
2046
|
-
graphql.Kind.NAMED_TYPE,
|
2035
|
+
`> ${graphql.Kind.FIELD_DEFINITION} > .gqlType ${graphql.Kind.NAME}`,
|
2047
2036
|
].join(' ');
|
2048
2037
|
return {
|
2049
2038
|
[selector](node) {
|
2050
|
-
const typeName = node.
|
2039
|
+
const typeName = node.value;
|
2051
2040
|
const graphQLType = schema.getType(typeName);
|
2052
2041
|
if (graphql.isScalarType(graphQLType)) {
|
2053
2042
|
context.report({
|
package/index.mjs
CHANGED
@@ -61,7 +61,6 @@ const schemaRecommendedConfig = {
|
|
61
61
|
'@graphql-eslint/strict-id-in-types': 'error',
|
62
62
|
'@graphql-eslint/unique-directive-names': 'error',
|
63
63
|
'@graphql-eslint/unique-directive-names-per-location': 'error',
|
64
|
-
'@graphql-eslint/unique-enum-value-names': 'error',
|
65
64
|
'@graphql-eslint/unique-field-definition-names': 'error',
|
66
65
|
'@graphql-eslint/unique-operation-types': 'error',
|
67
66
|
'@graphql-eslint/unique-type-names': 'error',
|
@@ -83,10 +82,7 @@ const schemaAllConfig = {
|
|
83
82
|
},
|
84
83
|
],
|
85
84
|
'@graphql-eslint/input-name': 'error',
|
86
|
-
'@graphql-eslint/no-root-type': 'off',
|
87
85
|
'@graphql-eslint/no-scalar-result-type-on-mutation': 'error',
|
88
|
-
'@graphql-eslint/no-unused-fields': 'off',
|
89
|
-
'@graphql-eslint/possible-type-extension': 'off',
|
90
86
|
'@graphql-eslint/require-deprecation-date': 'error',
|
91
87
|
'@graphql-eslint/require-field-of-type-query-in-mutation-result': 'error',
|
92
88
|
},
|
@@ -583,6 +579,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
583
579
|
category: 'Schema',
|
584
580
|
description: `A GraphQL enum type is only valid if all its values are uniquely named.`,
|
585
581
|
requiresSchema: false,
|
582
|
+
recommended: false,
|
586
583
|
}), validationToRule('unique-field-definition-names', 'UniqueFieldDefinitionNames', {
|
587
584
|
category: 'Schema',
|
588
585
|
description: `A GraphQL complex type is only valid if all its fields are uniquely named.`,
|
@@ -1569,12 +1566,11 @@ const rule$5 = {
|
|
1569
1566
|
},
|
1570
1567
|
};
|
1571
1568
|
|
1572
|
-
const ERROR_MESSAGE_ID = 'NO_CASE_INSENSITIVE_ENUM_VALUES_DUPLICATES';
|
1573
1569
|
const rule$6 = {
|
1574
1570
|
meta: {
|
1575
1571
|
type: 'suggestion',
|
1576
1572
|
docs: {
|
1577
|
-
url:
|
1573
|
+
url: `https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/no-case-insensitive-enum-values-duplicates.md`,
|
1578
1574
|
category: 'Schema',
|
1579
1575
|
recommended: true,
|
1580
1576
|
description: 'Disallow case-insensitive enum values duplicates.',
|
@@ -1601,23 +1597,18 @@ const rule$6 = {
|
|
1601
1597
|
},
|
1602
1598
|
],
|
1603
1599
|
},
|
1604
|
-
fixable: 'code',
|
1605
|
-
messages: {
|
1606
|
-
[ERROR_MESSAGE_ID]: `Case-insensitive enum values duplicates are not allowed! Found: "{{ found }}"`,
|
1607
|
-
},
|
1608
1600
|
schema: [],
|
1609
1601
|
},
|
1610
1602
|
create(context) {
|
1603
|
+
const selector = [Kind.ENUM_TYPE_DEFINITION, Kind.ENUM_TYPE_EXTENSION].join(',');
|
1611
1604
|
return {
|
1612
|
-
|
1613
|
-
const
|
1614
|
-
for (const
|
1605
|
+
[selector](node) {
|
1606
|
+
const duplicates = node.values.filter((item, index, array) => array.findIndex(v => v.name.value.toLowerCase() === item.name.value.toLowerCase()) !== index);
|
1607
|
+
for (const duplicate of duplicates) {
|
1608
|
+
const enumName = duplicate.name.value;
|
1615
1609
|
context.report({
|
1616
|
-
|
1617
|
-
|
1618
|
-
found: dup.name.value,
|
1619
|
-
},
|
1620
|
-
messageId: ERROR_MESSAGE_ID,
|
1610
|
+
loc: getLocation(duplicate.loc, enumName),
|
1611
|
+
message: `Case-insensitive enum values duplicates are not allowed! Found: "${enumName}"`,
|
1621
1612
|
});
|
1622
1613
|
}
|
1623
1614
|
},
|
@@ -2035,13 +2026,11 @@ const rule$b = {
|
|
2035
2026
|
}
|
2036
2027
|
const selector = [
|
2037
2028
|
`:matches(${Kind.OBJECT_TYPE_DEFINITION}, ${Kind.OBJECT_TYPE_EXTENSION})[name.value=${mutationType.name}]`,
|
2038
|
-
|
2039
|
-
Kind.FIELD_DEFINITION,
|
2040
|
-
Kind.NAMED_TYPE,
|
2029
|
+
`> ${Kind.FIELD_DEFINITION} > .gqlType ${Kind.NAME}`,
|
2041
2030
|
].join(' ');
|
2042
2031
|
return {
|
2043
2032
|
[selector](node) {
|
2044
|
-
const typeName = node.
|
2033
|
+
const typeName = node.value;
|
2045
2034
|
const graphQLType = schema.getType(typeName);
|
2046
2035
|
if (isScalarType(graphQLType)) {
|
2047
2036
|
context.report({
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "3.0.1
|
3
|
+
"version": "3.0.1",
|
4
4
|
"sideEffects": false,
|
5
5
|
"peerDependencies": {
|
6
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"dependencies": {
|
9
9
|
"@babel/code-frame": "7.16.0",
|
10
10
|
"@graphql-tools/code-file-loader": "7.2.2",
|
11
|
-
"@graphql-tools/graphql-tag-pluck": "7.1.
|
11
|
+
"@graphql-tools/graphql-tag-pluck": "7.1.4",
|
12
12
|
"@graphql-tools/import": "6.6.1",
|
13
13
|
"@graphql-tools/utils": "8.5.3",
|
14
14
|
"graphql-config": "4.1.0",
|