@graphql-eslint/eslint-plugin 3.0.0-alpha-0a66b90.0 → 3.0.0-alpha-2918431.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/README.md +19 -8
- package/configs/base.d.ts +5 -0
- package/configs/index.d.ts +78 -121
- package/configs/operations-all.d.ts +19 -0
- package/configs/operations-recommended.d.ts +51 -0
- package/configs/schema-all.d.ts +21 -0
- package/configs/schema-recommended.d.ts +42 -0
- package/docs/README.md +10 -18
- package/docs/deprecated-rules.md +21 -0
- package/docs/rules/alphabetize.md +1 -1
- package/docs/rules/description-style.md +5 -3
- package/docs/rules/executable-definitions.md +2 -2
- package/docs/rules/fields-on-correct-type.md +2 -2
- package/docs/rules/fragments-on-composite-type.md +2 -2
- package/docs/rules/input-name.md +1 -1
- package/docs/rules/known-argument-names.md +2 -2
- package/docs/rules/known-directives.md +2 -2
- package/docs/rules/known-fragment-names.md +2 -2
- package/docs/rules/known-type-names.md +2 -2
- package/docs/rules/lone-anonymous-operation.md +2 -2
- package/docs/rules/lone-schema-definition.md +2 -2
- package/docs/rules/match-document-filename.md +6 -4
- package/docs/rules/naming-convention.md +140 -41
- package/docs/rules/no-anonymous-operations.md +2 -2
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +2 -2
- package/docs/rules/no-deprecated.md +3 -1
- package/docs/rules/{avoid-duplicate-fields.md → no-duplicate-fields.md} +10 -8
- package/docs/rules/no-fragment-cycles.md +2 -2
- package/docs/rules/no-hashtag-description.md +3 -1
- package/docs/rules/no-root-type.md +9 -14
- package/docs/rules/{avoid-scalar-result-type-on-mutation.md → no-scalar-result-type-on-mutation.md} +7 -7
- package/docs/rules/no-typename-prefix.md +37 -0
- package/docs/rules/no-undefined-variables.md +2 -2
- package/docs/rules/no-unreachable-types.md +3 -1
- package/docs/rules/no-unused-fields.md +1 -1
- package/docs/rules/no-unused-fragments.md +2 -2
- package/docs/rules/no-unused-variables.md +2 -2
- package/docs/rules/one-field-subscriptions.md +2 -2
- package/docs/rules/overlapping-fields-can-be-merged.md +2 -2
- package/docs/rules/possible-fragment-spread.md +2 -2
- package/docs/rules/possible-type-extension.md +2 -2
- package/docs/rules/provided-required-arguments.md +2 -2
- package/docs/rules/require-deprecation-date.md +1 -1
- package/docs/rules/require-deprecation-reason.md +2 -2
- package/docs/rules/require-description.md +36 -22
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +1 -1
- package/docs/rules/require-id-when-available.md +3 -1
- package/docs/rules/scalar-leafs.md +2 -2
- package/docs/rules/selection-set-depth.md +9 -2
- package/docs/rules/strict-id-in-types.md +16 -10
- package/docs/rules/unique-argument-names.md +2 -2
- package/docs/rules/unique-directive-names-per-location.md +2 -2
- package/docs/rules/unique-directive-names.md +2 -2
- package/docs/rules/unique-enum-value-names.md +2 -2
- package/docs/rules/unique-field-definition-names.md +2 -2
- package/docs/rules/unique-fragment-name.md +1 -1
- package/docs/rules/unique-input-field-names.md +2 -2
- package/docs/rules/unique-operation-name.md +1 -1
- package/docs/rules/unique-operation-types.md +2 -2
- package/docs/rules/unique-type-names.md +2 -2
- package/docs/rules/unique-variable-names.md +2 -2
- package/docs/rules/value-literals-of-correct-type.md +2 -2
- package/docs/rules/variables-are-input-types.md +2 -2
- package/docs/rules/variables-in-allowed-position.md +2 -2
- package/index.js +651 -724
- package/index.mjs +652 -725
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +8 -10
- package/rules/description-style.d.ts +4 -6
- package/rules/index.d.ts +115 -119
- package/rules/input-name.d.ts +1 -1
- package/rules/match-document-filename.d.ts +8 -10
- package/rules/naming-convention.d.ts +3 -4
- package/rules/{avoid-duplicate-fields.d.ts → no-duplicate-fields.d.ts} +0 -0
- package/rules/no-root-type.d.ts +1 -1
- 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 +2 -3
- package/rules/require-id-when-available.d.ts +3 -3
- package/rules/selection-set-depth.d.ts +3 -3
- package/rules/strict-id-in-types.d.ts +6 -8
- package/types.d.ts +9 -5
- package/configs/all.d.ts +0 -104
- package/configs/recommended.d.ts +0 -72
- package/docs/rules/avoid-operation-name-prefix.md +0 -50
- package/docs/rules/avoid-typename-prefix.md +0 -37
- 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/configs/recommended.d.ts
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
export declare const recommendedConfig: {
|
2
|
-
parser: string;
|
3
|
-
plugins: string[];
|
4
|
-
rules: {
|
5
|
-
'@graphql-eslint/avoid-typename-prefix': string;
|
6
|
-
'@graphql-eslint/executable-definitions': string;
|
7
|
-
'@graphql-eslint/fields-on-correct-type': string;
|
8
|
-
'@graphql-eslint/fragments-on-composite-type': string;
|
9
|
-
'@graphql-eslint/known-argument-names': string;
|
10
|
-
'@graphql-eslint/known-directives': string;
|
11
|
-
'@graphql-eslint/known-fragment-names': string;
|
12
|
-
'@graphql-eslint/known-type-names': string;
|
13
|
-
'@graphql-eslint/lone-anonymous-operation': string;
|
14
|
-
'@graphql-eslint/lone-schema-definition': 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
|
-
})[];
|
44
|
-
'@graphql-eslint/no-anonymous-operations': string;
|
45
|
-
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': string;
|
46
|
-
'@graphql-eslint/no-fragment-cycles': string;
|
47
|
-
'@graphql-eslint/no-operation-name-suffix': string;
|
48
|
-
'@graphql-eslint/no-undefined-variables': string;
|
49
|
-
'@graphql-eslint/no-unused-fragments': string;
|
50
|
-
'@graphql-eslint/no-unused-variables': string;
|
51
|
-
'@graphql-eslint/one-field-subscriptions': string;
|
52
|
-
'@graphql-eslint/overlapping-fields-can-be-merged': string;
|
53
|
-
'@graphql-eslint/possible-fragment-spread': string;
|
54
|
-
'@graphql-eslint/possible-type-extension': string;
|
55
|
-
'@graphql-eslint/provided-required-arguments': string;
|
56
|
-
'@graphql-eslint/require-deprecation-reason': string;
|
57
|
-
'@graphql-eslint/scalar-leafs': string;
|
58
|
-
'@graphql-eslint/strict-id-in-types': string;
|
59
|
-
'@graphql-eslint/unique-argument-names': string;
|
60
|
-
'@graphql-eslint/unique-directive-names': string;
|
61
|
-
'@graphql-eslint/unique-directive-names-per-location': string;
|
62
|
-
'@graphql-eslint/unique-enum-value-names': string;
|
63
|
-
'@graphql-eslint/unique-field-definition-names': string;
|
64
|
-
'@graphql-eslint/unique-input-field-names': string;
|
65
|
-
'@graphql-eslint/unique-operation-types': string;
|
66
|
-
'@graphql-eslint/unique-type-names': string;
|
67
|
-
'@graphql-eslint/unique-variable-names': string;
|
68
|
-
'@graphql-eslint/value-literals-of-correct-type': string;
|
69
|
-
'@graphql-eslint/variables-are-input-types': string;
|
70
|
-
'@graphql-eslint/variables-in-allowed-position': string;
|
71
|
-
};
|
72
|
-
};
|
@@ -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,37 +0,0 @@
|
|
1
|
-
# `avoid-typename-prefix`
|
2
|
-
|
3
|
-
✅ The `"extends": "plugin:@graphql-eslint/recommended"` property in a configuration file enables this rule.
|
4
|
-
|
5
|
-
- Category: `Best Practices`
|
6
|
-
- Rule name: `@graphql-eslint/avoid-typename-prefix`
|
7
|
-
- Requires GraphQL Schema: `false` [ℹ️](../../README.md#extended-linting-rules-with-graphql-schema)
|
8
|
-
- Requires GraphQL Operations: `false` [ℹ️](../../README.md#extended-linting-rules-with-siblings-operations)
|
9
|
-
|
10
|
-
Enforces users to avoid using the type name in a field name while defining your schema.
|
11
|
-
|
12
|
-
## Usage Examples
|
13
|
-
|
14
|
-
### Incorrect
|
15
|
-
|
16
|
-
```graphql
|
17
|
-
# eslint @graphql-eslint/avoid-typename-prefix: 'error'
|
18
|
-
|
19
|
-
type User {
|
20
|
-
userId: ID!
|
21
|
-
}
|
22
|
-
```
|
23
|
-
|
24
|
-
### Correct
|
25
|
-
|
26
|
-
```graphql
|
27
|
-
# eslint @graphql-eslint/avoid-typename-prefix: 'error'
|
28
|
-
|
29
|
-
type User {
|
30
|
-
id: ID!
|
31
|
-
}
|
32
|
-
```
|
33
|
-
|
34
|
-
## Resources
|
35
|
-
|
36
|
-
- [Rule source](../../packages/plugin/src/rules/avoid-typename-prefix.ts)
|
37
|
-
- [Test source](../../packages/plugin/tests/avoid-typename-prefix.spec.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)
|