@graphql-eslint/eslint-plugin 2.4.0-alpha-0a1c477.0 → 3.0.0-alpha-5388f29.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/no-deprecated.md +2 -2
- package/docs/rules/strict-id-in-types.md +4 -4
- package/estree-parser/converter.d.ts +3 -2
- package/index.js +256 -261
- package/index.mjs +256 -261
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +5 -6
- package/rules/index.d.ts +122 -20
- package/rules/naming-convention.d.ts +32 -25
- package/rules/require-description.d.ts +1 -2
- package/testkit.d.ts +1 -1
- package/utils.d.ts +2 -7
package/package.json
CHANGED
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: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
|
8
7
|
declare type AlphabetizeConfig = [
|
9
8
|
{
|
10
9
|
fields?: typeof fieldsEnum;
|
package/rules/index.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
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
9
|
'avoid-duplicate-fields': import("..").GraphQLESLintRule<any[], false>;
|
10
10
|
'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
|
@@ -39,20 +39,122 @@ export declare const rules: {
|
|
39
39
|
};
|
40
40
|
}], false>;
|
41
41
|
'naming-convention': import("..").GraphQLESLintRule<[{
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
42
|
+
allowLeadingUnderscore?: boolean;
|
43
|
+
allowTrailingUnderscore?: boolean;
|
44
|
+
types?: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
45
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
46
|
+
suffix?: string;
|
47
|
+
prefix?: string;
|
48
|
+
forbiddenPrefixes?: string[];
|
49
|
+
forbiddenSuffixes?: string[];
|
50
|
+
};
|
51
|
+
fields?: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
52
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
53
|
+
suffix?: string;
|
54
|
+
prefix?: string;
|
55
|
+
forbiddenPrefixes?: string[];
|
56
|
+
forbiddenSuffixes?: string[];
|
57
|
+
};
|
58
|
+
overrides?: {
|
59
|
+
[x: `OperationDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
60
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
61
|
+
suffix?: string;
|
62
|
+
prefix?: string;
|
63
|
+
forbiddenPrefixes?: string[];
|
64
|
+
forbiddenSuffixes?: string[];
|
65
|
+
};
|
66
|
+
[x: `VariableDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
67
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
68
|
+
suffix?: string;
|
69
|
+
prefix?: string;
|
70
|
+
forbiddenPrefixes?: string[];
|
71
|
+
forbiddenSuffixes?: string[];
|
72
|
+
};
|
73
|
+
[x: `Argument${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
74
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
75
|
+
suffix?: string;
|
76
|
+
prefix?: string;
|
77
|
+
forbiddenPrefixes?: string[];
|
78
|
+
forbiddenSuffixes?: string[];
|
79
|
+
};
|
80
|
+
[x: `FragmentDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
81
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
82
|
+
suffix?: string;
|
83
|
+
prefix?: string;
|
84
|
+
forbiddenPrefixes?: string[];
|
85
|
+
forbiddenSuffixes?: string[];
|
86
|
+
};
|
87
|
+
[x: `ScalarTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
88
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
89
|
+
suffix?: string;
|
90
|
+
prefix?: string;
|
91
|
+
forbiddenPrefixes?: string[];
|
92
|
+
forbiddenSuffixes?: string[];
|
93
|
+
};
|
94
|
+
[x: `ObjectTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
95
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
96
|
+
suffix?: string;
|
97
|
+
prefix?: string;
|
98
|
+
forbiddenPrefixes?: string[];
|
99
|
+
forbiddenSuffixes?: string[];
|
100
|
+
};
|
101
|
+
[x: `FieldDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
102
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
103
|
+
suffix?: string;
|
104
|
+
prefix?: string;
|
105
|
+
forbiddenPrefixes?: string[];
|
106
|
+
forbiddenSuffixes?: string[];
|
107
|
+
};
|
108
|
+
[x: `InputValueDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
109
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
110
|
+
suffix?: string;
|
111
|
+
prefix?: string;
|
112
|
+
forbiddenPrefixes?: string[];
|
113
|
+
forbiddenSuffixes?: string[];
|
114
|
+
};
|
115
|
+
[x: `InterfaceTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
116
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
117
|
+
suffix?: string;
|
118
|
+
prefix?: string;
|
119
|
+
forbiddenPrefixes?: string[];
|
120
|
+
forbiddenSuffixes?: string[];
|
121
|
+
};
|
122
|
+
[x: `UnionTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
123
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
124
|
+
suffix?: string;
|
125
|
+
prefix?: string;
|
126
|
+
forbiddenPrefixes?: string[];
|
127
|
+
forbiddenSuffixes?: string[];
|
128
|
+
};
|
129
|
+
[x: `EnumTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
130
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
131
|
+
suffix?: string;
|
132
|
+
prefix?: string;
|
133
|
+
forbiddenPrefixes?: string[];
|
134
|
+
forbiddenSuffixes?: string[];
|
135
|
+
};
|
136
|
+
[x: `EnumValueDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
137
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
138
|
+
suffix?: string;
|
139
|
+
prefix?: string;
|
140
|
+
forbiddenPrefixes?: string[];
|
141
|
+
forbiddenSuffixes?: string[];
|
142
|
+
};
|
143
|
+
[x: `InputObjectTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
144
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
145
|
+
suffix?: string;
|
146
|
+
prefix?: string;
|
147
|
+
forbiddenPrefixes?: string[];
|
148
|
+
forbiddenSuffixes?: string[];
|
149
|
+
};
|
150
|
+
[x: `DirectiveDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
151
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
152
|
+
suffix?: string;
|
153
|
+
prefix?: string;
|
154
|
+
forbiddenPrefixes?: string[];
|
155
|
+
forbiddenSuffixes?: string[];
|
156
|
+
};
|
157
|
+
};
|
56
158
|
}], false>;
|
57
159
|
'no-anonymous-operations': import("..").GraphQLESLintRule<any[], false>;
|
58
160
|
'no-case-insensitive-enum-values-duplicates': import("..").GraphQLESLintRule<any[], false>;
|
@@ -66,7 +168,7 @@ export declare const rules: {
|
|
66
168
|
}], false>;
|
67
169
|
'require-deprecation-reason': import("..").GraphQLESLintRule<any[], false>;
|
68
170
|
'require-description': import("..").GraphQLESLintRule<[{
|
69
|
-
on:
|
171
|
+
on: ("SchemaDefinition" | "ObjectTypeDefinition" | "FieldDefinition" | "InputValueDefinition" | "InterfaceTypeDefinition" | "UnionTypeDefinition" | "EnumTypeDefinition" | "EnumValueDefinition" | "InputObjectTypeDefinition" | "DirectiveDefinition")[];
|
70
172
|
}], false>;
|
71
173
|
'require-field-of-type-query-in-mutation-result': import("..").GraphQLESLintRule<any[], false>;
|
72
174
|
'require-id-when-available': import("..").GraphQLESLintRule<[{
|
@@ -1,31 +1,38 @@
|
|
1
|
-
import { Kind } from 'graphql';
|
2
1
|
import { GraphQLESLintRule } from '../types';
|
3
|
-
declare const
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
declare const KindToDisplayName: {
|
3
|
+
ObjectTypeDefinition: string;
|
4
|
+
InterfaceTypeDefinition: string;
|
5
|
+
EnumTypeDefinition: string;
|
6
|
+
ScalarTypeDefinition: string;
|
7
|
+
InputObjectTypeDefinition: string;
|
8
|
+
UnionTypeDefinition: string;
|
9
|
+
FieldDefinition: string;
|
10
|
+
InputValueDefinition: string;
|
11
|
+
VariableDefinition: string;
|
12
|
+
Argument: string;
|
13
|
+
DirectiveDefinition: string;
|
14
|
+
EnumValueDefinition: string;
|
15
|
+
OperationDefinition: string;
|
16
|
+
FragmentDefinition: string;
|
17
|
+
};
|
18
|
+
declare type AllowedKind = keyof typeof KindToDisplayName;
|
19
|
+
declare type AllowedStyle = 'camelCase' | 'PascalCase' | 'snake_case' | 'UPPER_CASE';
|
20
|
+
declare type PropertySchema = {
|
21
|
+
style?: AllowedStyle;
|
7
22
|
suffix?: string;
|
8
23
|
prefix?: string;
|
9
24
|
forbiddenPrefixes?: string[];
|
10
25
|
forbiddenSuffixes?: string[];
|
11
|
-
}
|
12
|
-
declare type
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
[
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
[Kind.UNION_TYPE_DEFINITION]?: ValidNaming | PropertySchema;
|
24
|
-
[Kind.SCALAR_TYPE_DEFINITION]?: ValidNaming | PropertySchema;
|
25
|
-
[Kind.OPERATION_DEFINITION]?: ValidNaming | PropertySchema;
|
26
|
-
[Kind.FRAGMENT_DEFINITION]?: ValidNaming | PropertySchema;
|
27
|
-
[Kind.INPUT_OBJECT_TYPE_DEFINITION]?: ValidNaming | PropertySchema;
|
28
|
-
}
|
29
|
-
];
|
30
|
-
declare const rule: GraphQLESLintRule<NamingConventionRuleConfig>;
|
26
|
+
};
|
27
|
+
declare type Options = AllowedStyle | PropertySchema;
|
28
|
+
declare type NamingConventionRuleConfig = {
|
29
|
+
allowLeadingUnderscore?: boolean;
|
30
|
+
allowTrailingUnderscore?: boolean;
|
31
|
+
types?: Options;
|
32
|
+
fields?: Options;
|
33
|
+
overrides?: {
|
34
|
+
[key in `${AllowedKind}${string}`]?: Options;
|
35
|
+
};
|
36
|
+
};
|
37
|
+
declare const rule: GraphQLESLintRule<[NamingConventionRuleConfig]>;
|
31
38
|
export default rule;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../types';
|
2
|
-
|
3
|
-
declare const DESCRIBABLE_NODES: Kind[];
|
2
|
+
declare const DESCRIBABLE_NODES: ("SchemaDefinition" | "ObjectTypeDefinition" | "FieldDefinition" | "InputValueDefinition" | "InterfaceTypeDefinition" | "UnionTypeDefinition" | "EnumTypeDefinition" | "EnumValueDefinition" | "InputObjectTypeDefinition" | "DirectiveDefinition")[];
|
4
3
|
declare type RequireDescriptionRuleConfig = [{
|
5
4
|
on: typeof DESCRIBABLE_NODES;
|
6
5
|
}];
|
package/testkit.d.ts
CHANGED
@@ -6,7 +6,7 @@ export declare type GraphQLESLintRuleListener<WithTypeInfo extends boolean = fal
|
|
6
6
|
[K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
|
7
7
|
} & Record<string, any>;
|
8
8
|
export declare type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & {
|
9
|
-
name
|
9
|
+
name?: string;
|
10
10
|
options?: Options;
|
11
11
|
parserOptions?: ParserOptions;
|
12
12
|
};
|
package/utils.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
import { GraphQLSchema
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
2
2
|
import { AST } from 'eslint';
|
3
3
|
import { Source as LoaderSource } from '@graphql-tools/utils';
|
4
4
|
import { GraphQLESLintRuleContext } from './types';
|
5
5
|
import { SiblingOperations } from './sibling-operations';
|
6
6
|
import { UsedFields, ReachableTypes } from './graphql-ast';
|
7
|
-
import { GraphQLESTreeNode } from './estree-parser';
|
8
7
|
export declare function requireSiblingsOperations(ruleName: string, context: GraphQLESLintRuleContext): SiblingOperations | never;
|
9
8
|
export declare function requireGraphQLSchemaFromContext(ruleName: string, context: GraphQLESLintRuleContext): GraphQLSchema | never;
|
10
9
|
export declare function requireReachableTypesFromContext(ruleName: string, context: GraphQLESLintRuleContext): ReachableTypes | never;
|
@@ -20,10 +19,7 @@ export declare const normalizePath: (path: string) => string;
|
|
20
19
|
export declare const getOnDiskFilepath: (filepath: string) => string;
|
21
20
|
export declare const getTypeName: (node: any) => any;
|
22
21
|
export declare const loaderCache: Record<string, LoaderSource[]>;
|
23
|
-
declare
|
24
|
-
export declare const isQueryType: (node: ObjectTypeNode) => boolean;
|
25
|
-
export declare const isMutationType: (node: ObjectTypeNode) => boolean;
|
26
|
-
export declare const isSubscriptionType: (node: ObjectTypeNode) => boolean;
|
22
|
+
export declare const TYPES_KINDS: ("ScalarTypeDefinition" | "ObjectTypeDefinition" | "InterfaceTypeDefinition" | "UnionTypeDefinition" | "EnumTypeDefinition" | "InputObjectTypeDefinition")[];
|
27
23
|
export declare enum CaseStyle {
|
28
24
|
camelCase = "camelCase",
|
29
25
|
pascalCase = "PascalCase",
|
@@ -37,4 +33,3 @@ export declare function getLocation(loc: Partial<AST.SourceLocation>, fieldName?
|
|
37
33
|
offsetStart?: number;
|
38
34
|
offsetEnd?: number;
|
39
35
|
}): AST.SourceLocation;
|
40
|
-
export {};
|