@graphql-eslint/eslint-plugin 3.0.0-alpha-580615a.0 → 3.0.0-alpha-7462f3d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/configs/all.d.ts CHANGED
@@ -7,17 +7,16 @@ export declare const allConfig: {
7
7
  variables: string[];
8
8
  arguments: string[];
9
9
  })[];
10
- '@graphql-eslint/avoid-duplicate-fields': string;
11
- '@graphql-eslint/avoid-operation-name-prefix': string;
12
- '@graphql-eslint/avoid-scalar-result-type-on-mutation': string;
13
10
  '@graphql-eslint/description-style': string;
14
11
  '@graphql-eslint/input-name': string;
15
12
  '@graphql-eslint/match-document-filename': string;
16
13
  '@graphql-eslint/no-deprecated': string;
14
+ '@graphql-eslint/no-duplicate-fields': string;
17
15
  '@graphql-eslint/no-hashtag-description': string;
18
16
  '@graphql-eslint/no-root-type': (string | {
19
17
  disallow: string[];
20
18
  })[];
19
+ '@graphql-eslint/no-scalar-result-type-on-mutation': string;
21
20
  '@graphql-eslint/no-unreachable-types': string;
22
21
  '@graphql-eslint/no-unused-fields': string;
23
22
  '@graphql-eslint/require-deprecation-date': string;
@@ -32,7 +31,6 @@ export declare const allConfig: {
32
31
  '@graphql-eslint/selection-set-depth': string;
33
32
  '@graphql-eslint/unique-fragment-name': string;
34
33
  '@graphql-eslint/unique-operation-name': string;
35
- '@graphql-eslint/avoid-typename-prefix': string;
36
34
  '@graphql-eslint/executable-definitions': string;
37
35
  '@graphql-eslint/fields-on-correct-type': string;
38
36
  '@graphql-eslint/fragments-on-composite-type': string;
@@ -74,7 +72,7 @@ export declare const allConfig: {
74
72
  '@graphql-eslint/no-anonymous-operations': string;
75
73
  '@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
76
74
  '@graphql-eslint/no-fragment-cycles': string;
77
- '@graphql-eslint/no-operation-name-suffix': string;
75
+ '@graphql-eslint/no-typename-prefix': string;
78
76
  '@graphql-eslint/no-undefined-variables': string;
79
77
  '@graphql-eslint/no-unused-fragments': string;
80
78
  '@graphql-eslint/no-unused-variables': string;
@@ -8,17 +8,16 @@ export declare const configs: {
8
8
  variables: string[];
9
9
  arguments: string[];
10
10
  })[];
11
- '@graphql-eslint/avoid-duplicate-fields': string;
12
- '@graphql-eslint/avoid-operation-name-prefix': string;
13
- '@graphql-eslint/avoid-scalar-result-type-on-mutation': string;
14
11
  '@graphql-eslint/description-style': string;
15
12
  '@graphql-eslint/input-name': string;
16
13
  '@graphql-eslint/match-document-filename': string;
17
14
  '@graphql-eslint/no-deprecated': string;
15
+ '@graphql-eslint/no-duplicate-fields': string;
18
16
  '@graphql-eslint/no-hashtag-description': string;
19
17
  '@graphql-eslint/no-root-type': (string | {
20
18
  disallow: string[];
21
19
  })[];
20
+ '@graphql-eslint/no-scalar-result-type-on-mutation': string;
22
21
  '@graphql-eslint/no-unreachable-types': string;
23
22
  '@graphql-eslint/no-unused-fields': string;
24
23
  '@graphql-eslint/require-deprecation-date': string;
@@ -33,7 +32,6 @@ export declare const configs: {
33
32
  '@graphql-eslint/selection-set-depth': string;
34
33
  '@graphql-eslint/unique-fragment-name': string;
35
34
  '@graphql-eslint/unique-operation-name': string;
36
- '@graphql-eslint/avoid-typename-prefix': string;
37
35
  '@graphql-eslint/executable-definitions': string;
38
36
  '@graphql-eslint/fields-on-correct-type': string;
39
37
  '@graphql-eslint/fragments-on-composite-type': string;
@@ -75,7 +73,7 @@ export declare const configs: {
75
73
  '@graphql-eslint/no-anonymous-operations': string;
76
74
  '@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
77
75
  '@graphql-eslint/no-fragment-cycles': string;
78
- '@graphql-eslint/no-operation-name-suffix': string;
76
+ '@graphql-eslint/no-typename-prefix': string;
79
77
  '@graphql-eslint/no-undefined-variables': string;
80
78
  '@graphql-eslint/no-unused-fragments': string;
81
79
  '@graphql-eslint/no-unused-variables': string;
@@ -107,7 +105,6 @@ export declare const configs: {
107
105
  parser: string;
108
106
  plugins: string[];
109
107
  rules: {
110
- '@graphql-eslint/avoid-typename-prefix': string;
111
108
  '@graphql-eslint/executable-definitions': string;
112
109
  '@graphql-eslint/fields-on-correct-type': string;
113
110
  '@graphql-eslint/fragments-on-composite-type': string;
@@ -149,7 +146,7 @@ export declare const configs: {
149
146
  '@graphql-eslint/no-anonymous-operations': string;
150
147
  '@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
151
148
  '@graphql-eslint/no-fragment-cycles': string;
152
- '@graphql-eslint/no-operation-name-suffix': string;
149
+ '@graphql-eslint/no-typename-prefix': string;
153
150
  '@graphql-eslint/no-undefined-variables': string;
154
151
  '@graphql-eslint/no-unused-fragments': string;
155
152
  '@graphql-eslint/no-unused-variables': string;
@@ -2,7 +2,6 @@ export declare const recommendedConfig: {
2
2
  parser: string;
3
3
  plugins: string[];
4
4
  rules: {
5
- '@graphql-eslint/avoid-typename-prefix': string;
6
5
  '@graphql-eslint/executable-definitions': string;
7
6
  '@graphql-eslint/fields-on-correct-type': string;
8
7
  '@graphql-eslint/fragments-on-composite-type': string;
@@ -44,7 +43,7 @@ export declare const recommendedConfig: {
44
43
  '@graphql-eslint/no-anonymous-operations': string;
45
44
  '@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
46
45
  '@graphql-eslint/no-fragment-cycles': string;
47
- '@graphql-eslint/no-operation-name-suffix': string;
46
+ '@graphql-eslint/no-typename-prefix': string;
48
47
  '@graphql-eslint/no-undefined-variables': string;
49
48
  '@graphql-eslint/no-unused-fragments': string;
50
49
  '@graphql-eslint/no-unused-variables': string;
package/docs/README.md CHANGED
@@ -12,10 +12,6 @@ Each rule has emojis denoting:
12
12
  Name                    |Description|🚀 / 🔮|🔧|✅
13
13
  -|-|:-:|-|-
14
14
  [alphabetize](rules/alphabetize.md)|Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.|🚀||
15
- [avoid-duplicate-fields](rules/avoid-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|🚀||
16
- [avoid-operation-name-prefix](rules/avoid-operation-name-prefix.md)|Enforce/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema.|🚀||
17
- [avoid-scalar-result-type-on-mutation](rules/avoid-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|🚀||
18
- [avoid-typename-prefix](rules/avoid-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|🚀||✅
19
15
  [description-style](rules/description-style.md)|Require all comments to follow the same style (either block or inline).|🚀||
20
16
  [executable-definitions](rules/executable-definitions.md)|A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.|🔮||✅
21
17
  [fields-on-correct-type](rules/fields-on-correct-type.md)|A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as `__typename`.|🔮||✅
@@ -32,10 +28,12 @@ Name            &nbs
32
28
  [no-anonymous-operations](rules/no-anonymous-operations.md)|Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.|🚀||✅
33
29
  [no-case-insensitive-enum-values-duplicates](rules/no-case-insensitive-enum-values-duplicates.md)|Disallow case-insensitive enum values duplicates.|🚀|🔧|✅
34
30
  [no-deprecated](rules/no-deprecated.md)|Enforce that deprecated fields or enum values are not in use by operations.|🚀||
31
+ [no-duplicate-fields](rules/no-duplicate-fields.md)|Checks for duplicate fields in selection set, variables in operation definition, or in arguments set of a field.|🚀||
35
32
  [no-fragment-cycles](rules/no-fragment-cycles.md)|A GraphQL fragment is only valid when it does not have cycles in fragments usage.|🔮||✅
36
33
  [no-hashtag-description](rules/no-hashtag-description.md)|Requires to use `"""` or `"` for adding a GraphQL description instead of `#`.|🚀||
37
- [no-operation-name-suffix](rules/no-operation-name-suffix.md)|Makes sure you are not adding the operation type to the name of the operation.|🚀|🔧|✅
38
34
  [no-root-type](rules/no-root-type.md)|Disallow using root types for `read-only` or `write-only` schemas.|🚀||
35
+ [no-scalar-result-type-on-mutation](rules/no-scalar-result-type-on-mutation.md)|Avoid scalar result type on mutation type to make sure to return a valid state.|🚀||
36
+ [no-typename-prefix](rules/no-typename-prefix.md)|Enforces users to avoid using the type name in a field name while defining your schema.|🚀||✅
39
37
  [no-undefined-variables](rules/no-undefined-variables.md)|A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.|🔮||✅
40
38
  [no-unreachable-types](rules/no-unreachable-types.md)|Requires all types to be reachable at some level by root level fields.|🚀|🔧|
41
39
  [no-unused-fields](rules/no-unused-fields.md)|Requires all fields to be used at some level by siblings operations.|🚀|🔧|
@@ -0,0 +1,21 @@
1
+ # Deprecated Rules
2
+
3
+ ## avoid-duplicate-fields
4
+
5
+ This rule was renamed to [`no-duplicate-fields`](rules/no-duplicate-fields.md).
6
+
7
+ ## avoid-scalar-result-type-on-mutation
8
+
9
+ This rule was renamed to [`no-scalar-result-type-on-mutation`](rules/no-scalar-result-type-on-mutation.md).
10
+
11
+ ## avoid-typename-prefix
12
+
13
+ This rule was renamed to [`no-typename-prefix`](rules/no-typename-prefix.md).
14
+
15
+ ## avoid-operation-name-prefix
16
+
17
+ This rule was removed because the same things can be validated using [`naming-convention`](rules/naming-convention.md).
18
+
19
+ ## no-operation-name-suffix
20
+
21
+ This rule was removed because the same things can be validated using [`naming-convention`](rules/naming-convention.md).
@@ -1,7 +1,7 @@
1
- # `avoid-duplicate-fields`
1
+ # `no-duplicate-fields`
2
2
 
3
3
  - Category: `Stylistic Issues`
4
- - Rule name: `@graphql-eslint/avoid-duplicate-fields`
4
+ - Rule name: `@graphql-eslint/no-duplicate-fields`
5
5
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
6
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
7
 
@@ -12,7 +12,7 @@ Checks for duplicate fields in selection set, variables in operation definition,
12
12
  ### Incorrect
13
13
 
14
14
  ```graphql
15
- # eslint @graphql-eslint/avoid-duplicate-fields: 'error'
15
+ # eslint @graphql-eslint/no-duplicate-fields: 'error'
16
16
 
17
17
  query {
18
18
  user {
@@ -26,7 +26,7 @@ query {
26
26
  ### Incorrect
27
27
 
28
28
  ```graphql
29
- # eslint @graphql-eslint/avoid-duplicate-fields: 'error'
29
+ # eslint @graphql-eslint/no-duplicate-fields: 'error'
30
30
 
31
31
  query {
32
32
  users(
@@ -43,7 +43,7 @@ query {
43
43
  ### Incorrect
44
44
 
45
45
  ```graphql
46
- # eslint @graphql-eslint/avoid-duplicate-fields: 'error'
46
+ # eslint @graphql-eslint/no-duplicate-fields: 'error'
47
47
 
48
48
  query (
49
49
  $first: Int!
@@ -57,5 +57,5 @@ query (
57
57
 
58
58
  ## Resources
59
59
 
60
- - [Rule source](../../packages/plugin/src/rules/avoid-duplicate-fields.ts)
61
- - [Test source](../../packages/plugin/tests/avoid-duplicate-fields.spec.ts)
60
+ - [Rule source](../../packages/plugin/src/rules/no-duplicate-fields.ts)
61
+ - [Test source](../../packages/plugin/tests/no-duplicate-fields.spec.ts)
@@ -45,6 +45,12 @@ The schema defines the following properties:
45
45
 
46
46
  ### `disallow` (array, required)
47
47
 
48
+ The elements of the array can contain the following enum values:
49
+
50
+ - `query`
51
+ - `mutation`
52
+ - `subscription`
53
+
48
54
  Additional restrictions:
49
55
 
50
56
  * Minimum items: `1`
@@ -1,7 +1,7 @@
1
- # `avoid-scalar-result-type-on-mutation`
1
+ # `no-scalar-result-type-on-mutation`
2
2
 
3
3
  - Category: `Best Practices`
4
- - Rule name: `@graphql-eslint/avoid-scalar-result-type-on-mutation`
4
+ - Rule name: `@graphql-eslint/no-scalar-result-type-on-mutation`
5
5
  - Requires GraphQL Schema: `true` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
6
6
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
7
7
 
@@ -12,7 +12,7 @@ Avoid scalar result type on mutation type to make sure to return a valid state.
12
12
  ### Incorrect
13
13
 
14
14
  ```graphql
15
- # eslint @graphql-eslint/avoid-scalar-result-type-on-mutation: 'error'
15
+ # eslint @graphql-eslint/no-scalar-result-type-on-mutation: 'error'
16
16
 
17
17
  type Mutation {
18
18
  createUser: Boolean
@@ -22,7 +22,7 @@ type Mutation {
22
22
  ### Correct
23
23
 
24
24
  ```graphql
25
- # eslint @graphql-eslint/avoid-scalar-result-type-on-mutation: 'error'
25
+ # eslint @graphql-eslint/no-scalar-result-type-on-mutation: 'error'
26
26
 
27
27
  type Mutation {
28
28
  createUser: User!
@@ -31,5 +31,5 @@ type Mutation {
31
31
 
32
32
  ## Resources
33
33
 
34
- - [Rule source](../../packages/plugin/src/rules/avoid-scalar-result-type-on-mutation.ts)
35
- - [Test source](../../packages/plugin/tests/avoid-scalar-result-type-on-mutation.spec.ts)
34
+ - [Rule source](../../packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts)
35
+ - [Test source](../../packages/plugin/tests/no-scalar-result-type-on-mutation.spec.ts)
@@ -1,9 +1,9 @@
1
- # `avoid-typename-prefix`
1
+ # `no-typename-prefix`
2
2
 
3
3
  ✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
4
4
 
5
5
  - Category: `Best Practices`
6
- - Rule name: `@graphql-eslint/avoid-typename-prefix`
6
+ - Rule name: `@graphql-eslint/no-typename-prefix`
7
7
  - Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
8
8
  - Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
9
9
 
@@ -14,7 +14,7 @@ Enforces users to avoid using the type name in a field name while defining your
14
14
  ### Incorrect
15
15
 
16
16
  ```graphql
17
- # eslint @graphql-eslint/avoid-typename-prefix: 'error'
17
+ # eslint @graphql-eslint/no-typename-prefix: 'error'
18
18
 
19
19
  type User {
20
20
  userId: ID!
@@ -24,7 +24,7 @@ type User {
24
24
  ### Correct
25
25
 
26
26
  ```graphql
27
- # eslint @graphql-eslint/avoid-typename-prefix: 'error'
27
+ # eslint @graphql-eslint/no-typename-prefix: 'error'
28
28
 
29
29
  type User {
30
30
  id: ID!
@@ -33,5 +33,5 @@ type User {
33
33
 
34
34
  ## Resources
35
35
 
36
- - [Rule source](../../packages/plugin/src/rules/avoid-typename-prefix.ts)
37
- - [Test source](../../packages/plugin/tests/avoid-typename-prefix.spec.ts)
36
+ - [Rule source](../../packages/plugin/src/rules/no-typename-prefix.ts)
37
+ - [Test source](../../packages/plugin/tests/no-typename-prefix.spec.ts)