@graphql-eslint/eslint-plugin 3.14.0-alpha-20221221133443-5be7fc6 → 3.14.0-alpha-20221222012949-5caade4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +309 -0
- package/cjs/cache.js +30 -0
- package/cjs/configs/base.js +7 -0
- package/cjs/configs/index.js +16 -0
- package/cjs/configs/operations-all.js +31 -0
- package/cjs/configs/operations-recommended.js +56 -0
- package/cjs/configs/relay.js +12 -0
- package/cjs/configs/schema-all.js +23 -0
- package/cjs/configs/schema-recommended.js +52 -0
- package/cjs/documents.js +149 -0
- package/cjs/estree-converter/converter.js +62 -0
- package/cjs/estree-converter/index.js +6 -0
- package/cjs/estree-converter/types.js +2 -0
- package/cjs/estree-converter/utils.js +109 -0
- package/cjs/graphql-config.js +55 -0
- package/cjs/index.js +17 -0
- package/cjs/parser.js +61 -0
- package/cjs/processor.js +78 -0
- package/cjs/rules/alphabetize.js +348 -0
- package/cjs/rules/description-style.js +78 -0
- package/cjs/rules/graphql-js-validation.js +499 -0
- package/cjs/rules/index.js +68 -0
- package/cjs/rules/input-name.js +136 -0
- package/cjs/rules/lone-executable-definition.js +88 -0
- package/cjs/rules/match-document-filename.js +235 -0
- package/cjs/rules/naming-convention.js +310 -0
- package/cjs/rules/no-anonymous-operations.js +67 -0
- package/cjs/rules/no-case-insensitive-enum-values-duplicates.js +61 -0
- package/cjs/rules/no-deprecated.js +124 -0
- package/cjs/rules/no-duplicate-fields.js +112 -0
- package/cjs/rules/no-hashtag-description.js +89 -0
- package/cjs/rules/no-root-type.js +86 -0
- package/cjs/rules/no-scalar-result-type-on-mutation.js +66 -0
- package/cjs/rules/no-typename-prefix.js +65 -0
- package/cjs/rules/no-unreachable-types.js +158 -0
- package/cjs/rules/no-unused-fields.js +130 -0
- package/cjs/rules/relay-arguments.js +121 -0
- package/cjs/rules/relay-connection-types.js +107 -0
- package/cjs/rules/relay-edge-types.js +189 -0
- package/cjs/rules/relay-page-info.js +100 -0
- package/cjs/rules/require-deprecation-date.js +123 -0
- package/cjs/rules/require-deprecation-reason.js +56 -0
- package/cjs/rules/require-description.js +193 -0
- package/cjs/rules/require-field-of-type-query-in-mutation-result.js +72 -0
- package/cjs/rules/require-id-when-available.js +199 -0
- package/cjs/rules/selection-set-depth.js +135 -0
- package/cjs/rules/strict-id-in-types.js +162 -0
- package/cjs/rules/unique-fragment-name.js +90 -0
- package/cjs/rules/unique-operation-name.js +65 -0
- package/cjs/schema.js +42 -0
- package/cjs/testkit.js +183 -0
- package/cjs/types.js +2 -0
- package/cjs/utils.js +96 -0
- package/docs/README.md +82 -0
- package/docs/custom-rules.md +184 -0
- package/docs/deprecated-rules.md +24 -0
- package/docs/parser-options.md +95 -0
- package/docs/parser.md +67 -0
- package/docs/rules/alphabetize.md +194 -0
- package/docs/rules/description-style.md +57 -0
- package/docs/rules/executable-definitions.md +20 -0
- package/docs/rules/fields-on-correct-type.md +23 -0
- package/docs/rules/fragments-on-composite-type.md +20 -0
- package/docs/rules/input-name.md +80 -0
- package/docs/rules/known-argument-names.md +23 -0
- package/docs/rules/known-directives.md +48 -0
- package/docs/rules/known-fragment-names.md +72 -0
- package/docs/rules/known-type-names.md +24 -0
- package/docs/rules/lone-anonymous-operation.md +20 -0
- package/docs/rules/lone-executable-definition.md +59 -0
- package/docs/rules/lone-schema-definition.md +19 -0
- package/docs/rules/match-document-filename.md +181 -0
- package/docs/rules/naming-convention.md +320 -0
- package/docs/rules/no-anonymous-operations.md +43 -0
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +46 -0
- package/docs/rules/no-deprecated.md +88 -0
- package/docs/rules/no-duplicate-fields.md +69 -0
- package/docs/rules/no-fragment-cycles.md +19 -0
- package/docs/rules/no-hashtag-description.md +62 -0
- package/docs/rules/no-root-type.md +55 -0
- package/docs/rules/no-scalar-result-type-on-mutation.md +39 -0
- package/docs/rules/no-typename-prefix.md +42 -0
- package/docs/rules/no-undefined-variables.md +20 -0
- package/docs/rules/no-unreachable-types.md +52 -0
- package/docs/rules/no-unused-fields.md +64 -0
- package/docs/rules/no-unused-fragments.md +20 -0
- package/docs/rules/no-unused-variables.md +20 -0
- package/docs/rules/one-field-subscriptions.md +19 -0
- package/docs/rules/overlapping-fields-can-be-merged.md +20 -0
- package/docs/rules/possible-fragment-spread.md +21 -0
- package/docs/rules/possible-type-extension.md +19 -0
- package/docs/rules/provided-required-arguments.md +21 -0
- package/docs/rules/relay-arguments.md +59 -0
- package/docs/rules/relay-connection-types.md +43 -0
- package/docs/rules/relay-edge-types.md +60 -0
- package/docs/rules/relay-page-info.md +34 -0
- package/docs/rules/require-deprecation-date.md +59 -0
- package/docs/rules/require-deprecation-reason.md +49 -0
- package/docs/rules/require-description.md +147 -0
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +50 -0
- package/docs/rules/require-id-when-available.md +91 -0
- package/docs/rules/scalar-leafs.md +23 -0
- package/docs/rules/selection-set-depth.md +86 -0
- package/docs/rules/strict-id-in-types.md +129 -0
- package/docs/rules/unique-argument-names.md +19 -0
- package/docs/rules/unique-directive-names-per-location.md +21 -0
- package/docs/rules/unique-directive-names.md +19 -0
- package/docs/rules/unique-enum-value-names.md +16 -0
- package/docs/rules/unique-field-definition-names.md +19 -0
- package/docs/rules/unique-fragment-name.md +52 -0
- package/docs/rules/unique-input-field-names.md +19 -0
- package/docs/rules/unique-operation-name.md +56 -0
- package/docs/rules/unique-operation-types.md +19 -0
- package/docs/rules/unique-type-names.md +19 -0
- package/docs/rules/unique-variable-names.md +19 -0
- package/docs/rules/value-literals-of-correct-type.md +22 -0
- package/docs/rules/variables-are-input-types.md +20 -0
- package/docs/rules/variables-in-allowed-position.md +19 -0
- package/package.json +8 -11
- package/{cache.d.ts → typings/cache.d.cts} +0 -0
- package/typings/cache.d.ts +10 -0
- package/typings/configs/base.d.cts +5 -0
- package/typings/configs/base.d.ts +5 -0
- package/typings/configs/index.d.cts +139 -0
- package/typings/configs/index.d.ts +139 -0
- package/typings/configs/operations-all.d.cts +20 -0
- package/typings/configs/operations-all.d.ts +20 -0
- package/typings/configs/operations-recommended.d.cts +50 -0
- package/typings/configs/operations-recommended.d.ts +50 -0
- package/typings/configs/relay.d.cts +10 -0
- package/typings/configs/relay.d.ts +10 -0
- package/typings/configs/schema-all.d.cts +15 -0
- package/typings/configs/schema-all.d.ts +15 -0
- package/typings/configs/schema-recommended.d.cts +47 -0
- package/typings/configs/schema-recommended.d.ts +47 -0
- package/{documents.d.ts → typings/documents.d.cts} +0 -0
- package/typings/documents.d.ts +21 -0
- package/{estree-converter/converter.d.ts → typings/estree-converter/converter.d.cts} +0 -0
- package/typings/estree-converter/converter.d.ts +3 -0
- package/{estree-converter/index.d.ts → typings/estree-converter/index.d.cts} +0 -0
- package/typings/estree-converter/index.d.ts +3 -0
- package/{estree-converter/types.d.ts → typings/estree-converter/types.d.cts} +0 -0
- package/typings/estree-converter/types.d.ts +40 -0
- package/{estree-converter/utils.d.ts → typings/estree-converter/utils.d.cts} +0 -0
- package/typings/estree-converter/utils.d.ts +13 -0
- package/{graphql-config.d.ts → typings/graphql-config.d.cts} +0 -0
- package/typings/graphql-config.d.ts +4 -0
- package/typings/index.d.cts +9 -0
- package/{index.d.ts → typings/index.d.ts} +1 -5
- package/{parser.d.ts → typings/parser.d.cts} +0 -0
- package/typings/parser.d.ts +2 -0
- package/{processor.d.ts → typings/processor.d.cts} +0 -0
- package/typings/processor.d.ts +6 -0
- package/{rules/alphabetize.d.ts → typings/rules/alphabetize.d.cts} +0 -0
- package/typings/rules/alphabetize.d.ts +76 -0
- package/{rules/description-style.d.ts → typings/rules/description-style.d.cts} +0 -0
- package/typings/rules/description-style.d.ts +20 -0
- package/{rules/graphql-js-validation.d.ts → typings/rules/graphql-js-validation.d.cts} +0 -0
- package/typings/rules/graphql-js-validation.d.ts +2 -0
- package/{rules/index.d.ts → typings/rules/index.d.cts} +0 -0
- package/typings/rules/index.d.ts +104 -0
- package/{rules/input-name.d.ts → typings/rules/input-name.d.cts} +0 -0
- package/typings/rules/input-name.d.ts +35 -0
- package/{rules/lone-executable-definition.d.ts → typings/rules/lone-executable-definition.d.cts} +0 -0
- package/typings/rules/lone-executable-definition.d.ts +26 -0
- package/{rules/match-document-filename.d.ts → typings/rules/match-document-filename.d.cts} +0 -0
- package/typings/rules/match-document-filename.d.ts +72 -0
- package/{rules/naming-convention.d.ts → typings/rules/naming-convention.d.cts} +0 -0
- package/typings/rules/naming-convention.d.ts +83 -0
- package/{rules/no-anonymous-operations.d.ts → typings/rules/no-anonymous-operations.d.cts} +0 -0
- package/{rules/no-case-insensitive-enum-values-duplicates.d.ts → typings/rules/no-anonymous-operations.d.ts} +0 -0
- package/{rules/no-hashtag-description.d.ts → typings/rules/no-case-insensitive-enum-values-duplicates.d.cts} +0 -0
- package/{rules/no-scalar-result-type-on-mutation.d.ts → typings/rules/no-case-insensitive-enum-values-duplicates.d.ts} +0 -0
- package/{rules/no-deprecated.d.ts → typings/rules/no-deprecated.d.cts} +0 -0
- package/typings/rules/no-deprecated.d.ts +2 -0
- package/{rules/no-duplicate-fields.d.ts → typings/rules/no-duplicate-fields.d.cts} +0 -0
- package/{rules/relay-page-info.d.ts → typings/rules/no-duplicate-fields.d.ts} +0 -0
- package/{rules/no-typename-prefix.d.ts → typings/rules/no-hashtag-description.d.cts} +0 -0
- package/{rules/no-unreachable-types.d.ts → typings/rules/no-hashtag-description.d.ts} +0 -0
- package/{rules/no-root-type.d.ts → typings/rules/no-root-type.d.cts} +0 -0
- package/typings/rules/no-root-type.d.ts +25 -0
- package/{rules/no-unused-fields.d.ts → typings/rules/no-scalar-result-type-on-mutation.d.cts} +0 -0
- package/{rules/unique-operation-name.d.ts → typings/rules/no-scalar-result-type-on-mutation.d.ts} +0 -0
- package/typings/rules/no-typename-prefix.d.cts +2 -0
- package/typings/rules/no-typename-prefix.d.ts +2 -0
- package/typings/rules/no-unreachable-types.d.cts +2 -0
- package/typings/rules/no-unreachable-types.d.ts +2 -0
- package/typings/rules/no-unused-fields.d.cts +2 -0
- package/typings/rules/no-unused-fields.d.ts +2 -0
- package/{rules/relay-arguments.d.ts → typings/rules/relay-arguments.d.cts} +0 -0
- package/typings/rules/relay-arguments.d.ts +21 -0
- package/{rules/relay-connection-types.d.ts → typings/rules/relay-connection-types.d.cts} +0 -0
- package/typings/rules/relay-connection-types.d.ts +4 -0
- package/{rules/relay-edge-types.d.ts → typings/rules/relay-edge-types.d.cts} +0 -0
- package/typings/rules/relay-edge-types.d.ts +31 -0
- package/{rules/require-deprecation-reason.d.ts → typings/rules/relay-page-info.d.cts} +0 -0
- package/{rules/require-field-of-type-query-in-mutation-result.d.ts → typings/rules/relay-page-info.d.ts} +0 -0
- package/{rules/require-deprecation-date.d.ts → typings/rules/require-deprecation-date.d.cts} +0 -0
- package/typings/rules/require-deprecation-date.d.ts +18 -0
- package/typings/rules/require-deprecation-reason.d.cts +2 -0
- package/typings/rules/require-deprecation-reason.d.ts +2 -0
- package/{rules/require-description.d.ts → typings/rules/require-description.d.cts} +0 -0
- package/typings/rules/require-description.d.ts +14 -0
- package/typings/rules/require-field-of-type-query-in-mutation-result.d.cts +2 -0
- package/typings/rules/require-field-of-type-query-in-mutation-result.d.ts +2 -0
- package/{rules/require-id-when-available.d.ts → typings/rules/require-id-when-available.d.cts} +0 -0
- package/typings/rules/require-id-when-available.d.ts +36 -0
- package/{rules/selection-set-depth.d.ts → typings/rules/selection-set-depth.d.cts} +0 -0
- package/typings/rules/selection-set-depth.d.ts +28 -0
- package/{rules/strict-id-in-types.d.ts → typings/rules/strict-id-in-types.d.cts} +0 -0
- package/typings/rules/strict-id-in-types.d.ts +57 -0
- package/{rules/unique-fragment-name.d.ts → typings/rules/unique-fragment-name.d.cts} +0 -0
- package/typings/rules/unique-fragment-name.d.ts +5 -0
- package/typings/rules/unique-operation-name.d.cts +2 -0
- package/typings/rules/unique-operation-name.d.ts +2 -0
- package/{schema.d.ts → typings/schema.d.cts} +0 -0
- package/typings/schema.d.ts +3 -0
- package/{testkit.d.ts → typings/testkit.d.cts} +0 -0
- package/typings/testkit.d.ts +27 -0
- package/{types.d.ts → typings/types.d.cts} +0 -0
- package/typings/types.d.ts +81 -0
- package/{utils.d.ts → typings/utils.d.cts} +0 -0
- package/typings/utils.d.ts +34 -0
- package/configs/base.json +0 -4
- package/configs/operations-all.json +0 -25
- package/configs/operations-recommended.json +0 -50
- package/configs/relay.json +0 -9
- package/configs/schema-all.json +0 -17
- package/configs/schema-recommended.json +0 -49
- package/index.js +0 -4995
- package/index.mjs +0 -4983
@@ -0,0 +1,72 @@
|
|
1
|
+
import { CaseStyle as _CaseStyle } from '../utils';
|
2
|
+
import { GraphQLESLintRule } from '../types';
|
3
|
+
import { FromSchema } from 'json-schema-to-ts';
|
4
|
+
type CaseStyle = _CaseStyle | 'matchDocumentStyle';
|
5
|
+
declare const schema: {
|
6
|
+
readonly definitions: {
|
7
|
+
readonly asString: {
|
8
|
+
readonly enum: CaseStyle[];
|
9
|
+
readonly description: `One of: ${string}`;
|
10
|
+
};
|
11
|
+
readonly asObject: {
|
12
|
+
readonly type: "object";
|
13
|
+
readonly additionalProperties: false;
|
14
|
+
readonly minProperties: 1;
|
15
|
+
readonly properties: {
|
16
|
+
readonly style: {
|
17
|
+
readonly enum: CaseStyle[];
|
18
|
+
};
|
19
|
+
readonly suffix: {
|
20
|
+
readonly type: "string";
|
21
|
+
};
|
22
|
+
readonly prefix: {
|
23
|
+
readonly type: "string";
|
24
|
+
};
|
25
|
+
};
|
26
|
+
};
|
27
|
+
};
|
28
|
+
readonly type: "array";
|
29
|
+
readonly minItems: 1;
|
30
|
+
readonly maxItems: 1;
|
31
|
+
readonly items: {
|
32
|
+
readonly type: "object";
|
33
|
+
readonly additionalProperties: false;
|
34
|
+
readonly minProperties: 1;
|
35
|
+
readonly properties: {
|
36
|
+
readonly fileExtension: {
|
37
|
+
readonly enum: readonly [".gql", ".graphql"];
|
38
|
+
};
|
39
|
+
readonly query: {
|
40
|
+
readonly oneOf: readonly [{
|
41
|
+
readonly $ref: "#/definitions/asString";
|
42
|
+
}, {
|
43
|
+
readonly $ref: "#/definitions/asObject";
|
44
|
+
}];
|
45
|
+
};
|
46
|
+
readonly mutation: {
|
47
|
+
readonly oneOf: readonly [{
|
48
|
+
readonly $ref: "#/definitions/asString";
|
49
|
+
}, {
|
50
|
+
readonly $ref: "#/definitions/asObject";
|
51
|
+
}];
|
52
|
+
};
|
53
|
+
readonly subscription: {
|
54
|
+
readonly oneOf: readonly [{
|
55
|
+
readonly $ref: "#/definitions/asString";
|
56
|
+
}, {
|
57
|
+
readonly $ref: "#/definitions/asObject";
|
58
|
+
}];
|
59
|
+
};
|
60
|
+
readonly fragment: {
|
61
|
+
readonly oneOf: readonly [{
|
62
|
+
readonly $ref: "#/definitions/asString";
|
63
|
+
}, {
|
64
|
+
readonly $ref: "#/definitions/asObject";
|
65
|
+
}];
|
66
|
+
};
|
67
|
+
};
|
68
|
+
};
|
69
|
+
};
|
70
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
71
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
72
|
+
export {};
|
File without changes
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
type AllowedStyle = 'camelCase' | 'PascalCase' | 'snake_case' | 'UPPER_CASE';
|
4
|
+
declare const schema: {
|
5
|
+
readonly definitions: {
|
6
|
+
readonly asString: {
|
7
|
+
readonly enum: AllowedStyle[];
|
8
|
+
readonly description: `One of: ${string}`;
|
9
|
+
};
|
10
|
+
readonly asObject: {
|
11
|
+
readonly type: "object";
|
12
|
+
readonly additionalProperties: false;
|
13
|
+
readonly properties: {
|
14
|
+
readonly style: {
|
15
|
+
readonly enum: AllowedStyle[];
|
16
|
+
};
|
17
|
+
readonly prefix: {
|
18
|
+
readonly type: "string";
|
19
|
+
};
|
20
|
+
readonly suffix: {
|
21
|
+
readonly type: "string";
|
22
|
+
};
|
23
|
+
readonly forbiddenPrefixes: {
|
24
|
+
readonly type: "array";
|
25
|
+
readonly uniqueItems: true;
|
26
|
+
readonly minItems: 1;
|
27
|
+
readonly items: {
|
28
|
+
readonly type: "string";
|
29
|
+
};
|
30
|
+
};
|
31
|
+
readonly forbiddenSuffixes: {
|
32
|
+
readonly type: "array";
|
33
|
+
readonly uniqueItems: true;
|
34
|
+
readonly minItems: 1;
|
35
|
+
readonly items: {
|
36
|
+
readonly type: "string";
|
37
|
+
};
|
38
|
+
};
|
39
|
+
readonly ignorePattern: {
|
40
|
+
readonly type: "string";
|
41
|
+
readonly description: "Option to skip validation of some words, e.g. acronyms";
|
42
|
+
};
|
43
|
+
};
|
44
|
+
};
|
45
|
+
};
|
46
|
+
readonly type: "array";
|
47
|
+
readonly maxItems: 1;
|
48
|
+
readonly items: {
|
49
|
+
readonly type: "object";
|
50
|
+
readonly additionalProperties: false;
|
51
|
+
readonly properties: {
|
52
|
+
readonly allowLeadingUnderscore: {
|
53
|
+
readonly type: "boolean";
|
54
|
+
readonly default: false;
|
55
|
+
};
|
56
|
+
readonly allowTrailingUnderscore: {
|
57
|
+
readonly type: "boolean";
|
58
|
+
readonly default: false;
|
59
|
+
};
|
60
|
+
readonly types: {
|
61
|
+
readonly description: `Includes:\n${string}`;
|
62
|
+
readonly oneOf: readonly [{
|
63
|
+
readonly $ref: "#/definitions/asString";
|
64
|
+
}, {
|
65
|
+
readonly $ref: "#/definitions/asObject";
|
66
|
+
}];
|
67
|
+
};
|
68
|
+
};
|
69
|
+
readonly patternProperties: {
|
70
|
+
readonly [x: string]: {
|
71
|
+
readonly oneOf: readonly [{
|
72
|
+
readonly $ref: "#/definitions/asString";
|
73
|
+
}, {
|
74
|
+
readonly $ref: "#/definitions/asObject";
|
75
|
+
}];
|
76
|
+
};
|
77
|
+
};
|
78
|
+
readonly description: string;
|
79
|
+
};
|
80
|
+
};
|
81
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
82
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
83
|
+
export {};
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly minItems: 1;
|
6
|
+
readonly maxItems: 1;
|
7
|
+
readonly items: {
|
8
|
+
readonly type: "object";
|
9
|
+
readonly additionalProperties: false;
|
10
|
+
readonly required: readonly ["disallow"];
|
11
|
+
readonly properties: {
|
12
|
+
readonly disallow: {
|
13
|
+
readonly items: {
|
14
|
+
readonly enum: readonly ["mutation", "subscription"];
|
15
|
+
};
|
16
|
+
readonly type: "array";
|
17
|
+
readonly uniqueItems: true;
|
18
|
+
readonly minItems: 1;
|
19
|
+
};
|
20
|
+
};
|
21
|
+
};
|
22
|
+
};
|
23
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
24
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
25
|
+
export {};
|
package/{rules/no-unused-fields.d.ts → typings/rules/no-scalar-result-type-on-mutation.d.cts}
RENAMED
File without changes
|
package/{rules/unique-operation-name.d.ts → typings/rules/no-scalar-result-type-on-mutation.d.ts}
RENAMED
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly maxItems: 1;
|
6
|
+
readonly items: {
|
7
|
+
readonly type: "object";
|
8
|
+
readonly additionalProperties: false;
|
9
|
+
readonly minProperties: 1;
|
10
|
+
readonly properties: {
|
11
|
+
readonly includeBoth: {
|
12
|
+
readonly type: "boolean";
|
13
|
+
readonly default: true;
|
14
|
+
readonly description: "Enforce including both forward and backward pagination arguments";
|
15
|
+
};
|
16
|
+
};
|
17
|
+
};
|
18
|
+
};
|
19
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
20
|
+
export declare const rule: GraphQLESLintRule<RuleOptions, true>;
|
21
|
+
export {};
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import type { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly maxItems: 1;
|
6
|
+
readonly items: {
|
7
|
+
readonly type: "object";
|
8
|
+
readonly additionalProperties: false;
|
9
|
+
readonly minProperties: 1;
|
10
|
+
readonly properties: {
|
11
|
+
readonly withEdgeSuffix: {
|
12
|
+
readonly type: "boolean";
|
13
|
+
readonly default: true;
|
14
|
+
readonly description: "Edge type name must end in \"Edge\".";
|
15
|
+
};
|
16
|
+
readonly shouldImplementNode: {
|
17
|
+
readonly type: "boolean";
|
18
|
+
readonly default: true;
|
19
|
+
readonly description: "Edge type's field `node` must implement `Node` interface.";
|
20
|
+
};
|
21
|
+
readonly listTypeCanWrapOnlyEdgeType: {
|
22
|
+
readonly type: "boolean";
|
23
|
+
readonly default: true;
|
24
|
+
readonly description: "A list type should only wrap an edge type.";
|
25
|
+
};
|
26
|
+
};
|
27
|
+
};
|
28
|
+
};
|
29
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
30
|
+
export declare const rule: GraphQLESLintRule<RuleOptions, true>;
|
31
|
+
export {};
|
File without changes
|
File without changes
|
package/{rules/require-deprecation-date.d.ts → typings/rules/require-deprecation-date.d.cts}
RENAMED
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly maxItems: 1;
|
6
|
+
readonly items: {
|
7
|
+
readonly type: "object";
|
8
|
+
readonly additionalProperties: false;
|
9
|
+
readonly properties: {
|
10
|
+
readonly argumentName: {
|
11
|
+
readonly type: "string";
|
12
|
+
};
|
13
|
+
};
|
14
|
+
};
|
15
|
+
};
|
16
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
17
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
18
|
+
export {};
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Kind } from 'graphql';
|
2
|
+
import type { GraphQLESLintRule } from '../types';
|
3
|
+
declare const ALLOWED_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, Kind.DIRECTIVE_DEFINITION, Kind.FIELD_DEFINITION, Kind.INPUT_VALUE_DEFINITION, Kind.ENUM_VALUE_DEFINITION, Kind.OPERATION_DEFINITION];
|
4
|
+
type AllowedKind = typeof ALLOWED_KINDS[number];
|
5
|
+
export type RuleOptions = [
|
6
|
+
{
|
7
|
+
types?: boolean;
|
8
|
+
rootField?: boolean;
|
9
|
+
} & {
|
10
|
+
[key in AllowedKind]?: boolean;
|
11
|
+
}
|
12
|
+
];
|
13
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
14
|
+
export {};
|
package/{rules/require-id-when-available.d.ts → typings/rules/require-id-when-available.d.cts}
RENAMED
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly definitions: {
|
5
|
+
readonly asString: {
|
6
|
+
readonly type: "string";
|
7
|
+
};
|
8
|
+
readonly asArray: {
|
9
|
+
readonly type: "array";
|
10
|
+
readonly uniqueItems: true;
|
11
|
+
readonly minItems: 1;
|
12
|
+
readonly items: {
|
13
|
+
readonly type: "string";
|
14
|
+
};
|
15
|
+
};
|
16
|
+
};
|
17
|
+
readonly type: "array";
|
18
|
+
readonly maxItems: 1;
|
19
|
+
readonly items: {
|
20
|
+
readonly type: "object";
|
21
|
+
readonly additionalProperties: false;
|
22
|
+
readonly properties: {
|
23
|
+
readonly fieldName: {
|
24
|
+
readonly oneOf: readonly [{
|
25
|
+
readonly $ref: "#/definitions/asString";
|
26
|
+
}, {
|
27
|
+
readonly $ref: "#/definitions/asArray";
|
28
|
+
}];
|
29
|
+
readonly default: "id";
|
30
|
+
};
|
31
|
+
};
|
32
|
+
};
|
33
|
+
};
|
34
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
35
|
+
export declare const rule: GraphQLESLintRule<RuleOptions, true>;
|
36
|
+
export {};
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly minItems: 1;
|
6
|
+
readonly maxItems: 1;
|
7
|
+
readonly items: {
|
8
|
+
readonly type: "object";
|
9
|
+
readonly additionalProperties: false;
|
10
|
+
readonly required: readonly ["maxDepth"];
|
11
|
+
readonly properties: {
|
12
|
+
readonly maxDepth: {
|
13
|
+
readonly type: "number";
|
14
|
+
};
|
15
|
+
readonly ignore: {
|
16
|
+
readonly type: "array";
|
17
|
+
readonly uniqueItems: true;
|
18
|
+
readonly minItems: 1;
|
19
|
+
readonly items: {
|
20
|
+
readonly type: "string";
|
21
|
+
};
|
22
|
+
};
|
23
|
+
};
|
24
|
+
};
|
25
|
+
};
|
26
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
27
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
28
|
+
export {};
|
File without changes
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { GraphQLESLintRule } from '../types';
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly maxItems: 1;
|
6
|
+
readonly items: {
|
7
|
+
readonly type: "object";
|
8
|
+
readonly additionalProperties: false;
|
9
|
+
readonly properties: {
|
10
|
+
readonly acceptedIdNames: {
|
11
|
+
readonly default: readonly ["id"];
|
12
|
+
readonly type: "array";
|
13
|
+
readonly uniqueItems: true;
|
14
|
+
readonly minItems: 1;
|
15
|
+
readonly items: {
|
16
|
+
readonly type: "string";
|
17
|
+
};
|
18
|
+
};
|
19
|
+
readonly acceptedIdTypes: {
|
20
|
+
readonly default: readonly ["ID"];
|
21
|
+
readonly type: "array";
|
22
|
+
readonly uniqueItems: true;
|
23
|
+
readonly minItems: 1;
|
24
|
+
readonly items: {
|
25
|
+
readonly type: "string";
|
26
|
+
};
|
27
|
+
};
|
28
|
+
readonly exceptions: {
|
29
|
+
readonly type: "object";
|
30
|
+
readonly additionalProperties: false;
|
31
|
+
readonly properties: {
|
32
|
+
readonly types: {
|
33
|
+
readonly description: "This is used to exclude types with names that match one of the specified values.";
|
34
|
+
readonly type: "array";
|
35
|
+
readonly uniqueItems: true;
|
36
|
+
readonly minItems: 1;
|
37
|
+
readonly items: {
|
38
|
+
readonly type: "string";
|
39
|
+
};
|
40
|
+
};
|
41
|
+
readonly suffixes: {
|
42
|
+
readonly description: "This is used to exclude types with names with suffixes that match one of the specified values.";
|
43
|
+
readonly type: "array";
|
44
|
+
readonly uniqueItems: true;
|
45
|
+
readonly minItems: 1;
|
46
|
+
readonly items: {
|
47
|
+
readonly type: "string";
|
48
|
+
};
|
49
|
+
};
|
50
|
+
};
|
51
|
+
};
|
52
|
+
};
|
53
|
+
};
|
54
|
+
};
|
55
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
56
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
57
|
+
export {};
|
File without changes
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { ExecutableDefinitionNode } from 'graphql';
|
2
|
+
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '../types';
|
3
|
+
import { GraphQLESTreeNode } from '../estree-converter';
|
4
|
+
export declare const checkNode: (context: GraphQLESLintRuleContext, node: GraphQLESTreeNode<ExecutableDefinitionNode>, ruleId: string) => void;
|
5
|
+
export declare const rule: GraphQLESLintRule;
|
File without changes
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { RuleTester } from 'eslint';
|
2
|
+
import type { ASTKindToNode } from 'graphql';
|
3
|
+
import type { GraphQLESTreeNode } from './estree-converter';
|
4
|
+
import type { GraphQLESLintRule, ParserOptions } from './types';
|
5
|
+
export type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = {
|
6
|
+
[K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
|
7
|
+
} & Record<string, any>;
|
8
|
+
export type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & {
|
9
|
+
options?: Options;
|
10
|
+
parserOptions?: Omit<ParserOptions, 'filePath'>;
|
11
|
+
};
|
12
|
+
export type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
|
13
|
+
errors: number | (RuleTester.TestCaseError | string)[];
|
14
|
+
output?: string | null;
|
15
|
+
};
|
16
|
+
export declare class GraphQLRuleTester extends RuleTester {
|
17
|
+
config: {
|
18
|
+
parser: string;
|
19
|
+
parserOptions: Omit<ParserOptions, 'filePath'>;
|
20
|
+
};
|
21
|
+
constructor(parserOptions?: Omit<ParserOptions, 'filePath'>);
|
22
|
+
fromMockFile(path: string): string;
|
23
|
+
runGraphQLTests<Options, WithTypeInfo extends boolean = false>(ruleId: string, rule: GraphQLESLintRule<Options, WithTypeInfo>, tests: {
|
24
|
+
valid: (string | GraphQLValidTestCase<Options>)[];
|
25
|
+
invalid: GraphQLInvalidTestCase<Options>[];
|
26
|
+
}): void;
|
27
|
+
}
|
File without changes
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import { Rule, AST, Linter } from 'eslint';
|
2
|
+
import * as ESTree from 'estree';
|
3
|
+
import { GraphQLSchema } from 'graphql';
|
4
|
+
import { IExtensions, IGraphQLProject } from 'graphql-config';
|
5
|
+
import { GraphQLParseOptions } from '@graphql-tools/utils';
|
6
|
+
import { GraphQLESLintRuleListener } from './testkit';
|
7
|
+
import { SiblingOperations } from './documents';
|
8
|
+
import { JSONSchema } from 'json-schema-to-ts';
|
9
|
+
export type Schema = GraphQLSchema | Error | null;
|
10
|
+
export type Pointer = string | string[];
|
11
|
+
export interface ParserOptions {
|
12
|
+
schema?: Pointer | Record<string, {
|
13
|
+
headers: Record<string, string>;
|
14
|
+
}>;
|
15
|
+
documents?: Pointer;
|
16
|
+
operations?: Pointer;
|
17
|
+
extensions?: IExtensions;
|
18
|
+
include?: Pointer;
|
19
|
+
exclude?: Pointer;
|
20
|
+
projects?: Record<string, IGraphQLProject>;
|
21
|
+
schemaOptions?: Omit<GraphQLParseOptions, 'assumeValidSDL'> & {
|
22
|
+
headers: Record<string, string>;
|
23
|
+
};
|
24
|
+
graphQLParserOptions?: Omit<GraphQLParseOptions, 'noLocation'>;
|
25
|
+
skipGraphQLConfig?: boolean;
|
26
|
+
filePath: string;
|
27
|
+
}
|
28
|
+
export type ParserServices = {
|
29
|
+
schema: Schema;
|
30
|
+
siblingOperations: SiblingOperations;
|
31
|
+
};
|
32
|
+
export type GraphQLESLintParseResult = Linter.ESLintParseResult & {
|
33
|
+
services: ParserServices;
|
34
|
+
};
|
35
|
+
type Location = AST.SourceLocation | ESTree.Position;
|
36
|
+
type ReportDescriptorLocation = {
|
37
|
+
node: {
|
38
|
+
loc: Location;
|
39
|
+
};
|
40
|
+
} | {
|
41
|
+
loc: Location;
|
42
|
+
};
|
43
|
+
export type ReportDescriptor = Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions & ReportDescriptorLocation;
|
44
|
+
export type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'parserServices' | 'report' | 'options'> & {
|
45
|
+
options: Options;
|
46
|
+
report(descriptor: ReportDescriptor): void;
|
47
|
+
parserServices?: ParserServices;
|
48
|
+
};
|
49
|
+
export type CategoryType = 'Schema' | 'Operations';
|
50
|
+
export type RuleDocsInfo<T> = Omit<Rule.RuleMetaData['docs'], 'category' | 'suggestion'> & {
|
51
|
+
category: CategoryType | CategoryType[];
|
52
|
+
requiresSchema?: true;
|
53
|
+
requiresSiblings?: true;
|
54
|
+
examples?: {
|
55
|
+
title: string;
|
56
|
+
code: string;
|
57
|
+
usage?: T;
|
58
|
+
}[];
|
59
|
+
configOptions?: T | {
|
60
|
+
schema?: T;
|
61
|
+
operations?: T;
|
62
|
+
};
|
63
|
+
graphQLJSRuleName?: string;
|
64
|
+
isDisabledForAllConfig?: true;
|
65
|
+
};
|
66
|
+
export type GraphQLESLintRule<Options = any[], WithTypeInfo extends boolean = false> = {
|
67
|
+
create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
|
68
|
+
meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & {
|
69
|
+
docs?: RuleDocsInfo<Options>;
|
70
|
+
schema: Readonly<JSONSchema> | [];
|
71
|
+
};
|
72
|
+
};
|
73
|
+
export type ValueOf<T> = T[keyof T];
|
74
|
+
type Id<T> = {} & {
|
75
|
+
[P in keyof T]: T[P];
|
76
|
+
};
|
77
|
+
type OmitDistributive<T, K extends PropertyKey> = T extends object ? Id<OmitRecursively<T, K>> : T;
|
78
|
+
export type OmitRecursively<T extends object, K extends PropertyKey> = Omit<{
|
79
|
+
[P in keyof T]: OmitDistributive<T[P], K>;
|
80
|
+
}, K>;
|
81
|
+
export {};
|
File without changes
|