@graphql-eslint/eslint-plugin 2.3.0-alpha-4c161e5.0 → 2.3.0-alpha-6ba4002.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 +0 -7
- package/configs/index.d.ts +0 -7
- package/docs/README.md +0 -1
- package/docs/rules/avoid-operation-name-prefix.md +7 -3
- package/docs/rules/description-style.md +8 -4
- package/docs/rules/input-name.md +9 -5
- package/docs/rules/match-document-filename.md +10 -6
- package/docs/rules/naming-convention.md +19 -15
- package/docs/rules/require-deprecation-date.md +6 -2
- package/docs/rules/require-description.md +10 -2
- package/docs/rules/require-id-when-available.md +6 -2
- package/docs/rules/selection-set-depth.md +12 -4
- package/docs/rules/strict-id-in-types.md +10 -6
- package/index.js +68 -312
- package/index.mjs +68 -312
- package/package.json +1 -1
- package/rules/index.d.ts +0 -7
- package/testkit.d.ts +1 -1
- package/types.d.ts +0 -1
- package/docs/rules/alphabetize.md +0 -140
- package/rules/alphabetize.d.ts +0 -17
@@ -1,140 +0,0 @@
|
|
1
|
-
# `alphabetize`
|
2
|
-
|
3
|
-
- Category: `Best Practices`
|
4
|
-
- Rule name: `@graphql-eslint/alphabetize`
|
5
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
6
|
-
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
7
|
-
|
8
|
-
Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.
|
9
|
-
|
10
|
-
## Usage Examples
|
11
|
-
|
12
|
-
### Incorrect
|
13
|
-
|
14
|
-
```graphql
|
15
|
-
# eslint @graphql-eslint/alphabetize: ['error', { fields: ['ObjectTypeDefinition'] }]
|
16
|
-
|
17
|
-
type User {
|
18
|
-
password: String
|
19
|
-
firstName: String! # should be before "password"
|
20
|
-
age: Int # should be before "firstName"
|
21
|
-
lastName: String!
|
22
|
-
}
|
23
|
-
```
|
24
|
-
|
25
|
-
### Correct
|
26
|
-
|
27
|
-
```graphql
|
28
|
-
# eslint @graphql-eslint/alphabetize: ['error', { fields: ['ObjectTypeDefinition'] }]
|
29
|
-
|
30
|
-
type User {
|
31
|
-
age: Int
|
32
|
-
firstName: String!
|
33
|
-
lastName: String!
|
34
|
-
password: String
|
35
|
-
}
|
36
|
-
```
|
37
|
-
|
38
|
-
### Incorrect
|
39
|
-
|
40
|
-
```graphql
|
41
|
-
# eslint @graphql-eslint/alphabetize: ['error', { values: ['EnumTypeDefinition'] }]
|
42
|
-
|
43
|
-
enum Role {
|
44
|
-
SUPER_ADMIN
|
45
|
-
ADMIN # should be before "SUPER_ADMIN"
|
46
|
-
USER
|
47
|
-
GOD # should be before "USER"
|
48
|
-
}
|
49
|
-
```
|
50
|
-
|
51
|
-
### Correct
|
52
|
-
|
53
|
-
```graphql
|
54
|
-
# eslint @graphql-eslint/alphabetize: ['error', { values: ['EnumTypeDefinition'] }]
|
55
|
-
|
56
|
-
enum Role {
|
57
|
-
ADMIN
|
58
|
-
GOD
|
59
|
-
SUPER_ADMIN
|
60
|
-
USER
|
61
|
-
}
|
62
|
-
```
|
63
|
-
|
64
|
-
### Incorrect
|
65
|
-
|
66
|
-
```graphql
|
67
|
-
# eslint @graphql-eslint/alphabetize: ['error', { selections: ['OperationDefinition'] }]
|
68
|
-
|
69
|
-
query {
|
70
|
-
me {
|
71
|
-
firstName
|
72
|
-
lastName
|
73
|
-
email # should be before "lastName"
|
74
|
-
}
|
75
|
-
}
|
76
|
-
```
|
77
|
-
|
78
|
-
### Correct
|
79
|
-
|
80
|
-
```graphql
|
81
|
-
# eslint @graphql-eslint/alphabetize: ['error', { selections: ['OperationDefinition'] }]
|
82
|
-
|
83
|
-
query {
|
84
|
-
me {
|
85
|
-
email
|
86
|
-
firstName
|
87
|
-
lastName
|
88
|
-
}
|
89
|
-
}
|
90
|
-
```
|
91
|
-
|
92
|
-
## Config Schema
|
93
|
-
|
94
|
-
The schema defines the following properties:
|
95
|
-
|
96
|
-
### `fields` (array)
|
97
|
-
|
98
|
-
Fields of `type`, `interface`, and `input`.
|
99
|
-
|
100
|
-
The elements of the array must contain the following properties:
|
101
|
-
|
102
|
-
- `ObjectTypeDefinition`
|
103
|
-
- `InterfaceTypeDefinition`
|
104
|
-
- `InputObjectTypeDefinition`
|
105
|
-
|
106
|
-
### `values` (array)
|
107
|
-
|
108
|
-
Values of `enum`.
|
109
|
-
|
110
|
-
The elements of the array must contain the following properties:
|
111
|
-
|
112
|
-
- `EnumTypeDefinition`
|
113
|
-
|
114
|
-
### `selections` (array)
|
115
|
-
|
116
|
-
Selections of operations (`query`, `mutation` and `subscription`) and `fragment`.
|
117
|
-
|
118
|
-
The elements of the array must contain the following properties:
|
119
|
-
|
120
|
-
- `OperationDefinition`
|
121
|
-
- `FragmentDefinition`
|
122
|
-
|
123
|
-
### `variables` (array)
|
124
|
-
|
125
|
-
Variables of operations (`query`, `mutation` and `subscription`).
|
126
|
-
|
127
|
-
The elements of the array must contain the following properties:
|
128
|
-
|
129
|
-
- `OperationDefinition`
|
130
|
-
|
131
|
-
### `arguments` (array)
|
132
|
-
|
133
|
-
Arguments of fields and directives.
|
134
|
-
|
135
|
-
The elements of the array must contain the following properties:
|
136
|
-
|
137
|
-
- `FieldDefinition`
|
138
|
-
- `Field`
|
139
|
-
- `DirectiveDefinition`
|
140
|
-
- `Directive`
|
package/rules/alphabetize.d.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import { GraphQLESLintRule } from '../types';
|
2
|
-
declare const fieldsEnum: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[];
|
3
|
-
declare const valuesEnum: "EnumTypeDefinition"[];
|
4
|
-
declare const selectionsEnum: ("OperationDefinition" | "FragmentDefinition")[];
|
5
|
-
declare const variablesEnum: "OperationDefinition"[];
|
6
|
-
declare const argumentsEnum: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
|
7
|
-
declare type AlphabetizeConfig = [
|
8
|
-
{
|
9
|
-
fields?: typeof fieldsEnum;
|
10
|
-
values?: typeof valuesEnum;
|
11
|
-
selections?: typeof selectionsEnum;
|
12
|
-
variables?: typeof variablesEnum;
|
13
|
-
arguments?: typeof argumentsEnum;
|
14
|
-
}
|
15
|
-
];
|
16
|
-
declare const rule: GraphQLESLintRule<AlphabetizeConfig>;
|
17
|
-
export default rule;
|