@graphql-eslint/eslint-plugin 2.4.0-alpha-60dfe26.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/custom-rules.md +1 -1
- package/docs/rules/alphabetize.md +35 -10
- package/docs/rules/avoid-duplicate-fields.md +9 -7
- package/docs/rules/description-style.md +2 -2
- package/docs/rules/fragments-on-composite-type.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/one-field-subscriptions.md +2 -2
- package/docs/rules/possible-fragment-spread.md +2 -2
- package/docs/rules/possible-type-extension.md +2 -2
- package/docs/rules/strict-id-in-types.md +4 -4
- package/docs/rules/unique-directive-names-per-location.md +2 -2
- package/docs/rules/value-literals-of-correct-type.md +2 -2
- package/estree-parser/converter.d.ts +3 -2
- package/index.js +484 -440
- package/index.mjs +484 -440
- package/package.json +1 -1
- package/rules/avoid-duplicate-fields.d.ts +1 -1
- package/rules/index.d.ts +117 -15
- package/rules/naming-convention.d.ts +32 -25
- package/testkit.d.ts +6 -3
- package/types.d.ts +1 -0
- package/utils.d.ts +6 -8
package/package.json
CHANGED
package/rules/index.d.ts
CHANGED
@@ -6,7 +6,7 @@ export declare const rules: {
|
|
6
6
|
variables?: "OperationDefinition"[];
|
7
7
|
arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
|
8
8
|
}], false>;
|
9
|
-
'avoid-duplicate-fields': import("..").GraphQLESLintRule<[], false>;
|
9
|
+
'avoid-duplicate-fields': import("..").GraphQLESLintRule<any[], false>;
|
10
10
|
'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
|
11
11
|
'avoid-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
|
12
12
|
'avoid-typename-prefix': import("..").GraphQLESLintRule<any[], 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>;
|
@@ -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;
|
package/testkit.d.ts
CHANGED
@@ -6,6 +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?: string;
|
9
10
|
options?: Options;
|
10
11
|
parserOptions?: ParserOptions;
|
11
12
|
};
|
@@ -13,8 +14,11 @@ export declare type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
|
|
13
14
|
errors: number | Array<RuleTester.TestCaseError | string>;
|
14
15
|
output?: string | null;
|
15
16
|
};
|
16
|
-
declare
|
17
|
-
|
17
|
+
export declare class GraphQLRuleTester extends RuleTester {
|
18
|
+
config: {
|
19
|
+
parser: string;
|
20
|
+
parserOptions: ParserOptions;
|
21
|
+
};
|
18
22
|
constructor(parserOptions?: ParserOptions);
|
19
23
|
fromMockFile(path: string): string;
|
20
24
|
runGraphQLTests<Config>(name: string, rule: GraphQLESLintRule, tests: {
|
@@ -22,4 +26,3 @@ export declare class GraphQLRuleTester extends GraphQLRuleTester_base {
|
|
22
26
|
invalid: GraphQLInvalidTestCase<Config>[];
|
23
27
|
}): void;
|
24
28
|
}
|
25
|
-
export {};
|
package/types.d.ts
CHANGED
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",
|
@@ -31,7 +27,9 @@ export declare enum CaseStyle {
|
|
31
27
|
upperCase = "UPPER_CASE",
|
32
28
|
kebabCase = "kebab-case"
|
33
29
|
}
|
34
|
-
export declare const pascalCase: (str: string) => string;
|
35
30
|
export declare const camelCase: (str: string) => string;
|
36
31
|
export declare const convertCase: (style: CaseStyle, str: string) => string;
|
37
|
-
export {
|
32
|
+
export declare function getLocation(loc: Partial<AST.SourceLocation>, fieldName?: string, offset?: {
|
33
|
+
offsetStart?: number;
|
34
|
+
offsetEnd?: number;
|
35
|
+
}): AST.SourceLocation;
|