@graphql-eslint/eslint-plugin 4.0.0-alpha-20230801163310-8bc4340 → 4.0.0-alpha-20230810160036-304c2c0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/cjs/cache.js +10 -19
- package/cjs/configs/index.d.ts +42 -16
- package/cjs/configs/index.js +10 -19
- package/cjs/configs/operations-all.d.ts +4 -3
- package/cjs/configs/operations-all.js +5 -4
- package/cjs/configs/operations-recommended.d.ts +3 -1
- package/cjs/configs/operations-recommended.js +3 -1
- package/cjs/configs/schema-all.d.ts +6 -1
- package/cjs/configs/schema-all.js +5 -2
- package/cjs/configs/schema-recommended.d.ts +19 -1
- package/cjs/configs/schema-recommended.js +22 -2
- package/cjs/documents.js +17 -32
- package/cjs/estree-converter/converter.js +14 -27
- package/cjs/estree-converter/index.js +4 -7
- package/cjs/estree-converter/types.js +3 -5
- package/cjs/estree-converter/utils.d.ts +2 -3
- package/cjs/estree-converter/utils.js +15 -45
- package/cjs/flat-configs.d.ts +59 -12
- package/cjs/flat-configs.js +9 -14
- package/cjs/graphql-config.d.ts +4 -3
- package/cjs/graphql-config.js +23 -44
- package/cjs/index.d.ts +10 -4
- package/cjs/index.js +8 -16
- package/cjs/parser.d.ts +4 -3
- package/cjs/parser.js +38 -45
- package/cjs/processor.d.ts +5 -1
- package/cjs/processor.js +25 -57
- package/cjs/rules/alphabetize.d.ts +6 -16
- package/cjs/rules/alphabetize.js +60 -132
- package/cjs/rules/description-style.d.ts +4 -3
- package/cjs/rules/description-style.js +11 -18
- package/cjs/rules/graphql-js-validation.d.ts +4 -3
- package/cjs/rules/graphql-js-validation.js +151 -225
- package/cjs/rules/index.d.ts +15 -13
- package/cjs/rules/index.js +8 -45
- package/cjs/rules/input-name.d.ts +4 -3
- package/cjs/rules/input-name.js +43 -59
- package/cjs/rules/lone-executable-definition.d.ts +6 -5
- package/cjs/rules/lone-executable-definition.js +14 -28
- package/cjs/rules/match-document-filename.d.ts +4 -3
- package/cjs/rules/match-document-filename.js +39 -70
- package/cjs/rules/naming-convention.d.ts +4 -3
- package/cjs/rules/naming-convention.js +56 -74
- package/cjs/rules/no-anonymous-operations.d.ts +4 -3
- package/cjs/rules/no-anonymous-operations.js +11 -18
- package/cjs/rules/no-deprecated.d.ts +4 -3
- package/cjs/rules/no-deprecated.js +15 -29
- package/cjs/rules/no-duplicate-fields.d.ts +4 -3
- package/cjs/rules/no-duplicate-fields.js +13 -23
- package/cjs/rules/no-hashtag-description.d.ts +4 -3
- package/cjs/rules/no-hashtag-description.js +16 -29
- package/cjs/rules/no-one-place-fragments.d.ts +4 -3
- package/cjs/rules/no-one-place-fragments.js +17 -29
- package/cjs/rules/no-root-type.d.ts +4 -3
- package/cjs/rules/no-root-type.js +15 -25
- package/cjs/rules/no-scalar-result-type-on-mutation.d.ts +4 -3
- package/cjs/rules/no-scalar-result-type-on-mutation.js +18 -30
- package/cjs/rules/no-typename-prefix.d.ts +4 -3
- package/cjs/rules/no-typename-prefix.js +26 -33
- package/cjs/rules/no-unreachable-types.d.ts +4 -3
- package/cjs/rules/no-unreachable-types.js +25 -47
- package/cjs/rules/no-unused-fields.d.ts +4 -3
- package/cjs/rules/no-unused-fields.js +24 -49
- package/cjs/rules/relay-arguments.d.ts +4 -3
- package/cjs/rules/relay-arguments.js +20 -43
- package/cjs/rules/relay-connection-types.d.ts +4 -3
- package/cjs/rules/relay-connection-types.js +14 -45
- package/cjs/rules/relay-edge-types.d.ts +4 -3
- package/cjs/rules/relay-edge-types.js +48 -99
- package/cjs/rules/relay-page-info.d.ts +4 -3
- package/cjs/rules/relay-page-info.js +21 -44
- package/cjs/rules/require-deprecation-date.d.ts +4 -3
- package/cjs/rules/require-deprecation-date.js +15 -31
- package/cjs/rules/require-deprecation-reason.d.ts +4 -3
- package/cjs/rules/require-deprecation-reason.js +12 -20
- package/cjs/rules/require-description.d.ts +4 -3
- package/cjs/rules/require-description.js +39 -65
- package/cjs/rules/require-field-of-type-query-in-mutation-result.d.ts +4 -3
- package/cjs/rules/require-field-of-type-query-in-mutation-result.js +16 -31
- package/cjs/rules/require-import-fragment.d.ts +4 -3
- package/cjs/rules/require-import-fragment.js +22 -40
- package/cjs/rules/require-nullable-fields-with-oneof.d.ts +4 -3
- package/cjs/rules/require-nullable-fields-with-oneof.js +11 -22
- package/cjs/rules/require-nullable-result-in-root.d.ts +4 -3
- package/cjs/rules/require-nullable-result-in-root.js +34 -44
- package/cjs/rules/{require-id-when-available.d.ts → require-selections.d.ts} +4 -3
- package/cjs/rules/require-selections.js +198 -0
- package/cjs/rules/require-type-pattern-with-oneof.d.ts +4 -3
- package/cjs/rules/require-type-pattern-with-oneof.js +15 -23
- package/cjs/rules/selection-set-depth.d.ts +4 -3
- package/cjs/rules/selection-set-depth.js +18 -34
- package/cjs/rules/strict-id-in-types.d.ts +4 -3
- package/cjs/rules/strict-id-in-types.js +25 -43
- package/cjs/rules/{no-case-insensitive-enum-values-duplicates.d.ts → unique-enum-value-names.d.ts} +4 -3
- package/cjs/rules/{no-case-insensitive-enum-values-duplicates.js → unique-enum-value-names.js} +16 -21
- package/cjs/rules/unique-fragment-name.d.ts +3 -2
- package/cjs/rules/unique-fragment-name.js +24 -36
- package/cjs/rules/unique-operation-name.d.ts +4 -3
- package/cjs/rules/unique-operation-name.js +10 -12
- package/cjs/schema.d.ts +4 -3
- package/cjs/schema.js +14 -27
- package/cjs/siblings.d.ts +24 -8
- package/cjs/siblings.js +42 -82
- package/cjs/types.d.ts +74 -7
- package/cjs/types.js +3 -5
- package/cjs/utils.d.ts +3 -2
- package/cjs/utils.js +27 -44
- package/esm/cache.js +4 -8
- package/esm/{chunk-BMTV3EA2.js → chunk-U3TKCM4X.js} +1 -1
- package/esm/configs/index.d.mts +42 -16
- package/esm/configs/index.js +4 -4
- package/esm/configs/operations-all.d.mts +4 -3
- package/esm/configs/operations-all.js +6 -5
- package/esm/configs/operations-recommended.d.mts +3 -1
- package/esm/configs/operations-recommended.js +4 -2
- package/esm/configs/schema-all.d.mts +6 -1
- package/esm/configs/schema-all.js +6 -3
- package/esm/configs/schema-recommended.d.mts +19 -1
- package/esm/configs/schema-recommended.js +23 -3
- package/esm/configs/{relay.js → schema-relay.js} +4 -4
- package/esm/documents.js +10 -17
- package/esm/estree-converter/converter.js +9 -18
- package/esm/estree-converter/utils.d.mts +2 -3
- package/esm/estree-converter/utils.js +11 -38
- package/esm/flat-configs.d.mts +59 -12
- package/esm/flat-configs.js +4 -5
- package/esm/graphql-config.d.mts +4 -3
- package/esm/graphql-config.js +18 -34
- package/esm/index.d.mts +10 -4
- package/esm/index.js +1 -1
- package/esm/parser.d.mts +4 -3
- package/esm/parser.js +33 -27
- package/esm/processor.d.mts +5 -1
- package/esm/processor.js +21 -46
- package/esm/rules/alphabetize.d.mts +6 -16
- package/esm/rules/alphabetize.js +53 -118
- package/esm/rules/description-style.d.mts +4 -3
- package/esm/rules/description-style.js +7 -11
- package/esm/rules/graphql-js-validation.d.mts +4 -3
- package/esm/rules/graphql-js-validation.js +178 -218
- package/esm/rules/index.d.mts +15 -13
- package/esm/rules/index.js +5 -5
- package/esm/rules/input-name.d.mts +4 -3
- package/esm/rules/input-name.js +39 -52
- package/esm/rules/lone-executable-definition.d.mts +6 -5
- package/esm/rules/lone-executable-definition.js +10 -20
- package/esm/rules/match-document-filename.d.mts +4 -3
- package/esm/rules/match-document-filename.js +35 -61
- package/esm/rules/naming-convention.d.mts +4 -3
- package/esm/rules/naming-convention.js +51 -65
- package/esm/rules/no-anonymous-operations.d.mts +4 -3
- package/esm/rules/no-anonymous-operations.js +6 -9
- package/esm/rules/no-deprecated.d.mts +4 -3
- package/esm/rules/no-deprecated.js +10 -20
- package/esm/rules/no-duplicate-fields.d.mts +4 -3
- package/esm/rules/no-duplicate-fields.js +9 -16
- package/esm/rules/no-hashtag-description.d.mts +4 -3
- package/esm/rules/no-hashtag-description.js +11 -20
- package/esm/rules/no-one-place-fragments.d.mts +4 -3
- package/esm/rules/no-one-place-fragments.js +12 -19
- package/esm/rules/no-root-type.d.mts +4 -3
- package/esm/rules/no-root-type.js +11 -18
- package/esm/rules/no-scalar-result-type-on-mutation.d.mts +4 -3
- package/esm/rules/no-scalar-result-type-on-mutation.js +13 -21
- package/esm/rules/no-typename-prefix.d.mts +4 -3
- package/esm/rules/no-typename-prefix.js +22 -26
- package/esm/rules/no-unreachable-types.d.mts +4 -3
- package/esm/rules/no-unreachable-types.js +18 -33
- package/esm/rules/no-unused-fields.d.mts +4 -3
- package/esm/rules/no-unused-fields.js +19 -40
- package/esm/rules/relay-arguments.d.mts +4 -3
- package/esm/rules/relay-arguments.js +15 -34
- package/esm/rules/relay-connection-types.d.mts +4 -3
- package/esm/rules/relay-connection-types.js +10 -38
- package/esm/rules/relay-edge-types.d.mts +4 -3
- package/esm/rules/relay-edge-types.js +43 -89
- package/esm/rules/relay-page-info.d.mts +4 -3
- package/esm/rules/relay-page-info.js +16 -34
- package/esm/rules/require-deprecation-date.d.mts +4 -3
- package/esm/rules/require-deprecation-date.js +10 -22
- package/esm/rules/require-deprecation-reason.d.mts +4 -3
- package/esm/rules/require-deprecation-reason.js +7 -11
- package/esm/rules/require-description.d.mts +4 -3
- package/esm/rules/require-description.js +34 -55
- package/esm/rules/require-field-of-type-query-in-mutation-result.d.mts +4 -3
- package/esm/rules/require-field-of-type-query-in-mutation-result.js +11 -22
- package/esm/rules/require-import-fragment.d.mts +4 -3
- package/esm/rules/require-import-fragment.js +14 -26
- package/esm/rules/require-nullable-fields-with-oneof.d.mts +4 -3
- package/esm/rules/require-nullable-fields-with-oneof.js +6 -13
- package/esm/rules/require-nullable-result-in-root.d.mts +4 -3
- package/esm/rules/require-nullable-result-in-root.js +29 -35
- package/esm/rules/{require-id-when-available.d.mts → require-selections.d.mts} +4 -3
- package/esm/rules/{require-id-when-available.js → require-selections.js} +43 -80
- package/esm/rules/require-type-pattern-with-oneof.d.mts +4 -3
- package/esm/rules/require-type-pattern-with-oneof.js +11 -16
- package/esm/rules/selection-set-depth.d.mts +4 -3
- package/esm/rules/selection-set-depth.js +11 -20
- package/esm/rules/strict-id-in-types.d.mts +4 -3
- package/esm/rules/strict-id-in-types.js +20 -34
- package/esm/rules/{no-case-insensitive-enum-values-duplicates.d.mts → unique-enum-value-names.d.mts} +4 -3
- package/esm/rules/{no-case-insensitive-enum-values-duplicates.js → unique-enum-value-names.js} +8 -9
- package/esm/rules/unique-fragment-name.d.mts +3 -2
- package/esm/rules/unique-fragment-name.js +20 -27
- package/esm/rules/unique-operation-name.d.mts +4 -3
- package/esm/rules/unique-operation-name.js +6 -5
- package/esm/schema.d.mts +4 -3
- package/esm/schema.js +7 -12
- package/esm/siblings.d.mts +24 -8
- package/esm/siblings.js +37 -73
- package/esm/types.d.mts +74 -7
- package/esm/utils.d.mts +3 -2
- package/esm/utils.js +20 -31
- package/index.browser.mjs +5323 -0
- package/package.json +8 -13
- package/cjs/rules/require-id-when-available.js +0 -241
- package/cjs/types-8d5f4ae0.d.ts +0 -107
- package/esm/types-ace77d86.d.ts +0 -107
- /package/cjs/configs/{relay.d.ts → schema-relay.d.ts} +0 -0
- /package/cjs/configs/{relay.js → schema-relay.js} +0 -0
- /package/esm/configs/{relay.d.mts → schema-relay.d.mts} +0 -0
package/cjs/rules/index.d.ts
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
import { RuleOptions } from './require-description.js';
|
2
2
|
import { CaseStyle } from '../utils.js';
|
3
|
-
import
|
3
|
+
import * as graphql_language_ast_js from 'graphql/language/ast.js';
|
4
|
+
import { GraphQLESLintRule } from '../types.js';
|
4
5
|
import * as json_schema_to_ts_lib_types_type_utils_writable_js from 'json-schema-to-ts/lib/types/type-utils/writable.js';
|
5
6
|
import 'graphql';
|
6
7
|
import 'eslint';
|
7
8
|
import 'estree';
|
8
|
-
import '../
|
9
|
+
import '../siblings.js';
|
9
10
|
import '@graphql-tools/utils';
|
10
|
-
import '
|
11
|
+
import '../estree-converter/types.js';
|
11
12
|
import 'json-schema-to-ts';
|
13
|
+
import 'graphql-config';
|
12
14
|
|
13
15
|
declare const rules: {
|
14
16
|
alphabetize: GraphQLESLintRule<{
|
15
17
|
definitions?: boolean | undefined;
|
16
18
|
selections?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<"OperationDefinition" | "FragmentDefinition">[] | undefined;
|
17
19
|
arguments?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<"Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition">[] | undefined;
|
18
|
-
values?:
|
20
|
+
values?: boolean | undefined;
|
19
21
|
fields?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<"ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition">[] | undefined;
|
20
|
-
variables?:
|
22
|
+
variables?: boolean | undefined;
|
21
23
|
groups?: string[] | undefined;
|
22
24
|
}[]>;
|
23
25
|
'description-style': GraphQLESLintRule<{
|
@@ -30,7 +32,7 @@ declare const rules: {
|
|
30
32
|
checkMutations?: boolean | undefined;
|
31
33
|
}[]>;
|
32
34
|
'lone-executable-definition': GraphQLESLintRule<{
|
33
|
-
ignore?: ("fragment" |
|
35
|
+
ignore?: ("fragment" | json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<graphql_language_ast_js.OperationTypeNode>)[] | undefined;
|
34
36
|
}[]>;
|
35
37
|
'match-document-filename': GraphQLESLintRule<{
|
36
38
|
fragment?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<CaseStyle | "matchDocumentStyle"> | {
|
@@ -38,17 +40,17 @@ declare const rules: {
|
|
38
40
|
suffix?: string | undefined;
|
39
41
|
prefix?: string | undefined;
|
40
42
|
} | undefined;
|
41
|
-
|
43
|
+
mutation?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<CaseStyle | "matchDocumentStyle"> | {
|
42
44
|
style?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<CaseStyle | "matchDocumentStyle"> | undefined;
|
43
45
|
suffix?: string | undefined;
|
44
46
|
prefix?: string | undefined;
|
45
47
|
} | undefined;
|
46
|
-
|
48
|
+
subscription?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<CaseStyle | "matchDocumentStyle"> | {
|
47
49
|
style?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<CaseStyle | "matchDocumentStyle"> | undefined;
|
48
50
|
suffix?: string | undefined;
|
49
51
|
prefix?: string | undefined;
|
50
52
|
} | undefined;
|
51
|
-
|
53
|
+
query?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<CaseStyle | "matchDocumentStyle"> | {
|
52
54
|
style?: json_schema_to_ts_lib_types_type_utils_writable_js.DeepWritable<CaseStyle | "matchDocumentStyle"> | undefined;
|
53
55
|
suffix?: string | undefined;
|
54
56
|
prefix?: string | undefined;
|
@@ -71,7 +73,6 @@ declare const rules: {
|
|
71
73
|
allowTrailingUnderscore?: boolean | undefined;
|
72
74
|
}[]>;
|
73
75
|
'no-anonymous-operations': GraphQLESLintRule;
|
74
|
-
'no-case-insensitive-enum-values-duplicates': GraphQLESLintRule;
|
75
76
|
'no-deprecated': GraphQLESLintRule<[], true>;
|
76
77
|
'no-duplicate-fields': GraphQLESLintRule;
|
77
78
|
'no-hashtag-description': GraphQLESLintRule;
|
@@ -99,12 +100,12 @@ declare const rules: {
|
|
99
100
|
'require-deprecation-reason': GraphQLESLintRule;
|
100
101
|
'require-description': GraphQLESLintRule<RuleOptions>;
|
101
102
|
'require-field-of-type-query-in-mutation-result': GraphQLESLintRule;
|
102
|
-
'require-id-when-available': GraphQLESLintRule<{
|
103
|
-
fieldName?: string | string[] | undefined;
|
104
|
-
}[], true>;
|
105
103
|
'require-import-fragment': GraphQLESLintRule;
|
106
104
|
'require-nullable-fields-with-oneof': GraphQLESLintRule;
|
107
105
|
'require-nullable-result-in-root': GraphQLESLintRule;
|
106
|
+
'require-selections': GraphQLESLintRule<{
|
107
|
+
fieldName?: string | string[] | undefined;
|
108
|
+
}[], true>;
|
108
109
|
'require-type-pattern-with-oneof': GraphQLESLintRule;
|
109
110
|
'selection-set-depth': GraphQLESLintRule<{
|
110
111
|
ignore?: string[] | undefined;
|
@@ -118,6 +119,7 @@ declare const rules: {
|
|
118
119
|
suffixes?: string[] | undefined;
|
119
120
|
} | undefined;
|
120
121
|
}[]>;
|
122
|
+
'unique-enum-value-names': GraphQLESLintRule;
|
121
123
|
'unique-fragment-name': GraphQLESLintRule;
|
122
124
|
'unique-operation-name': GraphQLESLintRule;
|
123
125
|
};
|
package/cjs/rules/index.js
CHANGED
@@ -5,57 +5,20 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
6
|
var __export = (target, all) => {
|
7
7
|
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
9
|
-
}
|
10
|
-
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
12
11
|
for (let key of __getOwnPropNames(from))
|
13
|
-
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
13
|
return to;
|
17
14
|
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
19
16
|
var rules_exports = {};
|
20
17
|
__export(rules_exports, {
|
21
18
|
rules: () => rules
|
22
19
|
});
|
23
20
|
module.exports = __toCommonJS(rules_exports);
|
24
|
-
var import_graphql_js_validation = require("./graphql-js-validation.js");
|
25
|
-
var import_alphabetize = require("./alphabetize.js");
|
26
|
-
var import_description_style = require("./description-style.js");
|
27
|
-
var import_input_name = require("./input-name.js");
|
28
|
-
var import_lone_executable_definition = require("./lone-executable-definition.js");
|
29
|
-
var import_match_document_filename = require("./match-document-filename.js");
|
30
|
-
var import_naming_convention = require("./naming-convention.js");
|
31
|
-
var import_no_anonymous_operations = require("./no-anonymous-operations.js");
|
32
|
-
var import_no_case_insensitive_enum_values_duplicates = require("./no-case-insensitive-enum-values-duplicates.js");
|
33
|
-
var import_no_deprecated = require("./no-deprecated.js");
|
34
|
-
var import_no_duplicate_fields = require("./no-duplicate-fields.js");
|
35
|
-
var import_no_hashtag_description = require("./no-hashtag-description.js");
|
36
|
-
var import_no_one_place_fragments = require("./no-one-place-fragments.js");
|
37
|
-
var import_no_root_type = require("./no-root-type.js");
|
38
|
-
var import_no_scalar_result_type_on_mutation = require("./no-scalar-result-type-on-mutation.js");
|
39
|
-
var import_no_typename_prefix = require("./no-typename-prefix.js");
|
40
|
-
var import_no_unreachable_types = require("./no-unreachable-types.js");
|
41
|
-
var import_no_unused_fields = require("./no-unused-fields.js");
|
42
|
-
var import_relay_arguments = require("./relay-arguments.js");
|
43
|
-
var import_relay_connection_types = require("./relay-connection-types.js");
|
44
|
-
var import_relay_edge_types = require("./relay-edge-types.js");
|
45
|
-
var import_relay_page_info = require("./relay-page-info.js");
|
46
|
-
var import_require_deprecation_date = require("./require-deprecation-date.js");
|
47
|
-
var import_require_deprecation_reason = require("./require-deprecation-reason.js");
|
48
|
-
var import_require_description = require("./require-description.js");
|
49
|
-
var import_require_field_of_type_query_in_mutation_result = require("./require-field-of-type-query-in-mutation-result.js");
|
50
|
-
var import_require_id_when_available = require("./require-id-when-available.js");
|
51
|
-
var import_require_import_fragment = require("./require-import-fragment.js");
|
52
|
-
var import_require_nullable_fields_with_oneof = require("./require-nullable-fields-with-oneof.js");
|
53
|
-
var import_require_nullable_result_in_root = require("./require-nullable-result-in-root.js");
|
54
|
-
var import_require_type_pattern_with_oneof = require("./require-type-pattern-with-oneof.js");
|
55
|
-
var import_selection_set_depth = require("./selection-set-depth.js");
|
56
|
-
var import_strict_id_in_types = require("./strict-id-in-types.js");
|
57
|
-
var import_unique_fragment_name = require("./unique-fragment-name.js");
|
58
|
-
var import_unique_operation_name = require("./unique-operation-name.js");
|
21
|
+
var import_graphql_js_validation = require("./graphql-js-validation.js"), import_alphabetize = require("./alphabetize.js"), import_description_style = require("./description-style.js"), import_input_name = require("./input-name.js"), import_lone_executable_definition = require("./lone-executable-definition.js"), import_match_document_filename = require("./match-document-filename.js"), import_naming_convention = require("./naming-convention.js"), import_no_anonymous_operations = require("./no-anonymous-operations.js"), import_no_deprecated = require("./no-deprecated.js"), import_no_duplicate_fields = require("./no-duplicate-fields.js"), import_no_hashtag_description = require("./no-hashtag-description.js"), import_no_one_place_fragments = require("./no-one-place-fragments.js"), import_no_root_type = require("./no-root-type.js"), import_no_scalar_result_type_on_mutation = require("./no-scalar-result-type-on-mutation.js"), import_no_typename_prefix = require("./no-typename-prefix.js"), import_no_unreachable_types = require("./no-unreachable-types.js"), import_no_unused_fields = require("./no-unused-fields.js"), import_relay_arguments = require("./relay-arguments.js"), import_relay_connection_types = require("./relay-connection-types.js"), import_relay_edge_types = require("./relay-edge-types.js"), import_relay_page_info = require("./relay-page-info.js"), import_require_deprecation_date = require("./require-deprecation-date.js"), import_require_deprecation_reason = require("./require-deprecation-reason.js"), import_require_description = require("./require-description.js"), import_require_field_of_type_query_in_mutation_result = require("./require-field-of-type-query-in-mutation-result.js"), import_require_import_fragment = require("./require-import-fragment.js"), import_require_nullable_fields_with_oneof = require("./require-nullable-fields-with-oneof.js"), import_require_nullable_result_in_root = require("./require-nullable-result-in-root.js"), import_require_selections = require("./require-selections.js"), import_require_type_pattern_with_oneof = require("./require-type-pattern-with-oneof.js"), import_selection_set_depth = require("./selection-set-depth.js"), import_strict_id_in_types = require("./strict-id-in-types.js"), import_unique_enum_value_names = require("./unique-enum-value-names.js"), import_unique_fragment_name = require("./unique-fragment-name.js"), import_unique_operation_name = require("./unique-operation-name.js");
|
59
22
|
const rules = {
|
60
23
|
...import_graphql_js_validation.GRAPHQL_JS_VALIDATIONS,
|
61
24
|
alphabetize: import_alphabetize.rule,
|
@@ -65,7 +28,6 @@ const rules = {
|
|
65
28
|
"match-document-filename": import_match_document_filename.rule,
|
66
29
|
"naming-convention": import_naming_convention.rule,
|
67
30
|
"no-anonymous-operations": import_no_anonymous_operations.rule,
|
68
|
-
"no-case-insensitive-enum-values-duplicates": import_no_case_insensitive_enum_values_duplicates.rule,
|
69
31
|
"no-deprecated": import_no_deprecated.rule,
|
70
32
|
"no-duplicate-fields": import_no_duplicate_fields.rule,
|
71
33
|
"no-hashtag-description": import_no_hashtag_description.rule,
|
@@ -83,13 +45,14 @@ const rules = {
|
|
83
45
|
"require-deprecation-reason": import_require_deprecation_reason.rule,
|
84
46
|
"require-description": import_require_description.rule,
|
85
47
|
"require-field-of-type-query-in-mutation-result": import_require_field_of_type_query_in_mutation_result.rule,
|
86
|
-
"require-id-when-available": import_require_id_when_available.rule,
|
87
48
|
"require-import-fragment": import_require_import_fragment.rule,
|
88
49
|
"require-nullable-fields-with-oneof": import_require_nullable_fields_with_oneof.rule,
|
89
50
|
"require-nullable-result-in-root": import_require_nullable_result_in_root.rule,
|
51
|
+
"require-selections": import_require_selections.rule,
|
90
52
|
"require-type-pattern-with-oneof": import_require_type_pattern_with_oneof.rule,
|
91
53
|
"selection-set-depth": import_selection_set_depth.rule,
|
92
54
|
"strict-id-in-types": import_strict_id_in_types.rule,
|
55
|
+
"unique-enum-value-names": import_unique_enum_value_names.rule,
|
93
56
|
"unique-fragment-name": import_unique_fragment_name.rule,
|
94
57
|
"unique-operation-name": import_unique_operation_name.rule
|
95
58
|
};
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
|
-
import {
|
3
|
-
import '@graphql-tools/utils';
|
2
|
+
import { GraphQLESLintRule } from '../types.js';
|
4
3
|
import 'eslint';
|
5
4
|
import 'estree';
|
6
5
|
import 'graphql';
|
7
|
-
import '
|
6
|
+
import '../siblings.js';
|
7
|
+
import '@graphql-tools/utils';
|
8
8
|
import '../estree-converter/types.js';
|
9
|
+
import 'graphql-config';
|
9
10
|
|
10
11
|
declare const schema: {
|
11
12
|
readonly type: "array";
|
package/cjs/rules/input-name.js
CHANGED
@@ -5,17 +5,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
6
|
var __export = (target, all) => {
|
7
7
|
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
9
|
-
}
|
10
|
-
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
12
11
|
for (let key of __getOwnPropNames(from))
|
13
|
-
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
13
|
return to;
|
17
14
|
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
19
16
|
var input_name_exports = {};
|
20
17
|
__export(input_name_exports, {
|
21
18
|
rule: () => rule
|
@@ -27,49 +24,46 @@ const schema = {
|
|
27
24
|
maxItems: 1,
|
28
25
|
items: {
|
29
26
|
type: "object",
|
30
|
-
additionalProperties:
|
27
|
+
additionalProperties: !1,
|
31
28
|
properties: {
|
32
29
|
checkInputType: {
|
33
30
|
type: "boolean",
|
34
|
-
default:
|
31
|
+
default: !1,
|
35
32
|
description: "Check that the input type name follows the convention \\<mutationName>Input"
|
36
33
|
},
|
37
34
|
caseSensitiveInputType: {
|
38
35
|
type: "boolean",
|
39
|
-
default:
|
36
|
+
default: !0,
|
40
37
|
description: "Allow for case discrepancies in the input type name"
|
41
38
|
},
|
42
39
|
checkQueries: {
|
43
40
|
type: "boolean",
|
44
|
-
default:
|
41
|
+
default: !1,
|
45
42
|
description: "Apply the rule to Queries"
|
46
43
|
},
|
47
44
|
checkMutations: {
|
48
45
|
type: "boolean",
|
49
|
-
default:
|
46
|
+
default: !0,
|
50
47
|
description: "Apply the rule to Mutations"
|
51
48
|
}
|
52
49
|
}
|
53
50
|
}
|
54
|
-
}
|
55
|
-
const isObjectType = (node) => (
|
51
|
+
}, isObjectType = (node) => (
|
56
52
|
// TODO: remove `as any` when drop support of graphql@15
|
57
53
|
[import_graphql.Kind.OBJECT_TYPE_DEFINITION, import_graphql.Kind.OBJECT_TYPE_EXTENSION].includes(node.type)
|
58
|
-
)
|
59
|
-
const isQueryType = (node) => isObjectType(node) && node.name.value === "Query";
|
60
|
-
const isMutationType = (node) => isObjectType(node) && node.name.value === "Mutation";
|
61
|
-
const rule = {
|
54
|
+
), isQueryType = (node) => isObjectType(node) && node.name.value === "Query", isMutationType = (node) => isObjectType(node) && node.name.value === "Mutation", rule = {
|
62
55
|
meta: {
|
63
56
|
type: "suggestion",
|
64
|
-
hasSuggestions:
|
57
|
+
hasSuggestions: !0,
|
65
58
|
docs: {
|
66
|
-
description:
|
59
|
+
description: `Require mutation argument to be always called "input" and input type to be called Mutation name + "Input".
|
60
|
+
Using the same name for all input parameters will make your schemas easier to consume and more predictable. Using the same name as mutation for InputType will make it easier to find mutations that InputType belongs to.`,
|
67
61
|
category: "Schema",
|
68
62
|
url: "https://the-guild.dev/graphql/eslint/rules/input-name",
|
69
63
|
examples: [
|
70
64
|
{
|
71
65
|
title: "Incorrect",
|
72
|
-
usage: [{ checkInputType:
|
66
|
+
usage: [{ checkInputType: !0 }],
|
73
67
|
code: (
|
74
68
|
/* GraphQL */
|
75
69
|
`
|
@@ -81,7 +75,7 @@ const rule = {
|
|
81
75
|
},
|
82
76
|
{
|
83
77
|
title: "Correct (with `checkInputType`)",
|
84
|
-
usage: [{ checkInputType:
|
78
|
+
usage: [{ checkInputType: !0 }],
|
85
79
|
code: (
|
86
80
|
/* GraphQL */
|
87
81
|
`
|
@@ -93,7 +87,7 @@ const rule = {
|
|
93
87
|
},
|
94
88
|
{
|
95
89
|
title: "Correct (without `checkInputType`)",
|
96
|
-
usage: [{ checkInputType:
|
90
|
+
usage: [{ checkInputType: !1 }],
|
97
91
|
code: (
|
98
92
|
/* GraphQL */
|
99
93
|
`
|
@@ -109,13 +103,11 @@ const rule = {
|
|
109
103
|
},
|
110
104
|
create(context) {
|
111
105
|
const options = {
|
112
|
-
checkInputType:
|
113
|
-
caseSensitiveInputType:
|
114
|
-
checkMutations:
|
106
|
+
checkInputType: !1,
|
107
|
+
caseSensitiveInputType: !0,
|
108
|
+
checkMutations: !0,
|
115
109
|
...context.options[0]
|
116
|
-
}
|
117
|
-
const shouldCheckType = (node) => options.checkMutations && isMutationType(node) || options.checkQueries && isQueryType(node) || false;
|
118
|
-
const listeners = {
|
110
|
+
}, shouldCheckType = (node) => options.checkMutations && isMutationType(node) || options.checkQueries && isQueryType(node) || !1, listeners = {
|
119
111
|
"FieldDefinition > InputValueDefinition[name.value!=input] > Name"(node) {
|
120
112
|
const fieldDef = node.parent.parent;
|
121
113
|
if (shouldCheckType(fieldDef.parent)) {
|
@@ -133,35 +125,27 @@ const rule = {
|
|
133
125
|
}
|
134
126
|
}
|
135
127
|
};
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
};
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
}
|
158
|
-
]
|
159
|
-
});
|
160
|
-
}
|
161
|
-
}
|
162
|
-
};
|
163
|
-
}
|
164
|
-
return listeners;
|
128
|
+
return options.checkInputType && (listeners["FieldDefinition > InputValueDefinition NamedType"] = (node) => {
|
129
|
+
const inputValueNode = ((item) => {
|
130
|
+
let currentNode = item;
|
131
|
+
for (; currentNode.type !== import_graphql.Kind.INPUT_VALUE_DEFINITION; )
|
132
|
+
currentNode = currentNode.parent;
|
133
|
+
return currentNode;
|
134
|
+
})(node);
|
135
|
+
if (shouldCheckType(inputValueNode.parent.parent)) {
|
136
|
+
const mutationName = `${inputValueNode.parent.name.value}Input`, name = node.name.value;
|
137
|
+
(options.caseSensitiveInputType && node.name.value !== mutationName || name.toLowerCase() !== mutationName.toLowerCase()) && context.report({
|
138
|
+
node: node.name,
|
139
|
+
message: `Input type \`${name}\` name should be \`${mutationName}\`.`,
|
140
|
+
suggest: [
|
141
|
+
{
|
142
|
+
desc: `Rename to \`${mutationName}\``,
|
143
|
+
fix: (fixer) => fixer.replaceText(node, mutationName)
|
144
|
+
}
|
145
|
+
]
|
146
|
+
});
|
147
|
+
}
|
148
|
+
}), listeners;
|
165
149
|
}
|
166
150
|
};
|
167
151
|
// Annotate the CommonJS export names for ESM import in node:
|
@@ -1,11 +1,12 @@
|
|
1
|
+
import { OperationTypeNode } from 'graphql';
|
1
2
|
import { FromSchema } from 'json-schema-to-ts';
|
2
|
-
import {
|
3
|
-
import '@graphql-tools/utils';
|
3
|
+
import { GraphQLESLintRule } from '../types.js';
|
4
4
|
import 'eslint';
|
5
5
|
import 'estree';
|
6
|
-
import '
|
7
|
-
import 'graphql-
|
6
|
+
import '../siblings.js';
|
7
|
+
import '@graphql-tools/utils';
|
8
8
|
import '../estree-converter/types.js';
|
9
|
+
import 'graphql-config';
|
9
10
|
|
10
11
|
declare const schema: {
|
11
12
|
readonly type: "array";
|
@@ -18,7 +19,7 @@ declare const schema: {
|
|
18
19
|
readonly ignore: {
|
19
20
|
readonly maxItems: 3;
|
20
21
|
readonly items: {
|
21
|
-
readonly enum: readonly ["fragment",
|
22
|
+
readonly enum: readonly ["fragment", ...OperationTypeNode[]];
|
22
23
|
};
|
23
24
|
readonly description: "Allow certain definitions to be placed alongside others.";
|
24
25
|
readonly type: "array";
|
@@ -5,32 +5,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
6
|
var __export = (target, all) => {
|
7
7
|
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
9
|
-
}
|
10
|
-
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
12
11
|
for (let key of __getOwnPropNames(from))
|
13
|
-
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
13
|
return to;
|
17
14
|
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
19
16
|
var lone_executable_definition_exports = {};
|
20
17
|
__export(lone_executable_definition_exports, {
|
21
18
|
rule: () => rule
|
22
19
|
});
|
23
20
|
module.exports = __toCommonJS(lone_executable_definition_exports);
|
24
|
-
var import_utils = require("../utils.js");
|
25
|
-
const RULE_ID = "lone-executable-definition"
|
26
|
-
const definitionTypes = ["fragment", "query", "mutation", "subscription"];
|
27
|
-
const schema = {
|
21
|
+
var import_graphql = require("graphql"), import_utils = require("../utils.js");
|
22
|
+
const RULE_ID = "lone-executable-definition", definitionTypes = ["fragment", ...Object.values(import_graphql.OperationTypeNode)], schema = {
|
28
23
|
type: "array",
|
29
24
|
maxItems: 1,
|
30
25
|
items: {
|
31
26
|
type: "object",
|
32
27
|
minProperties: 1,
|
33
|
-
additionalProperties:
|
28
|
+
additionalProperties: !1,
|
34
29
|
properties: {
|
35
30
|
ignore: {
|
36
31
|
...import_utils.ARRAY_DEFAULT_OPTIONS,
|
@@ -43,8 +38,7 @@ const schema = {
|
|
43
38
|
}
|
44
39
|
}
|
45
40
|
}
|
46
|
-
}
|
47
|
-
const rule = {
|
41
|
+
}, rule = {
|
48
42
|
meta: {
|
49
43
|
type: "suggestion",
|
50
44
|
docs: {
|
@@ -85,26 +79,18 @@ const rule = {
|
|
85
79
|
schema
|
86
80
|
},
|
87
81
|
create(context) {
|
88
|
-
|
89
|
-
const ignore = new Set(((_a = context.options[0]) == null ? void 0 : _a.ignore) || []);
|
90
|
-
const definitions = [];
|
82
|
+
const ignore = new Set(context.options[0]?.ignore || []), definitions = [];
|
91
83
|
return {
|
92
84
|
":matches(OperationDefinition, FragmentDefinition)"(node) {
|
93
85
|
const type = "operation" in node ? node.operation : "fragment";
|
94
|
-
|
95
|
-
definitions.push({ type, node });
|
96
|
-
}
|
86
|
+
ignore.has(type) || definitions.push({ type, node });
|
97
87
|
},
|
98
88
|
"Document:exit"() {
|
99
|
-
var _a2, _b;
|
100
89
|
for (const { node, type } of definitions.slice(1)) {
|
101
90
|
let name = (0, import_utils.pascalCase)(type);
|
102
|
-
const definitionName =
|
103
|
-
|
104
|
-
name
|
105
|
-
}
|
106
|
-
context.report({
|
107
|
-
loc: ((_b = node.name) == null ? void 0 : _b.loc) || (0, import_utils.getLocation)(node.loc.start, type),
|
91
|
+
const definitionName = node.name?.value;
|
92
|
+
definitionName && (name += ` "${definitionName}"`), context.report({
|
93
|
+
loc: node.name?.loc || (0, import_utils.getLocation)(node.loc.start, type),
|
108
94
|
messageId: RULE_ID,
|
109
95
|
data: { name }
|
110
96
|
});
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
|
-
import {
|
2
|
+
import { GraphQLESLintRule } from '../types.js';
|
3
3
|
import { CaseStyle as CaseStyle$1 } from '../utils.js';
|
4
|
-
import '@graphql-tools/utils';
|
5
4
|
import 'eslint';
|
6
5
|
import 'estree';
|
7
6
|
import 'graphql';
|
8
|
-
import '
|
7
|
+
import '../siblings.js';
|
8
|
+
import '@graphql-tools/utils';
|
9
9
|
import '../estree-converter/types.js';
|
10
|
+
import 'graphql-config';
|
10
11
|
|
11
12
|
type CaseStyle = CaseStyle$1 | 'matchDocumentStyle';
|
12
13
|
declare const schema: {
|