@graphql-eslint/eslint-plugin 3.0.0-alpha-3168a9b.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 +9 -6
- package/configs/index.d.ts +10 -8
- package/configs/recommended.d.ts +1 -2
- package/docs/README.md +3 -5
- package/docs/deprecated-rules.md +21 -0
- package/docs/rules/naming-convention.md +25 -25
- package/docs/rules/{avoid-duplicate-fields.md → no-duplicate-fields.md} +7 -7
- package/docs/rules/no-root-type.md +6 -0
- package/docs/rules/{avoid-scalar-result-type-on-mutation.md → no-scalar-result-type-on-mutation.md} +6 -6
- package/docs/rules/{avoid-typename-prefix.md → no-typename-prefix.md} +6 -6
- package/docs/rules/require-description.md +35 -6
- package/index.js +341 -472
- package/index.mjs +342 -473
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +5 -6
- package/rules/index.d.ts +21 -11
- package/rules/{avoid-duplicate-fields.d.ts → no-duplicate-fields.d.ts} +0 -0
- package/rules/{avoid-scalar-result-type-on-mutation.d.ts → no-scalar-result-type-on-mutation.d.ts} +0 -0
- package/rules/{avoid-typename-prefix.d.ts → no-typename-prefix.d.ts} +0 -0
- package/rules/require-description.d.ts +10 -6
- package/utils.d.ts +1 -1
- package/docs/rules/avoid-operation-name-prefix.md +0 -50
- package/docs/rules/no-operation-name-suffix.md +0 -38
- package/rules/avoid-operation-name-prefix.d.ts +0 -9
- package/rules/no-operation-name-suffix.d.ts +0 -3
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "3.0.0-alpha-
|
3
|
+
"version": "3.0.0-alpha-7462f3d.0",
|
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"
|
package/rules/alphabetize.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
import { Kind } from 'graphql';
|
2
1
|
import { GraphQLESLintRule } from '../types';
|
3
|
-
declare const fieldsEnum:
|
4
|
-
declare const valuesEnum:
|
5
|
-
declare const selectionsEnum:
|
6
|
-
declare const variablesEnum:
|
7
|
-
declare const argumentsEnum:
|
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: ('FieldDefinition' | 'Field' | 'DirectiveDefinition' | 'Directive')[];
|
8
7
|
declare type AlphabetizeConfig = [
|
9
8
|
{
|
10
9
|
fields?: typeof fieldsEnum;
|
package/rules/index.d.ts
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
export declare const rules: {
|
2
2
|
alphabetize: import("..").GraphQLESLintRule<[{
|
3
|
-
fields?:
|
4
|
-
values?:
|
5
|
-
selections?:
|
6
|
-
variables?:
|
7
|
-
arguments?:
|
3
|
+
fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[];
|
4
|
+
values?: ["EnumTypeDefinition"];
|
5
|
+
selections?: ("OperationDefinition" | "FragmentDefinition")[];
|
6
|
+
variables?: ["OperationDefinition"];
|
7
|
+
arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
|
8
8
|
}], false>;
|
9
|
-
'avoid-duplicate-fields': import("..").GraphQLESLintRule<any[], false>;
|
10
|
-
'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
|
11
|
-
'avoid-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
|
12
|
-
'avoid-typename-prefix': import("..").GraphQLESLintRule<any[], false>;
|
13
9
|
'description-style': import("..").GraphQLESLintRule<[{
|
14
10
|
style: "block" | "inline";
|
15
11
|
}], false>;
|
@@ -159,11 +155,13 @@ export declare const rules: {
|
|
159
155
|
'no-anonymous-operations': import("..").GraphQLESLintRule<any[], false>;
|
160
156
|
'no-case-insensitive-enum-values-duplicates': import("..").GraphQLESLintRule<any[], false>;
|
161
157
|
'no-deprecated': import("..").GraphQLESLintRule<[], true>;
|
158
|
+
'no-duplicate-fields': import("..").GraphQLESLintRule<any[], false>;
|
162
159
|
'no-hashtag-description': import("..").GraphQLESLintRule<any[], false>;
|
163
|
-
'no-operation-name-suffix': import("..").GraphQLESLintRule<any[], false>;
|
164
160
|
'no-root-type': import("..").GraphQLESLintRule<[{
|
165
161
|
disallow: ("query" | "mutation" | "subscription")[];
|
166
162
|
}], false>;
|
163
|
+
'no-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
|
164
|
+
'no-typename-prefix': import("..").GraphQLESLintRule<any[], false>;
|
167
165
|
'no-unreachable-types': import("..").GraphQLESLintRule<any[], false>;
|
168
166
|
'no-unused-fields': import("..").GraphQLESLintRule<any[], false>;
|
169
167
|
'require-deprecation-date': import("..").GraphQLESLintRule<[{
|
@@ -171,7 +169,19 @@ export declare const rules: {
|
|
171
169
|
}], false>;
|
172
170
|
'require-deprecation-reason': import("..").GraphQLESLintRule<any[], false>;
|
173
171
|
'require-description': import("..").GraphQLESLintRule<[{
|
174
|
-
|
172
|
+
types?: boolean;
|
173
|
+
overrides?: {
|
174
|
+
ScalarTypeDefinition?: boolean;
|
175
|
+
ObjectTypeDefinition?: boolean;
|
176
|
+
FieldDefinition?: boolean;
|
177
|
+
InputValueDefinition?: boolean;
|
178
|
+
InterfaceTypeDefinition?: boolean;
|
179
|
+
UnionTypeDefinition?: boolean;
|
180
|
+
EnumTypeDefinition?: boolean;
|
181
|
+
EnumValueDefinition?: boolean;
|
182
|
+
InputObjectTypeDefinition?: boolean;
|
183
|
+
DirectiveDefinition?: boolean;
|
184
|
+
};
|
175
185
|
}], false>;
|
176
186
|
'require-field-of-type-query-in-mutation-result': import("..").GraphQLESLintRule<any[], false>;
|
177
187
|
'require-id-when-available': import("..").GraphQLESLintRule<[{
|
File without changes
|
package/rules/{avoid-scalar-result-type-on-mutation.d.ts → no-scalar-result-type-on-mutation.d.ts}
RENAMED
File without changes
|
File without changes
|
@@ -1,8 +1,12 @@
|
|
1
|
-
import { GraphQLESLintRule } from '../types';
|
2
1
|
import { Kind } from 'graphql';
|
3
|
-
|
4
|
-
declare
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
import { GraphQLESLintRule } from '../types';
|
3
|
+
declare const ALLOWED_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.ENUM_TYPE_DEFINITION, Kind.SCALAR_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.UNION_TYPE_DEFINITION, Kind.FIELD_DEFINITION, Kind.INPUT_VALUE_DEFINITION, Kind.ENUM_VALUE_DEFINITION, Kind.DIRECTIVE_DEFINITION];
|
4
|
+
declare type AllowedKind = typeof ALLOWED_KINDS[number];
|
5
|
+
declare type RequireDescriptionRuleConfig = {
|
6
|
+
types?: boolean;
|
7
|
+
overrides?: {
|
8
|
+
[key in AllowedKind]?: boolean;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
declare const rule: GraphQLESLintRule<[RequireDescriptionRuleConfig]>;
|
8
12
|
export default rule;
|
package/utils.d.ts
CHANGED
@@ -19,7 +19,7 @@ export declare const normalizePath: (path: string) => string;
|
|
19
19
|
export declare const getOnDiskFilepath: (filepath: string) => string;
|
20
20
|
export declare const getTypeName: (node: any) => any;
|
21
21
|
export declare const loaderCache: Record<string, LoaderSource[]>;
|
22
|
-
export declare const TYPES_KINDS: Kind
|
22
|
+
export declare const TYPES_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.ENUM_TYPE_DEFINITION, Kind.SCALAR_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.UNION_TYPE_DEFINITION];
|
23
23
|
export declare enum CaseStyle {
|
24
24
|
camelCase = "camelCase",
|
25
25
|
pascalCase = "PascalCase",
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# `avoid-operation-name-prefix`
|
2
|
-
|
3
|
-
- Category: `Stylistic Issues`
|
4
|
-
- Rule name: `@graphql-eslint/avoid-operation-name-prefix`
|
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/avoid operation name prefix, useful if you wish to avoid prefix in your root fields, or avoid using REST terminology in your schema.
|
9
|
-
|
10
|
-
## Usage Examples
|
11
|
-
|
12
|
-
### Incorrect
|
13
|
-
|
14
|
-
```graphql
|
15
|
-
# eslint @graphql-eslint/avoid-operation-name-prefix: ['error', { keywords: ['get'] }]
|
16
|
-
|
17
|
-
query getUserDetails {
|
18
|
-
# ...
|
19
|
-
}
|
20
|
-
```
|
21
|
-
|
22
|
-
### Correct
|
23
|
-
|
24
|
-
```graphql
|
25
|
-
# eslint @graphql-eslint/avoid-operation-name-prefix: ['error', { keywords: ['get'] }]
|
26
|
-
|
27
|
-
query userDetails {
|
28
|
-
# ...
|
29
|
-
}
|
30
|
-
```
|
31
|
-
|
32
|
-
## Config Schema
|
33
|
-
|
34
|
-
The schema defines the following properties:
|
35
|
-
|
36
|
-
### `caseSensitive` (boolean)
|
37
|
-
|
38
|
-
Default: `false`
|
39
|
-
|
40
|
-
### `keywords` (array, required)
|
41
|
-
|
42
|
-
The object is an array with all elements of the type `string`.
|
43
|
-
|
44
|
-
Additional restrictions:
|
45
|
-
|
46
|
-
* Minimum items: `1`
|
47
|
-
|
48
|
-
## Resources
|
49
|
-
|
50
|
-
- [Rule source](../../packages/plugin/src/rules/avoid-operation-name-prefix.ts)
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# `no-operation-name-suffix`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
|
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
|
-
- Category: `Stylistic Issues`
|
8
|
-
- Rule name: `@graphql-eslint/no-operation-name-suffix`
|
9
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
10
|
-
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
11
|
-
|
12
|
-
Makes sure you are not adding the operation type to the name of the operation.
|
13
|
-
|
14
|
-
## Usage Examples
|
15
|
-
|
16
|
-
### Incorrect
|
17
|
-
|
18
|
-
```graphql
|
19
|
-
# eslint @graphql-eslint/no-operation-name-suffix: 'error'
|
20
|
-
|
21
|
-
query userQuery {
|
22
|
-
# ...
|
23
|
-
}
|
24
|
-
```
|
25
|
-
|
26
|
-
### Correct
|
27
|
-
|
28
|
-
```graphql
|
29
|
-
# eslint @graphql-eslint/no-operation-name-suffix: 'error'
|
30
|
-
|
31
|
-
query user {
|
32
|
-
# ...
|
33
|
-
}
|
34
|
-
```
|
35
|
-
|
36
|
-
## Resources
|
37
|
-
|
38
|
-
- [Rule source](../../packages/plugin/src/rules/no-operation-name-suffix.ts)
|