@graphql-eslint/eslint-plugin 2.5.0-alpha-e34c5d6.0 → 3.0.0-alpha-3168a9b.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 +29 -1
- package/configs/index.d.ts +58 -2
- package/configs/recommended.d.ts +29 -1
- package/docs/rules/alphabetize.md +35 -10
- package/docs/rules/description-style.md +2 -2
- package/docs/rules/match-document-filename.md +7 -7
- package/docs/rules/naming-convention.md +54 -83
- package/docs/rules/strict-id-in-types.md +4 -4
- package/index.js +252 -257
- package/index.mjs +252 -257
- package/package.json +7 -7
- package/rules/index.d.ts +117 -15
- package/rules/naming-convention.d.ts +32 -25
- package/utils.d.ts +2 -7
package/configs/all.d.ts
CHANGED
@@ -37,7 +37,35 @@ export declare const allConfig: {
|
|
37
37
|
'@graphql-eslint/known-type-names': string;
|
38
38
|
'@graphql-eslint/lone-anonymous-operation': string;
|
39
39
|
'@graphql-eslint/lone-schema-definition': string;
|
40
|
-
'@graphql-eslint/naming-convention': string
|
40
|
+
'@graphql-eslint/naming-convention': (string | {
|
41
|
+
types: string;
|
42
|
+
fields: string;
|
43
|
+
overrides: {
|
44
|
+
EnumValueDefinition: string;
|
45
|
+
OperationDefinition: {
|
46
|
+
style: string;
|
47
|
+
forbiddenPrefixes: string[];
|
48
|
+
forbiddenSuffixes: string[];
|
49
|
+
};
|
50
|
+
FragmentDefinition: {
|
51
|
+
style: string;
|
52
|
+
forbiddenPrefixes: string[];
|
53
|
+
forbiddenSuffixes: string[];
|
54
|
+
};
|
55
|
+
'FieldDefinition[parent.name.value=Query]': {
|
56
|
+
forbiddenPrefixes: string[];
|
57
|
+
forbiddenSuffixes: string[];
|
58
|
+
};
|
59
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
60
|
+
forbiddenPrefixes: string[];
|
61
|
+
forbiddenSuffixes: string[];
|
62
|
+
};
|
63
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
64
|
+
forbiddenPrefixes: string[];
|
65
|
+
forbiddenSuffixes: string[];
|
66
|
+
};
|
67
|
+
};
|
68
|
+
})[];
|
41
69
|
'@graphql-eslint/no-anonymous-operations': string;
|
42
70
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
43
71
|
'@graphql-eslint/no-fragment-cycles': string;
|
package/configs/index.d.ts
CHANGED
@@ -38,7 +38,35 @@ export declare const configs: {
|
|
38
38
|
'@graphql-eslint/known-type-names': string;
|
39
39
|
'@graphql-eslint/lone-anonymous-operation': string;
|
40
40
|
'@graphql-eslint/lone-schema-definition': string;
|
41
|
-
'@graphql-eslint/naming-convention': string
|
41
|
+
'@graphql-eslint/naming-convention': (string | {
|
42
|
+
types: string;
|
43
|
+
fields: string;
|
44
|
+
overrides: {
|
45
|
+
EnumValueDefinition: string;
|
46
|
+
OperationDefinition: {
|
47
|
+
style: string;
|
48
|
+
forbiddenPrefixes: string[];
|
49
|
+
forbiddenSuffixes: string[];
|
50
|
+
};
|
51
|
+
FragmentDefinition: {
|
52
|
+
style: string;
|
53
|
+
forbiddenPrefixes: string[];
|
54
|
+
forbiddenSuffixes: string[];
|
55
|
+
};
|
56
|
+
'FieldDefinition[parent.name.value=Query]': {
|
57
|
+
forbiddenPrefixes: string[];
|
58
|
+
forbiddenSuffixes: string[];
|
59
|
+
};
|
60
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
61
|
+
forbiddenPrefixes: string[];
|
62
|
+
forbiddenSuffixes: string[];
|
63
|
+
};
|
64
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
65
|
+
forbiddenPrefixes: string[];
|
66
|
+
forbiddenSuffixes: string[];
|
67
|
+
};
|
68
|
+
};
|
69
|
+
})[];
|
42
70
|
'@graphql-eslint/no-anonymous-operations': string;
|
43
71
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
44
72
|
'@graphql-eslint/no-fragment-cycles': string;
|
@@ -84,7 +112,35 @@ export declare const configs: {
|
|
84
112
|
'@graphql-eslint/known-type-names': string;
|
85
113
|
'@graphql-eslint/lone-anonymous-operation': string;
|
86
114
|
'@graphql-eslint/lone-schema-definition': string;
|
87
|
-
'@graphql-eslint/naming-convention': string
|
115
|
+
'@graphql-eslint/naming-convention': (string | {
|
116
|
+
types: string;
|
117
|
+
fields: string;
|
118
|
+
overrides: {
|
119
|
+
EnumValueDefinition: string;
|
120
|
+
OperationDefinition: {
|
121
|
+
style: string;
|
122
|
+
forbiddenPrefixes: string[];
|
123
|
+
forbiddenSuffixes: string[];
|
124
|
+
};
|
125
|
+
FragmentDefinition: {
|
126
|
+
style: string;
|
127
|
+
forbiddenPrefixes: string[];
|
128
|
+
forbiddenSuffixes: string[];
|
129
|
+
};
|
130
|
+
'FieldDefinition[parent.name.value=Query]': {
|
131
|
+
forbiddenPrefixes: string[];
|
132
|
+
forbiddenSuffixes: string[];
|
133
|
+
};
|
134
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
135
|
+
forbiddenPrefixes: string[];
|
136
|
+
forbiddenSuffixes: string[];
|
137
|
+
};
|
138
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
139
|
+
forbiddenPrefixes: string[];
|
140
|
+
forbiddenSuffixes: string[];
|
141
|
+
};
|
142
|
+
};
|
143
|
+
})[];
|
88
144
|
'@graphql-eslint/no-anonymous-operations': string;
|
89
145
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
90
146
|
'@graphql-eslint/no-fragment-cycles': string;
|
package/configs/recommended.d.ts
CHANGED
@@ -12,7 +12,35 @@ export declare const recommendedConfig: {
|
|
12
12
|
'@graphql-eslint/known-type-names': string;
|
13
13
|
'@graphql-eslint/lone-anonymous-operation': string;
|
14
14
|
'@graphql-eslint/lone-schema-definition': string;
|
15
|
-
'@graphql-eslint/naming-convention': string
|
15
|
+
'@graphql-eslint/naming-convention': (string | {
|
16
|
+
types: string;
|
17
|
+
fields: string;
|
18
|
+
overrides: {
|
19
|
+
EnumValueDefinition: string;
|
20
|
+
OperationDefinition: {
|
21
|
+
style: string;
|
22
|
+
forbiddenPrefixes: string[];
|
23
|
+
forbiddenSuffixes: string[];
|
24
|
+
};
|
25
|
+
FragmentDefinition: {
|
26
|
+
style: string;
|
27
|
+
forbiddenPrefixes: string[];
|
28
|
+
forbiddenSuffixes: string[];
|
29
|
+
};
|
30
|
+
'FieldDefinition[parent.name.value=Query]': {
|
31
|
+
forbiddenPrefixes: string[];
|
32
|
+
forbiddenSuffixes: string[];
|
33
|
+
};
|
34
|
+
'FieldDefinition[parent.name.value=Mutation]': {
|
35
|
+
forbiddenPrefixes: string[];
|
36
|
+
forbiddenSuffixes: string[];
|
37
|
+
};
|
38
|
+
'FieldDefinition[parent.name.value=Subscription]': {
|
39
|
+
forbiddenPrefixes: string[];
|
40
|
+
forbiddenSuffixes: string[];
|
41
|
+
};
|
42
|
+
};
|
43
|
+
})[];
|
16
44
|
'@graphql-eslint/no-anonymous-operations': string;
|
17
45
|
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
18
46
|
'@graphql-eslint/no-fragment-cycles': string;
|
@@ -95,50 +95,75 @@ The schema defines the following properties:
|
|
95
95
|
|
96
96
|
### `fields` (array)
|
97
97
|
|
98
|
-
Fields of `type`, `interface`, and `input
|
98
|
+
Fields of `type`, `interface`, and `input`
|
99
99
|
|
100
|
-
The elements of the array
|
100
|
+
The elements of the array can contain the following enum values:
|
101
101
|
|
102
102
|
- `ObjectTypeDefinition`
|
103
103
|
- `InterfaceTypeDefinition`
|
104
104
|
- `InputObjectTypeDefinition`
|
105
105
|
|
106
|
+
Additional restrictions:
|
107
|
+
|
108
|
+
* Minimum items: `1`
|
109
|
+
* Unique items: `true`
|
110
|
+
|
106
111
|
### `values` (array)
|
107
112
|
|
108
|
-
Values of `enum
|
113
|
+
Values of `enum`
|
109
114
|
|
110
|
-
The elements of the array
|
115
|
+
The elements of the array can contain the following enum values:
|
111
116
|
|
112
117
|
- `EnumTypeDefinition`
|
113
118
|
|
119
|
+
Additional restrictions:
|
120
|
+
|
121
|
+
* Minimum items: `1`
|
122
|
+
* Unique items: `true`
|
123
|
+
|
114
124
|
### `selections` (array)
|
115
125
|
|
116
|
-
Selections of operations (`query`, `mutation` and `subscription`) and `fragment
|
126
|
+
Selections of operations (`query`, `mutation` and `subscription`) and `fragment`
|
117
127
|
|
118
|
-
The elements of the array
|
128
|
+
The elements of the array can contain the following enum values:
|
119
129
|
|
120
130
|
- `OperationDefinition`
|
121
131
|
- `FragmentDefinition`
|
122
132
|
|
133
|
+
Additional restrictions:
|
134
|
+
|
135
|
+
* Minimum items: `1`
|
136
|
+
* Unique items: `true`
|
137
|
+
|
123
138
|
### `variables` (array)
|
124
139
|
|
125
|
-
Variables of operations (`query`, `mutation` and `subscription`)
|
140
|
+
Variables of operations (`query`, `mutation` and `subscription`)
|
126
141
|
|
127
|
-
The elements of the array
|
142
|
+
The elements of the array can contain the following enum values:
|
128
143
|
|
129
144
|
- `OperationDefinition`
|
130
145
|
|
146
|
+
Additional restrictions:
|
147
|
+
|
148
|
+
* Minimum items: `1`
|
149
|
+
* Unique items: `true`
|
150
|
+
|
131
151
|
### `arguments` (array)
|
132
152
|
|
133
|
-
Arguments of fields and directives
|
153
|
+
Arguments of fields and directives
|
134
154
|
|
135
|
-
The elements of the array
|
155
|
+
The elements of the array can contain the following enum values:
|
136
156
|
|
137
157
|
- `FieldDefinition`
|
138
158
|
- `Field`
|
139
159
|
- `DirectiveDefinition`
|
140
160
|
- `Directive`
|
141
161
|
|
162
|
+
Additional restrictions:
|
163
|
+
|
164
|
+
* Minimum items: `1`
|
165
|
+
* Unique items: `true`
|
166
|
+
|
142
167
|
## Resources
|
143
168
|
|
144
169
|
- [Rule source](../../packages/plugin/src/rules/alphabetize.ts)
|
@@ -92,8 +92,8 @@ The schema defines the following properties:
|
|
92
92
|
|
93
93
|
This element must be one of the following enum values:
|
94
94
|
|
95
|
-
|
96
|
-
|
95
|
+
- `.gql`
|
96
|
+
- `.graphql`
|
97
97
|
|
98
98
|
### `query`
|
99
99
|
|
@@ -141,11 +141,11 @@ Properties of the `asObject` object:
|
|
141
141
|
|
142
142
|
This element must be one of the following enum values:
|
143
143
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
144
|
+
- `camelCase`
|
145
|
+
- `PascalCase`
|
146
|
+
- `snake_case`
|
147
|
+
- `UPPER_CASE`
|
148
|
+
- `kebab-case`
|
149
149
|
|
150
150
|
## Resources
|
151
151
|
|
@@ -14,20 +14,20 @@ Require names to follow specified conventions.
|
|
14
14
|
### Incorrect
|
15
15
|
|
16
16
|
```graphql
|
17
|
-
# eslint @graphql-eslint/naming-convention: ['error', {
|
17
|
+
# eslint @graphql-eslint/naming-convention: ['error', { types: 'PascalCase', fields: 'camelCase' }]
|
18
18
|
|
19
|
-
type
|
20
|
-
|
19
|
+
type user {
|
20
|
+
first_name: String!
|
21
21
|
}
|
22
22
|
```
|
23
23
|
|
24
24
|
### Correct
|
25
25
|
|
26
26
|
```graphql
|
27
|
-
# eslint @graphql-eslint/naming-convention: ['error', {
|
27
|
+
# eslint @graphql-eslint/naming-convention: ['error', { types: 'PascalCase', fields: 'camelCase' }]
|
28
28
|
|
29
|
-
type
|
30
|
-
|
29
|
+
type User {
|
30
|
+
firstName: String
|
31
31
|
}
|
32
32
|
```
|
33
33
|
|
@@ -35,115 +35,84 @@ type SomeTypeName {
|
|
35
35
|
|
36
36
|
The schema defines the following properties:
|
37
37
|
|
38
|
-
### `
|
38
|
+
### `types`
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
* `asString`
|
43
|
-
* `asObject`
|
40
|
+
Includes:
|
44
41
|
|
45
|
-
|
42
|
+
- `ObjectTypeDefinition`
|
43
|
+
- `InterfaceTypeDefinition`
|
44
|
+
- `EnumTypeDefinition`
|
45
|
+
- `ScalarTypeDefinition`
|
46
|
+
- `InputObjectTypeDefinition`
|
47
|
+
- `UnionTypeDefinition`
|
46
48
|
|
47
49
|
The object must be one of the following types:
|
48
50
|
|
49
51
|
* `asString`
|
50
52
|
* `asObject`
|
51
53
|
|
52
|
-
### `
|
54
|
+
### `fields`
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
* `asString`
|
57
|
-
* `asObject`
|
58
|
-
|
59
|
-
### `InputValueDefinition`
|
60
|
-
|
61
|
-
The object must be one of the following types:
|
62
|
-
|
63
|
-
* `asString`
|
64
|
-
* `asObject`
|
56
|
+
Includes:
|
65
57
|
|
66
|
-
|
58
|
+
- `FieldDefinition`
|
59
|
+
- `InputValueDefinition`
|
60
|
+
- `VariableDefinition`
|
61
|
+
- `Argument`
|
62
|
+
- `DirectiveDefinition`
|
67
63
|
|
68
64
|
The object must be one of the following types:
|
69
65
|
|
70
66
|
* `asString`
|
71
67
|
* `asObject`
|
72
68
|
|
73
|
-
### `
|
69
|
+
### `allowLeadingUnderscore` (boolean)
|
74
70
|
|
75
|
-
|
71
|
+
Default: `false`
|
76
72
|
|
77
|
-
|
78
|
-
* `asObject`
|
73
|
+
### `allowTrailingUnderscore` (boolean)
|
79
74
|
|
80
|
-
|
75
|
+
Default: `false`
|
81
76
|
|
82
|
-
|
77
|
+
### `overrides` (object)
|
83
78
|
|
84
|
-
|
85
|
-
* `asObject`
|
79
|
+
May contain the following `ASTNode` names:
|
86
80
|
|
87
|
-
|
81
|
+
- `Argument`
|
82
|
+
- `DirectiveDefinition`
|
83
|
+
- `EnumTypeDefinition`
|
84
|
+
- `EnumValueDefinition`
|
85
|
+
- `FieldDefinition`
|
86
|
+
- `FragmentDefinition`
|
87
|
+
- `InputObjectTypeDefinition`
|
88
|
+
- `InputValueDefinition`
|
89
|
+
- `InterfaceTypeDefinition`
|
90
|
+
- `ObjectTypeDefinition`
|
91
|
+
- `OperationDefinition`
|
92
|
+
- `ScalarTypeDefinition`
|
93
|
+
- `UnionTypeDefinition`
|
94
|
+
- `VariableDefinition`
|
88
95
|
|
89
|
-
|
96
|
+
> It's also possible to use a [`selector`](https://eslint.org/docs/developer-guide/selectors) that starts with `ASTNode` name
|
97
|
+
>
|
98
|
+
> Example: pattern property `FieldDefinition[parent.name.value=Query]` will match only fields for type `Query`
|
90
99
|
|
91
|
-
|
92
|
-
* `asObject`
|
100
|
+
Pattern properties of the `overrides` object:
|
93
101
|
|
94
|
-
|
102
|
+
#### `^(Argument|DirectiveDefinition|EnumTypeDefinition|EnumValueDefinition|FieldDefinition|FragmentDefinition|InputObjectTypeDefinition|InputValueDefinition|InterfaceTypeDefinition|ObjectTypeDefinition|OperationDefinition|ScalarTypeDefinition|UnionTypeDefinition|VariableDefinition)(.+)?$`
|
95
103
|
|
96
104
|
The object must be one of the following types:
|
97
105
|
|
98
106
|
* `asString`
|
99
107
|
* `asObject`
|
100
108
|
|
101
|
-
### `OperationDefinition`
|
102
|
-
|
103
|
-
The object must be one of the following types:
|
104
|
-
|
105
|
-
* `asString`
|
106
|
-
* `asObject`
|
107
|
-
|
108
|
-
### `FragmentDefinition`
|
109
|
-
|
110
|
-
The object must be one of the following types:
|
111
|
-
|
112
|
-
* `asString`
|
113
|
-
* `asObject`
|
114
|
-
|
115
|
-
### `QueryDefinition`
|
116
|
-
|
117
|
-
The object must be one of the following types:
|
118
|
-
|
119
|
-
* `asString`
|
120
|
-
* `asObject`
|
121
|
-
|
122
|
-
### `leadingUnderscore` (string, enum)
|
123
|
-
|
124
|
-
This element must be one of the following enum values:
|
125
|
-
|
126
|
-
* `allow`
|
127
|
-
* `forbid`
|
128
|
-
|
129
|
-
Default: `"forbid"`
|
130
|
-
|
131
|
-
### `trailingUnderscore` (string, enum)
|
132
|
-
|
133
|
-
This element must be one of the following enum values:
|
134
|
-
|
135
|
-
* `allow`
|
136
|
-
* `forbid`
|
137
|
-
|
138
|
-
Default: `"forbid"`
|
139
|
-
|
140
109
|
---
|
141
110
|
|
142
111
|
# Sub Schemas
|
143
112
|
|
144
113
|
The schema defines the following additional types:
|
145
114
|
|
146
|
-
## `asString` (
|
115
|
+
## `asString` (enum)
|
147
116
|
|
148
117
|
One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`
|
149
118
|
|
@@ -151,14 +120,14 @@ One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`
|
|
151
120
|
|
152
121
|
Properties of the `asObject` object:
|
153
122
|
|
154
|
-
### `style` (
|
123
|
+
### `style` (enum)
|
155
124
|
|
156
125
|
This element must be one of the following enum values:
|
157
126
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
127
|
+
- `camelCase`
|
128
|
+
- `PascalCase`
|
129
|
+
- `snake_case`
|
130
|
+
- `UPPER_CASE`
|
162
131
|
|
163
132
|
### `prefix` (string)
|
164
133
|
|
@@ -171,6 +140,7 @@ The object is an array with all elements of the type `string`.
|
|
171
140
|
Additional restrictions:
|
172
141
|
|
173
142
|
* Minimum items: `1`
|
143
|
+
* Unique items: `true`
|
174
144
|
|
175
145
|
### `forbiddenSuffixes` (array)
|
176
146
|
|
@@ -179,6 +149,7 @@ The object is an array with all elements of the type `string`.
|
|
179
149
|
Additional restrictions:
|
180
150
|
|
181
151
|
* Minimum items: `1`
|
152
|
+
* Unique items: `true`
|
182
153
|
|
183
154
|
## Resources
|
184
155
|
|
@@ -70,7 +70,7 @@ The object is an array with all elements of the type `string`.
|
|
70
70
|
|
71
71
|
Default:
|
72
72
|
|
73
|
-
```
|
73
|
+
```json
|
74
74
|
[
|
75
75
|
"id"
|
76
76
|
]
|
@@ -82,7 +82,7 @@ The object is an array with all elements of the type `string`.
|
|
82
82
|
|
83
83
|
Default:
|
84
84
|
|
85
|
-
```
|
85
|
+
```json
|
86
86
|
[
|
87
87
|
"ID"
|
88
88
|
]
|
@@ -100,7 +100,7 @@ The object is an array with all elements of the type `string`.
|
|
100
100
|
|
101
101
|
Default:
|
102
102
|
|
103
|
-
```
|
103
|
+
```json
|
104
104
|
[]
|
105
105
|
```
|
106
106
|
|
@@ -112,7 +112,7 @@ The object is an array with all elements of the type `string`.
|
|
112
112
|
|
113
113
|
Default:
|
114
114
|
|
115
|
-
```
|
115
|
+
```json
|
116
116
|
[]
|
117
117
|
```
|
118
118
|
|