@graphql-eslint/eslint-plugin 3.2.0-alpha-001cd75.0 → 3.2.0-alpha-4ca7218.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/docs/rules/known-fragment-names.md +9 -30
- package/docs/rules/no-undefined-variables.md +1 -1
- package/docs/rules/no-unused-variables.md +1 -1
- package/index.js +211 -184
- package/index.mjs +213 -186
- package/package.json +8 -2
- package/rules/graphql-js-validation.d.ts +2 -5
- package/rules/index.d.ts +129 -2
- package/rules/match-document-filename.d.ts +3 -3
- package/rules/naming-convention.d.ts +1 -1
- package/types.d.ts +2 -2
- package/utils.d.ts +7 -1
package/package.json
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "3.2.0-alpha-
|
3
|
+
"version": "3.2.0-alpha-4ca7218.0",
|
4
|
+
"description": "GraphQL plugin for ESLint",
|
4
5
|
"sideEffects": false,
|
5
6
|
"peerDependencies": {
|
6
7
|
"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"
|
@@ -9,13 +10,18 @@
|
|
9
10
|
"@babel/code-frame": "7.16.0",
|
10
11
|
"@graphql-tools/code-file-loader": "7.2.3",
|
11
12
|
"@graphql-tools/graphql-tag-pluck": "7.1.4",
|
12
|
-
"@graphql-tools/import": "6.6.2",
|
13
13
|
"@graphql-tools/utils": "8.5.4",
|
14
14
|
"graphql-config": "4.1.0",
|
15
15
|
"graphql-depth-limit": "1.1.0",
|
16
16
|
"lodash.lowercase": "4.3.0"
|
17
17
|
},
|
18
18
|
"repository": "https://github.com/dotansimha/graphql-eslint",
|
19
|
+
"keywords": [
|
20
|
+
"eslint",
|
21
|
+
"eslintplugin",
|
22
|
+
"eslint-plugin",
|
23
|
+
"graphql"
|
24
|
+
],
|
19
25
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
20
26
|
"license": "MIT",
|
21
27
|
"main": "index.js",
|
@@ -1,5 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
import { GraphQLESTreeNode } from '../estree-parser';
|
4
|
-
export declare function validateDoc(sourceNode: GraphQLESTreeNode<ASTNode>, context: GraphQLESLintRuleContext, schema: GraphQLSchema | null, documentNode: DocumentNode, rules: ReadonlyArray<ValidationRule>, ruleName?: string | null): void;
|
5
|
-
export declare const GRAPHQL_JS_VALIDATIONS: Record<string, GraphQLESLintRule<any[], false>>;
|
1
|
+
import { GraphQLESLintRule } from '../types';
|
2
|
+
export declare const GRAPHQL_JS_VALIDATIONS: Record<string, GraphQLESLintRule>;
|
package/rules/index.d.ts
CHANGED
@@ -15,8 +15,135 @@ export declare const rules: {
|
|
15
15
|
checkQueries?: boolean;
|
16
16
|
checkMutations?: boolean;
|
17
17
|
}], false>;
|
18
|
-
'match-document-filename': import("..").GraphQLESLintRule<[
|
19
|
-
|
18
|
+
'match-document-filename': import("..").GraphQLESLintRule<[{
|
19
|
+
fileExtension?: ".gql" | ".graphql";
|
20
|
+
query?: import("../utils").CaseStyle | {
|
21
|
+
style: import("../utils").CaseStyle;
|
22
|
+
suffix: string;
|
23
|
+
};
|
24
|
+
mutation?: import("../utils").CaseStyle | {
|
25
|
+
style: import("../utils").CaseStyle;
|
26
|
+
suffix: string;
|
27
|
+
};
|
28
|
+
subscription?: import("../utils").CaseStyle | {
|
29
|
+
style: import("../utils").CaseStyle;
|
30
|
+
suffix: string;
|
31
|
+
};
|
32
|
+
fragment?: import("../utils").CaseStyle | {
|
33
|
+
style: import("../utils").CaseStyle;
|
34
|
+
suffix: string;
|
35
|
+
};
|
36
|
+
}], false>;
|
37
|
+
'naming-convention': import("..").GraphQLESLintRule<[{
|
38
|
+
allowLeadingUnderscore?: boolean;
|
39
|
+
allowTrailingUnderscore?: boolean;
|
40
|
+
types?: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
41
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
42
|
+
suffix?: string;
|
43
|
+
prefix?: string;
|
44
|
+
forbiddenPrefixes?: string[];
|
45
|
+
forbiddenSuffixes?: string[];
|
46
|
+
};
|
47
|
+
} & {
|
48
|
+
[x: `OperationDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
49
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
50
|
+
suffix?: string;
|
51
|
+
prefix?: string;
|
52
|
+
forbiddenPrefixes?: string[];
|
53
|
+
forbiddenSuffixes?: string[];
|
54
|
+
};
|
55
|
+
[x: `VariableDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
56
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
57
|
+
suffix?: string;
|
58
|
+
prefix?: string;
|
59
|
+
forbiddenPrefixes?: string[];
|
60
|
+
forbiddenSuffixes?: string[];
|
61
|
+
};
|
62
|
+
[x: `Argument${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
63
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
64
|
+
suffix?: string;
|
65
|
+
prefix?: string;
|
66
|
+
forbiddenPrefixes?: string[];
|
67
|
+
forbiddenSuffixes?: string[];
|
68
|
+
};
|
69
|
+
[x: `FragmentDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
70
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
71
|
+
suffix?: string;
|
72
|
+
prefix?: string;
|
73
|
+
forbiddenPrefixes?: string[];
|
74
|
+
forbiddenSuffixes?: string[];
|
75
|
+
};
|
76
|
+
[x: `ScalarTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
77
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
78
|
+
suffix?: string;
|
79
|
+
prefix?: string;
|
80
|
+
forbiddenPrefixes?: string[];
|
81
|
+
forbiddenSuffixes?: string[];
|
82
|
+
};
|
83
|
+
[x: `ObjectTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
84
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
85
|
+
suffix?: string;
|
86
|
+
prefix?: string;
|
87
|
+
forbiddenPrefixes?: string[];
|
88
|
+
forbiddenSuffixes?: string[];
|
89
|
+
};
|
90
|
+
[x: `FieldDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
91
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
92
|
+
suffix?: string;
|
93
|
+
prefix?: string;
|
94
|
+
forbiddenPrefixes?: string[];
|
95
|
+
forbiddenSuffixes?: string[];
|
96
|
+
};
|
97
|
+
[x: `InputValueDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
98
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
99
|
+
suffix?: string;
|
100
|
+
prefix?: string;
|
101
|
+
forbiddenPrefixes?: string[];
|
102
|
+
forbiddenSuffixes?: string[];
|
103
|
+
};
|
104
|
+
[x: `InterfaceTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
105
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
106
|
+
suffix?: string;
|
107
|
+
prefix?: string;
|
108
|
+
forbiddenPrefixes?: string[];
|
109
|
+
forbiddenSuffixes?: string[];
|
110
|
+
};
|
111
|
+
[x: `UnionTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
112
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
113
|
+
suffix?: string;
|
114
|
+
prefix?: string;
|
115
|
+
forbiddenPrefixes?: string[];
|
116
|
+
forbiddenSuffixes?: string[];
|
117
|
+
};
|
118
|
+
[x: `EnumTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
119
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
120
|
+
suffix?: string;
|
121
|
+
prefix?: string;
|
122
|
+
forbiddenPrefixes?: string[];
|
123
|
+
forbiddenSuffixes?: string[];
|
124
|
+
};
|
125
|
+
[x: `EnumValueDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
126
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
127
|
+
suffix?: string;
|
128
|
+
prefix?: string;
|
129
|
+
forbiddenPrefixes?: string[];
|
130
|
+
forbiddenSuffixes?: string[];
|
131
|
+
};
|
132
|
+
[x: `InputObjectTypeDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
133
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
134
|
+
suffix?: string;
|
135
|
+
prefix?: string;
|
136
|
+
forbiddenPrefixes?: string[];
|
137
|
+
forbiddenSuffixes?: string[];
|
138
|
+
};
|
139
|
+
[x: `DirectiveDefinition${string}`]: ("PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case") | {
|
140
|
+
style?: "PascalCase" | "camelCase" | "UPPER_CASE" | "snake_case";
|
141
|
+
suffix?: string;
|
142
|
+
prefix?: string;
|
143
|
+
forbiddenPrefixes?: string[];
|
144
|
+
forbiddenSuffixes?: string[];
|
145
|
+
};
|
146
|
+
}], false>;
|
20
147
|
'no-anonymous-operations': import("..").GraphQLESLintRule<any[], false>;
|
21
148
|
'no-case-insensitive-enum-values-duplicates': import("..").GraphQLESLintRule<any[], false>;
|
22
149
|
'no-deprecated': import("..").GraphQLESLintRule<[], true>;
|
@@ -2,10 +2,10 @@ import { CaseStyle } from '../utils';
|
|
2
2
|
import { GraphQLESLintRule } from '../types';
|
3
3
|
declare const ACCEPTED_EXTENSIONS: ['.gql', '.graphql'];
|
4
4
|
declare type PropertySchema = {
|
5
|
-
style
|
6
|
-
suffix
|
5
|
+
style: CaseStyle;
|
6
|
+
suffix: string;
|
7
7
|
};
|
8
|
-
|
8
|
+
declare type MatchDocumentFilenameRuleConfig = {
|
9
9
|
fileExtension?: typeof ACCEPTED_EXTENSIONS[number];
|
10
10
|
query?: CaseStyle | PropertySchema;
|
11
11
|
mutation?: CaseStyle | PropertySchema;
|
@@ -25,7 +25,7 @@ declare type PropertySchema = {
|
|
25
25
|
forbiddenSuffixes?: string[];
|
26
26
|
};
|
27
27
|
declare type Options = AllowedStyle | PropertySchema;
|
28
|
-
|
28
|
+
declare type NamingConventionRuleConfig = {
|
29
29
|
allowLeadingUnderscore?: boolean;
|
30
30
|
allowTrailingUnderscore?: boolean;
|
31
31
|
types?: Options;
|
package/types.d.ts
CHANGED
@@ -49,8 +49,8 @@ export declare type CategoryType = 'Schema' | 'Operations';
|
|
49
49
|
export declare type RuleDocsInfo<T> = {
|
50
50
|
docs: Omit<Rule.RuleMetaData['docs'], 'category'> & {
|
51
51
|
category: CategoryType | CategoryType[];
|
52
|
-
requiresSchema?:
|
53
|
-
requiresSiblings?:
|
52
|
+
requiresSchema?: true;
|
53
|
+
requiresSiblings?: true;
|
54
54
|
examples?: {
|
55
55
|
title: string;
|
56
56
|
code: string;
|
package/utils.d.ts
CHANGED
@@ -20,7 +20,13 @@ 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
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
|
-
export declare
|
23
|
+
export declare enum CaseStyle {
|
24
|
+
camelCase = "camelCase",
|
25
|
+
pascalCase = "PascalCase",
|
26
|
+
snakeCase = "snake_case",
|
27
|
+
upperCase = "UPPER_CASE",
|
28
|
+
kebabCase = "kebab-case"
|
29
|
+
}
|
24
30
|
export declare const camelCase: (str: string) => string;
|
25
31
|
export declare const convertCase: (style: CaseStyle, str: string) => string;
|
26
32
|
export declare function getLocation(loc: Partial<AST.SourceLocation>, fieldName?: string, offset?: {
|