@graphql-eslint/eslint-plugin 2.5.0-alpha-e34c5d6.0 → 3.0.0-alpha-3168a9b.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/strict-id-in-types.md +4 -4
- package/index.js +252 -257
- package/index.mjs +252 -257
- package/package.json +7 -7
- package/rules/index.d.ts +117 -15
- package/rules/naming-convention.d.ts +32 -25
- package/utils.d.ts +2 -7
package/package.json
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.0-alpha-3168a9b.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"
|
7
7
|
},
|
8
8
|
"dependencies": {
|
9
9
|
"@babel/code-frame": "7.16.0",
|
10
|
-
"@graphql-tools/code-file-loader": "
|
11
|
-
"@graphql-tools/graphql-tag-pluck": "
|
12
|
-
"@graphql-tools/import": "
|
13
|
-
"@graphql-tools/utils": "
|
14
|
-
"graphql-config": "
|
10
|
+
"@graphql-tools/code-file-loader": "7.2.2",
|
11
|
+
"@graphql-tools/graphql-tag-pluck": "7.1.3",
|
12
|
+
"@graphql-tools/import": "6.6.1",
|
13
|
+
"@graphql-tools/utils": "8.5.3",
|
14
|
+
"graphql-config": "4.1.0",
|
15
15
|
"graphql-depth-limit": "1.1.0",
|
16
|
-
"lodash.lowercase": "
|
16
|
+
"lodash.lowercase": "4.3.0"
|
17
17
|
},
|
18
18
|
"repository": "https://github.com/dotansimha/graphql-eslint",
|
19
19
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
package/rules/index.d.ts
CHANGED
@@ -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>;
|
@@ -60,7 +162,7 @@ export declare const rules: {
|
|
60
162
|
'no-hashtag-description': import("..").GraphQLESLintRule<any[], false>;
|
61
163
|
'no-operation-name-suffix': import("..").GraphQLESLintRule<any[], false>;
|
62
164
|
'no-root-type': import("..").GraphQLESLintRule<[{
|
63
|
-
disallow: ("
|
165
|
+
disallow: ("query" | "mutation" | "subscription")[];
|
64
166
|
}], false>;
|
65
167
|
'no-unreachable-types': import("..").GraphQLESLintRule<any[], false>;
|
66
168
|
'no-unused-fields': 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/utils.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
import { GraphQLSchema, Source,
|
1
|
+
import { GraphQLSchema, Source, Kind } 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: Kind[];
|
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 {};
|