@graphql-eslint/eslint-plugin 4.0.0-alpha.1 → 4.0.0-alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/{esm/cache.d.mts → cjs/cache.d.cts} +1 -1
- package/cjs/cache.js +8 -36
- package/cjs/chunk-UIAXBAMD.js +8 -0
- package/cjs/configs/index.d.cts +24 -0
- package/cjs/configs/index.js +35 -38
- package/cjs/configs/operations-all.js +33 -26
- package/cjs/configs/operations-recommended.js +59 -52
- package/cjs/configs/schema-all.js +29 -22
- package/cjs/configs/schema-recommended.js +73 -66
- package/cjs/configs/schema-relay.js +17 -10
- package/cjs/documents.js +18 -38
- package/{esm/estree-converter/converter.d.mts → cjs/estree-converter/converter.d.cts} +1 -1
- package/cjs/estree-converter/converter.js +16 -30
- package/cjs/estree-converter/index.d.cts +8 -0
- package/cjs/estree-converter/index.js +3 -23
- package/cjs/estree-converter/types.js +1 -14
- package/{esm/estree-converter/utils.d.mts → cjs/estree-converter/utils.d.cts} +3 -3
- package/cjs/estree-converter/utils.js +22 -40
- package/{esm/graphql-config.d.mts → cjs/graphql-config.d.cts} +3 -3
- package/cjs/graphql-config.js +16 -42
- package/cjs/index.d.cts +184 -0
- package/cjs/index.js +24 -41
- package/cjs/meta.d.cts +3 -0
- package/cjs/meta.js +5 -0
- package/cjs/package.json +1 -0
- package/{esm/parser.d.mts → cjs/parser.d.cts} +11 -4
- package/cjs/parser.js +35 -46
- package/{esm/processor.d.mts → cjs/processor.d.cts} +4 -0
- package/cjs/processor.js +25 -34
- package/{esm/rules/alphabetize.d.mts → cjs/rules/alphabetize/index.d.cts} +4 -4
- package/cjs/rules/{alphabetize.js → alphabetize/index.js} +69 -77
- package/{esm/rules/description-style.d.mts → cjs/rules/description-style/index.d.cts} +3 -3
- package/cjs/rules/{description-style.js → description-style/index.js} +7 -27
- package/{esm/rules/graphql-js-validation.d.mts → cjs/rules/graphql-js-validation.d.cts} +3 -3
- package/cjs/rules/graphql-js-validation.js +93 -70
- package/{esm/rules/index.d.mts → cjs/rules/index.d.cts} +8 -8
- package/cjs/rules/index.js +74 -60
- package/cjs/rules/{input-name.d.ts → input-name/index.d.cts} +6 -4
- package/cjs/rules/{input-name.js → input-name/index.js} +10 -28
- package/cjs/rules/{lone-executable-definition.d.ts → lone-executable-definition/index.d.cts} +3 -3
- package/cjs/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +13 -32
- package/cjs/rules/{match-document-filename.d.ts → match-document-filename/index.d.cts} +4 -4
- package/cjs/rules/{match-document-filename.js → match-document-filename/index.js} +21 -35
- package/{esm/rules/naming-convention.d.mts → cjs/rules/naming-convention/index.d.cts} +6 -4
- package/cjs/rules/{naming-convention.js → naming-convention/index.js} +41 -54
- package/cjs/rules/no-anonymous-operations/index.d.cts +13 -0
- package/cjs/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +9 -28
- package/{esm/rules/no-deprecated.d.mts → cjs/rules/no-deprecated/index.d.cts} +3 -3
- package/cjs/rules/{no-deprecated.js → no-deprecated/index.js} +11 -30
- package/cjs/rules/no-duplicate-fields/index.d.cts +13 -0
- package/cjs/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +8 -28
- package/cjs/rules/{no-hashtag-description.d.ts → no-hashtag-description/index.d.cts} +3 -3
- package/cjs/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +11 -31
- package/cjs/rules/no-one-place-fragments/index.d.cts +13 -0
- package/cjs/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +11 -29
- package/cjs/rules/{no-root-type.d.ts → no-root-type/index.d.cts} +3 -3
- package/cjs/rules/{no-root-type.js → no-root-type/index.js} +9 -29
- package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +13 -0
- package/cjs/rules/no-scalar-result-type-on-mutation/index.js +69 -0
- package/cjs/rules/no-typename-prefix/index.d.cts +13 -0
- package/cjs/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +5 -25
- package/cjs/rules/no-unreachable-types/index.d.cts +13 -0
- package/cjs/rules/no-unreachable-types/index.js +155 -0
- package/cjs/rules/no-unused-fields/index.d.cts +13 -0
- package/cjs/rules/{no-unused-fields.js → no-unused-fields/index.js} +16 -34
- package/{esm/rules/relay-arguments.d.mts → cjs/rules/relay-arguments/index.d.cts} +3 -3
- package/cjs/rules/{relay-arguments.js → relay-arguments/index.js} +11 -30
- package/{esm/rules/relay-connection-types.d.mts → cjs/rules/relay-connection-types/index.d.cts} +3 -3
- package/cjs/rules/{relay-connection-types.js → relay-connection-types/index.js} +19 -40
- package/cjs/rules/{relay-edge-types.d.ts → relay-edge-types/index.d.cts} +6 -4
- package/cjs/rules/{relay-edge-types.js → relay-edge-types/index.js} +31 -44
- package/cjs/rules/relay-page-info/index.d.cts +13 -0
- package/cjs/rules/{relay-page-info.js → relay-page-info/index.js} +13 -31
- package/{esm/rules/require-deprecation-date.d.mts → cjs/rules/require-deprecation-date/index.d.cts} +3 -3
- package/cjs/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +13 -32
- package/cjs/rules/require-deprecation-reason/index.d.cts +13 -0
- package/cjs/rules/require-deprecation-reason/index.js +66 -0
- package/{esm/rules/require-description.d.mts → cjs/rules/require-description/index.d.cts} +3 -3
- package/cjs/rules/{require-description.js → require-description/index.js} +30 -44
- package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +13 -0
- package/cjs/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +10 -29
- package/cjs/rules/require-import-fragment/index.d.cts +13 -0
- package/cjs/rules/{require-import-fragment.js → require-import-fragment/index.js} +16 -38
- package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +13 -0
- package/cjs/rules/require-nullable-fields-with-oneof/index.js +62 -0
- package/cjs/rules/require-nullable-result-in-root/index.d.cts +13 -0
- package/cjs/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +12 -31
- package/{esm/rules/require-selections.d.mts → cjs/rules/require-selections/index.d.cts} +3 -3
- package/cjs/rules/{require-selections.js → require-selections/index.js} +47 -45
- package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +13 -0
- package/cjs/rules/require-type-pattern-with-oneof/index.js +63 -0
- package/{esm/rules/selection-set-depth.d.mts → cjs/rules/selection-set-depth/index.d.cts} +3 -3
- package/cjs/rules/{selection-set-depth.js → selection-set-depth/index.js} +16 -42
- package/cjs/rules/{strict-id-in-types.d.ts → strict-id-in-types/index.d.cts} +6 -4
- package/cjs/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +26 -39
- package/cjs/rules/unique-enum-value-names/index.d.cts +13 -0
- package/cjs/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +10 -29
- package/{esm/rules/unique-fragment-name.d.mts → cjs/rules/unique-fragment-name/index.d.cts} +3 -3
- package/cjs/rules/unique-fragment-name/index.js +87 -0
- package/cjs/rules/unique-operation-name/index.d.cts +13 -0
- package/cjs/rules/{unique-operation-name.js → unique-operation-name/index.js} +7 -27
- package/{esm/schema.d.mts → cjs/schema.d.cts} +3 -3
- package/cjs/schema.js +11 -36
- package/cjs/siblings.js +17 -33
- package/{esm/types.d.mts → cjs/types.d.cts} +2 -2
- package/cjs/types.js +1 -14
- package/{esm/utils.d.mts → cjs/utils.d.cts} +5 -5
- package/cjs/utils.js +94 -115
- package/{cjs → esm}/cache.d.ts +1 -1
- package/esm/configs/index.d.ts +24 -0
- package/esm/configs/index.js +22 -1
- package/esm/configs/operations-all.js +1 -1
- package/esm/documents.js +8 -3
- package/{cjs → esm}/estree-converter/index.d.ts +2 -2
- package/{cjs → esm}/estree-converter/utils.d.ts +3 -3
- package/esm/graphql-config.js +1 -1
- package/esm/index.d.ts +184 -0
- package/esm/index.js +10 -4
- package/esm/meta.d.ts +3 -0
- package/esm/meta.js +5 -0
- package/{cjs → esm}/parser.d.ts +8 -1
- package/esm/parser.js +10 -1
- package/{cjs → esm}/processor.d.ts +4 -0
- package/esm/processor.js +5 -0
- package/{cjs/rules/alphabetize.d.ts → esm/rules/alphabetize/index.d.ts} +5 -5
- package/esm/rules/{alphabetize.js → alphabetize/index.js} +26 -10
- package/{cjs/rules/description-style.d.ts → esm/rules/description-style/index.d.ts} +3 -3
- package/esm/rules/{description-style.js → description-style/index.js} +2 -2
- package/{cjs → esm}/rules/index.d.ts +10 -10
- package/esm/rules/index.js +34 -34
- package/esm/rules/{input-name.d.mts → input-name/index.d.ts} +6 -4
- package/esm/rules/{input-name.js → input-name/index.js} +1 -1
- package/esm/rules/{lone-executable-definition.d.mts → lone-executable-definition/index.d.ts} +3 -3
- package/esm/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +2 -2
- package/esm/rules/{match-document-filename.d.mts → match-document-filename/index.d.ts} +4 -4
- package/esm/rules/{match-document-filename.js → match-document-filename/index.js} +4 -4
- package/{cjs/rules/naming-convention.d.ts → esm/rules/naming-convention/index.d.ts} +6 -4
- package/esm/rules/{naming-convention.js → naming-convention/index.js} +2 -2
- package/{cjs/rules/no-one-place-fragments.d.ts → esm/rules/no-anonymous-operations/index.d.ts} +3 -3
- package/esm/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +2 -2
- package/{cjs/rules/no-deprecated.d.ts → esm/rules/no-deprecated/index.d.ts} +3 -3
- package/esm/rules/{no-deprecated.js → no-deprecated/index.js} +2 -2
- package/{cjs/rules/no-scalar-result-type-on-mutation.d.ts → esm/rules/no-duplicate-fields/index.d.ts} +3 -3
- package/esm/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +1 -1
- package/esm/rules/{no-hashtag-description.d.mts → no-hashtag-description/index.d.ts} +3 -3
- package/esm/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +2 -2
- package/{cjs/rules/no-anonymous-operations.d.ts → esm/rules/no-one-place-fragments/index.d.ts} +3 -3
- package/esm/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +2 -2
- package/esm/rules/{no-root-type.d.mts → no-root-type/index.d.ts} +3 -3
- package/esm/rules/{no-root-type.js → no-root-type/index.js} +2 -2
- package/{cjs/rules/no-duplicate-fields.d.ts → esm/rules/no-scalar-result-type-on-mutation/index.d.ts} +3 -3
- package/esm/rules/{no-scalar-result-type-on-mutation.js → no-scalar-result-type-on-mutation/index.js} +2 -2
- package/esm/rules/no-typename-prefix/index.d.ts +13 -0
- package/esm/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +1 -1
- package/esm/rules/no-unreachable-types/index.d.ts +13 -0
- package/esm/rules/{no-unreachable-types.js → no-unreachable-types/index.js} +8 -8
- package/esm/rules/no-unused-fields/index.d.ts +13 -0
- package/esm/rules/{no-unused-fields.js → no-unused-fields/index.js} +8 -7
- package/{cjs/rules/relay-arguments.d.ts → esm/rules/relay-arguments/index.d.ts} +3 -3
- package/esm/rules/{relay-arguments.js → relay-arguments/index.js} +2 -2
- package/{cjs/rules/relay-connection-types.d.ts → esm/rules/relay-connection-types/index.d.ts} +3 -3
- package/esm/rules/{relay-connection-types.js → relay-connection-types/index.js} +1 -1
- package/esm/rules/{relay-edge-types.d.mts → relay-edge-types/index.d.ts} +6 -4
- package/esm/rules/{relay-edge-types.js → relay-edge-types/index.js} +3 -3
- package/esm/rules/relay-page-info/index.d.ts +13 -0
- package/esm/rules/{relay-page-info.js → relay-page-info/index.js} +4 -4
- package/{cjs/rules/require-deprecation-date.d.ts → esm/rules/require-deprecation-date/index.d.ts} +3 -3
- package/esm/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +3 -3
- package/esm/rules/require-deprecation-reason/index.d.ts +13 -0
- package/esm/rules/{require-deprecation-reason.js → require-deprecation-reason/index.js} +3 -3
- package/{cjs/rules/require-description.d.ts → esm/rules/require-description/index.d.ts} +3 -3
- package/esm/rules/{require-description.js → require-description/index.js} +2 -2
- package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +13 -0
- package/esm/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +2 -2
- package/esm/rules/require-import-fragment/index.d.ts +13 -0
- package/esm/rules/{require-import-fragment.js → require-import-fragment/index.js} +9 -4
- package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +13 -0
- package/esm/rules/{require-nullable-fields-with-oneof.js → require-nullable-fields-with-oneof/index.js} +2 -2
- package/esm/rules/require-nullable-result-in-root/index.d.ts +13 -0
- package/esm/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +2 -2
- package/{cjs/rules/require-selections.d.ts → esm/rules/require-selections/index.d.ts} +3 -3
- package/esm/rules/{require-selections.js → require-selections/index.js} +13 -7
- package/esm/rules/require-type-pattern-with-oneof/index.d.ts +13 -0
- package/esm/rules/{require-type-pattern-with-oneof.js → require-type-pattern-with-oneof/index.js} +2 -2
- package/{cjs/rules/selection-set-depth.d.ts → esm/rules/selection-set-depth/index.d.ts} +3 -3
- package/esm/rules/{selection-set-depth.js → selection-set-depth/index.js} +3 -3
- package/esm/rules/{strict-id-in-types.d.mts → strict-id-in-types/index.d.ts} +6 -4
- package/esm/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +2 -2
- package/esm/rules/unique-enum-value-names/index.d.ts +13 -0
- package/esm/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +2 -2
- package/{cjs/rules/unique-fragment-name.d.ts → esm/rules/unique-fragment-name/index.d.ts} +3 -3
- package/esm/rules/{unique-fragment-name.js → unique-fragment-name/index.js} +3 -3
- package/esm/rules/unique-operation-name/index.d.ts +13 -0
- package/esm/rules/{unique-operation-name.js → unique-operation-name/index.js} +2 -2
- package/{cjs → esm}/utils.d.ts +2 -2
- package/esm/utils.js +39 -16
- package/{index.browser.mjs → index.browser.js} +171 -110
- package/package.json +7 -11
- package/cjs/configs/index.d.ts +0 -174
- package/cjs/flat-configs.d.ts +0 -307
- package/cjs/flat-configs.js +0 -55
- package/cjs/index.d.ts +0 -26
- package/cjs/rules/no-scalar-result-type-on-mutation.js +0 -88
- package/cjs/rules/no-typename-prefix.d.ts +0 -13
- package/cjs/rules/no-unreachable-types.d.ts +0 -13
- package/cjs/rules/no-unreachable-types.js +0 -176
- package/cjs/rules/no-unused-fields.d.ts +0 -13
- package/cjs/rules/relay-page-info.d.ts +0 -13
- package/cjs/rules/require-deprecation-reason.d.ts +0 -13
- package/cjs/rules/require-deprecation-reason.js +0 -85
- package/cjs/rules/require-field-of-type-query-in-mutation-result.d.ts +0 -13
- package/cjs/rules/require-import-fragment.d.ts +0 -13
- package/cjs/rules/require-nullable-fields-with-oneof.d.ts +0 -13
- package/cjs/rules/require-nullable-fields-with-oneof.js +0 -81
- package/cjs/rules/require-nullable-result-in-root.d.ts +0 -13
- package/cjs/rules/require-type-pattern-with-oneof.d.ts +0 -13
- package/cjs/rules/require-type-pattern-with-oneof.js +0 -83
- package/cjs/rules/unique-enum-value-names.d.ts +0 -13
- package/cjs/rules/unique-fragment-name.js +0 -106
- package/cjs/rules/unique-operation-name.d.ts +0 -13
- package/esm/configs/index.d.mts +0 -174
- package/esm/estree-converter/index.d.mts +0 -8
- package/esm/flat-configs.d.mts +0 -307
- package/esm/flat-configs.js +0 -36
- package/esm/index.d.mts +0 -26
- package/esm/package.json +0 -1
- package/esm/rules/no-anonymous-operations.d.mts +0 -13
- package/esm/rules/no-duplicate-fields.d.mts +0 -13
- package/esm/rules/no-one-place-fragments.d.mts +0 -13
- package/esm/rules/no-scalar-result-type-on-mutation.d.mts +0 -13
- package/esm/rules/no-typename-prefix.d.mts +0 -13
- package/esm/rules/no-unreachable-types.d.mts +0 -13
- package/esm/rules/no-unused-fields.d.mts +0 -13
- package/esm/rules/relay-page-info.d.mts +0 -13
- package/esm/rules/require-deprecation-reason.d.mts +0 -13
- package/esm/rules/require-field-of-type-query-in-mutation-result.d.mts +0 -13
- package/esm/rules/require-import-fragment.d.mts +0 -13
- package/esm/rules/require-nullable-fields-with-oneof.d.mts +0 -13
- package/esm/rules/require-nullable-result-in-root.d.mts +0 -13
- package/esm/rules/require-type-pattern-with-oneof.d.mts +0 -13
- package/esm/rules/unique-enum-value-names.d.mts +0 -13
- package/esm/rules/unique-operation-name.d.mts +0 -13
- /package/cjs/configs/{operations-all.d.ts → operations-all.d.cts} +0 -0
- /package/cjs/configs/{operations-recommended.d.ts → operations-recommended.d.cts} +0 -0
- /package/cjs/configs/{schema-all.d.ts → schema-all.d.cts} +0 -0
- /package/cjs/configs/{schema-recommended.d.ts → schema-recommended.d.cts} +0 -0
- /package/cjs/configs/{schema-relay.d.ts → schema-relay.d.cts} +0 -0
- /package/cjs/{documents.d.ts → documents.d.cts} +0 -0
- /package/cjs/estree-converter/{types.d.ts → types.d.cts} +0 -0
- /package/cjs/{siblings.d.ts → siblings.d.cts} +0 -0
- /package/esm/configs/{operations-all.d.mts → operations-all.d.ts} +0 -0
- /package/esm/configs/{operations-recommended.d.mts → operations-recommended.d.ts} +0 -0
- /package/esm/configs/{schema-all.d.mts → schema-all.d.ts} +0 -0
- /package/esm/configs/{schema-recommended.d.mts → schema-recommended.d.ts} +0 -0
- /package/esm/configs/{schema-relay.d.mts → schema-relay.d.ts} +0 -0
- /package/esm/{documents.d.mts → documents.d.ts} +0 -0
- /package/{cjs → esm}/estree-converter/converter.d.ts +0 -0
- /package/esm/estree-converter/{types.d.mts → types.d.ts} +0 -0
- /package/{cjs → esm}/graphql-config.d.ts +0 -0
- /package/{cjs → esm}/rules/graphql-js-validation.d.ts +0 -0
- /package/{cjs → esm}/schema.d.ts +0 -0
- /package/esm/{siblings.d.mts → siblings.d.ts} +0 -0
- /package/{cjs → esm}/types.d.ts +0 -0
@@ -35,7 +35,7 @@ var require_operations_all = __commonJS({
|
|
35
35
|
selections: ["OperationDefinition", "FragmentDefinition"],
|
36
36
|
variables: !0,
|
37
37
|
arguments: ["Field", "Directive"],
|
38
|
-
groups: ["
|
38
|
+
groups: ["...", "id", "*", "{"]
|
39
39
|
}
|
40
40
|
],
|
41
41
|
"@graphql-eslint/lone-executable-definition": "error",
|
@@ -237,10 +237,23 @@ var require_schema_relay = __commonJS({
|
|
237
237
|
});
|
238
238
|
|
239
239
|
// src/parser.ts
|
240
|
-
import
|
240
|
+
import debugFactory2 from "debug";
|
241
241
|
import { buildSchema, GraphQLError } from "graphql";
|
242
242
|
import { parseGraphQLSDL } from "@graphql-tools/utils";
|
243
243
|
|
244
|
+
// src/cache.ts
|
245
|
+
import debugFactory from "debug";
|
246
|
+
var log = debugFactory("graphql-eslint:ModuleCache"), ModuleCache = class {
|
247
|
+
map = /* @__PURE__ */ new Map();
|
248
|
+
set(cacheKey, result) {
|
249
|
+
}
|
250
|
+
get(cacheKey, settings = {
|
251
|
+
lifetime: 10
|
252
|
+
/* seconds */
|
253
|
+
}) {
|
254
|
+
}
|
255
|
+
};
|
256
|
+
|
244
257
|
// src/estree-converter/converter.ts
|
245
258
|
import {
|
246
259
|
Kind,
|
@@ -374,6 +387,9 @@ function convertToESTree(node, schema15) {
|
|
374
387
|
);
|
375
388
|
}
|
376
389
|
|
390
|
+
// src/meta.ts
|
391
|
+
var version = process.env.VERSION;
|
392
|
+
|
377
393
|
// src/siblings.ts
|
378
394
|
import {
|
379
395
|
Kind as Kind3,
|
@@ -411,7 +427,7 @@ var chalk = {
|
|
411
427
|
// eslint-disable-next-line no-console
|
412
428
|
console.warn(chalk.yellow("warning"), "[graphql-eslint]", ...args)
|
413
429
|
)
|
414
|
-
},
|
430
|
+
}, slash = (path2) => path2.replaceAll("\\", "/"), VIRTUAL_DOCUMENT_REGEX = /[/\\]\d+_document.graphql$/, CWD = process.cwd(), getTypeName = (node) => "type" in node ? getTypeName(node.type) : "name" in node && node.name ? node.name.value : "", TYPES_KINDS = [
|
415
431
|
Kind2.OBJECT_TYPE_DEFINITION,
|
416
432
|
Kind2.INTERFACE_TYPE_DEFINITION,
|
417
433
|
Kind2.ENUM_TYPE_DEFINITION,
|
@@ -460,26 +476,49 @@ function truthy(value) {
|
|
460
476
|
return !!value;
|
461
477
|
}
|
462
478
|
var DisplayNodeNameMap = {
|
463
|
-
[Kind2.
|
464
|
-
[Kind2.
|
465
|
-
[Kind2.
|
466
|
-
[Kind2.
|
479
|
+
[Kind2.ARGUMENT]: "argument",
|
480
|
+
[Kind2.BOOLEAN]: "boolean",
|
481
|
+
[Kind2.DIRECTIVE_DEFINITION]: "directive",
|
482
|
+
[Kind2.DIRECTIVE]: "directive",
|
483
|
+
[Kind2.DOCUMENT]: "document",
|
467
484
|
[Kind2.ENUM_TYPE_DEFINITION]: "enum",
|
468
485
|
[Kind2.ENUM_TYPE_EXTENSION]: "enum",
|
469
|
-
[Kind2.
|
486
|
+
[Kind2.ENUM_VALUE_DEFINITION]: "enum value",
|
487
|
+
[Kind2.ENUM]: "enum",
|
488
|
+
[Kind2.FIELD_DEFINITION]: "field",
|
489
|
+
[Kind2.FIELD]: "field",
|
490
|
+
[Kind2.FLOAT]: "float",
|
491
|
+
[Kind2.FRAGMENT_DEFINITION]: "fragment",
|
492
|
+
[Kind2.FRAGMENT_SPREAD]: "fragment spread",
|
493
|
+
[Kind2.INLINE_FRAGMENT]: "inline fragment",
|
470
494
|
[Kind2.INPUT_OBJECT_TYPE_DEFINITION]: "input",
|
471
495
|
[Kind2.INPUT_OBJECT_TYPE_EXTENSION]: "input",
|
472
|
-
[Kind2.UNION_TYPE_DEFINITION]: "union",
|
473
|
-
[Kind2.UNION_TYPE_EXTENSION]: "union",
|
474
|
-
[Kind2.DIRECTIVE_DEFINITION]: "directive",
|
475
|
-
[Kind2.FIELD_DEFINITION]: "field",
|
476
|
-
[Kind2.ENUM_VALUE_DEFINITION]: "enum value",
|
477
496
|
[Kind2.INPUT_VALUE_DEFINITION]: "input value",
|
478
|
-
[Kind2.
|
479
|
-
[Kind2.
|
480
|
-
[Kind2.
|
497
|
+
[Kind2.INT]: "int",
|
498
|
+
[Kind2.INTERFACE_TYPE_DEFINITION]: "interface",
|
499
|
+
[Kind2.INTERFACE_TYPE_EXTENSION]: "interface",
|
500
|
+
[Kind2.LIST_TYPE]: "list type",
|
501
|
+
[Kind2.LIST]: "list",
|
502
|
+
[Kind2.NAME]: "name",
|
503
|
+
[Kind2.NAMED_TYPE]: "named type",
|
504
|
+
[Kind2.NON_NULL_TYPE]: "non-null type",
|
505
|
+
[Kind2.NULL]: "null",
|
506
|
+
[Kind2.OBJECT_FIELD]: "object field",
|
507
|
+
[Kind2.OBJECT_TYPE_DEFINITION]: "type",
|
508
|
+
[Kind2.OBJECT_TYPE_EXTENSION]: "type",
|
509
|
+
[Kind2.OBJECT]: "object",
|
481
510
|
[Kind2.OPERATION_DEFINITION]: "operation",
|
482
|
-
[Kind2.
|
511
|
+
[Kind2.OPERATION_TYPE_DEFINITION]: "operation type",
|
512
|
+
[Kind2.SCALAR_TYPE_DEFINITION]: "scalar",
|
513
|
+
[Kind2.SCALAR_TYPE_EXTENSION]: "scalar",
|
514
|
+
[Kind2.SCHEMA_DEFINITION]: "schema",
|
515
|
+
[Kind2.SCHEMA_EXTENSION]: "schema",
|
516
|
+
[Kind2.SELECTION_SET]: "selection set",
|
517
|
+
[Kind2.STRING]: "string",
|
518
|
+
[Kind2.UNION_TYPE_DEFINITION]: "union",
|
519
|
+
[Kind2.UNION_TYPE_EXTENSION]: "union",
|
520
|
+
[Kind2.VARIABLE_DEFINITION]: "variable",
|
521
|
+
[Kind2.VARIABLE]: "variable"
|
483
522
|
};
|
484
523
|
function displayNodeName(node) {
|
485
524
|
return `${node.kind === Kind2.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
|
@@ -575,7 +614,7 @@ function getSiblings(documents) {
|
|
575
614
|
}
|
576
615
|
|
577
616
|
// src/parser.ts
|
578
|
-
var debug =
|
617
|
+
var debug = debugFactory2("graphql-eslint:parser");
|
579
618
|
debug("cwd %o", CWD);
|
580
619
|
var LEGACY_PARSER_OPTIONS_KEYS = [
|
581
620
|
"schema",
|
@@ -640,8 +679,15 @@ function parseForESLint(code, options) {
|
|
640
679
|
throw error;
|
641
680
|
}
|
642
681
|
}
|
682
|
+
var parser = {
|
683
|
+
parseForESLint,
|
684
|
+
meta: {
|
685
|
+
name: "@graphql-eslint/parser",
|
686
|
+
version
|
687
|
+
}
|
688
|
+
};
|
643
689
|
|
644
|
-
// src/rules/alphabetize.ts
|
690
|
+
// src/rules/alphabetize/index.ts
|
645
691
|
import {
|
646
692
|
Kind as Kind4
|
647
693
|
} from "graphql";
|
@@ -703,7 +749,14 @@ var RULE_ID = "alphabetize", fieldsEnum = [
|
|
703
749
|
groups: {
|
704
750
|
...ARRAY_DEFAULT_OPTIONS,
|
705
751
|
minItems: 2,
|
706
|
-
description:
|
752
|
+
description: [
|
753
|
+
"Order group. Example: `['...', 'id', '*', '{']` where:",
|
754
|
+
"- `...` stands for fragment spreads",
|
755
|
+
"- `id` stands for field with name `id`",
|
756
|
+
"- `*` stands for everything else",
|
757
|
+
"- `{` stands for fields `selection set`"
|
758
|
+
].join(`
|
759
|
+
`)
|
707
760
|
}
|
708
761
|
}
|
709
762
|
}
|
@@ -825,7 +878,7 @@ var RULE_ID = "alphabetize", fieldsEnum = [
|
|
825
878
|
selections: selectionsEnum,
|
826
879
|
variables: !0,
|
827
880
|
arguments: [Kind4.FIELD, Kind4.DIRECTIVE],
|
828
|
-
groups: ["
|
881
|
+
groups: ["...", "id", "*", "{"]
|
829
882
|
}
|
830
883
|
]
|
831
884
|
}
|
@@ -863,19 +916,17 @@ var RULE_ID = "alphabetize", fieldsEnum = [
|
|
863
916
|
}
|
864
917
|
function checkNodes(nodes = []) {
|
865
918
|
for (let i = 1; i < nodes.length; i += 1) {
|
866
|
-
let currNode = nodes[i], currName =
|
919
|
+
let currNode = nodes[i], currName = getName(currNode);
|
867
920
|
if (!currName)
|
868
921
|
continue;
|
869
|
-
let prevNode = nodes[i - 1], prevName =
|
922
|
+
let prevNode = nodes[i - 1], prevName = getName(prevNode);
|
870
923
|
if (prevName) {
|
871
924
|
let compareResult = prevName.localeCompare(currName), { groups } = opts, shouldSortByGroup = !1;
|
872
925
|
if (groups?.length) {
|
873
926
|
if (!groups.includes("*"))
|
874
927
|
throw new Error("`groups` option should contain `*` string.");
|
875
|
-
let indexForPrev = groups
|
876
|
-
indexForPrev
|
877
|
-
let indexForCurr = groups.indexOf(currName);
|
878
|
-
if (indexForCurr === -1 && (indexForCurr = groups.indexOf("*")), shouldSortByGroup = indexForPrev - indexForCurr > 0, indexForPrev < indexForCurr)
|
928
|
+
let indexForPrev = getIndex({ node: prevNode, groups }), indexForCurr = getIndex({ node: currNode, groups });
|
929
|
+
if (shouldSortByGroup = indexForPrev - indexForCurr > 0, indexForPrev < indexForCurr)
|
879
930
|
continue;
|
880
931
|
}
|
881
932
|
if (!shouldSortByGroup && !(compareResult === 1) && (!(compareResult === 0) || !prevNode.kind.endsWith("Extension") || currNode.kind.endsWith("Extension")))
|
@@ -935,8 +986,19 @@ var RULE_ID = "alphabetize", fieldsEnum = [
|
|
935
986
|
}), listeners;
|
936
987
|
}
|
937
988
|
};
|
989
|
+
function getIndex({
|
990
|
+
node,
|
991
|
+
groups
|
992
|
+
}) {
|
993
|
+
let index = groups.indexOf(getName(node));
|
994
|
+
return index === -1 && "selectionSet" in node && node.selectionSet && (index = groups.indexOf("{")), index === -1 && node.kind === Kind4.FRAGMENT_SPREAD && (index = groups.indexOf("...")), index === -1 && (index = groups.indexOf("*")), index;
|
995
|
+
}
|
996
|
+
function getName(node) {
|
997
|
+
return "alias" in node && node.alias?.value || //
|
998
|
+
"name" in node && node.name?.value || "";
|
999
|
+
}
|
938
1000
|
|
939
|
-
// src/rules/description-style.ts
|
1001
|
+
// src/rules/description-style/index.ts
|
940
1002
|
var schema2 = {
|
941
1003
|
type: "array",
|
942
1004
|
maxItems: 1,
|
@@ -1624,7 +1686,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
|
|
1624
1686
|
)
|
1625
1687
|
);
|
1626
1688
|
|
1627
|
-
// src/rules/input-name.ts
|
1689
|
+
// src/rules/input-name/index.ts
|
1628
1690
|
import {
|
1629
1691
|
Kind as Kind6
|
1630
1692
|
} from "graphql";
|
@@ -1758,7 +1820,7 @@ Using the same name for all input parameters will make your schemas easier to co
|
|
1758
1820
|
}
|
1759
1821
|
};
|
1760
1822
|
|
1761
|
-
// src/rules/lone-executable-definition.ts
|
1823
|
+
// src/rules/lone-executable-definition/index.ts
|
1762
1824
|
import { OperationTypeNode as OperationTypeNode2 } from "graphql";
|
1763
1825
|
var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...Object.values(OperationTypeNode2)], schema4 = {
|
1764
1826
|
type: "array",
|
@@ -1840,8 +1902,8 @@ var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...O
|
|
1840
1902
|
}
|
1841
1903
|
};
|
1842
1904
|
|
1843
|
-
// src/rules/match-document-filename.ts
|
1844
|
-
import { basename, extname } from "path";
|
1905
|
+
// src/rules/match-document-filename/index.ts
|
1906
|
+
import { basename, extname } from "node:path";
|
1845
1907
|
import { Kind as Kind7 } from "graphql";
|
1846
1908
|
var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLES = [
|
1847
1909
|
"camelCase",
|
@@ -2068,7 +2130,7 @@ var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLE
|
|
2068
2130
|
}
|
2069
2131
|
};
|
2070
2132
|
|
2071
|
-
// src/rules/naming-convention.ts
|
2133
|
+
// src/rules/naming-convention/index.ts
|
2072
2134
|
import { Kind as Kind8 } from "graphql";
|
2073
2135
|
var KindToDisplayName = {
|
2074
2136
|
// types
|
@@ -2462,7 +2524,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
2462
2524
|
}
|
2463
2525
|
};
|
2464
2526
|
|
2465
|
-
// src/rules/no-anonymous-operations.ts
|
2527
|
+
// src/rules/no-anonymous-operations/index.ts
|
2466
2528
|
import { Kind as Kind9 } from "graphql";
|
2467
2529
|
var RULE_ID3 = "no-anonymous-operations", rule7 = {
|
2468
2530
|
meta: {
|
@@ -2531,7 +2593,7 @@ var RULE_ID3 = "no-anonymous-operations", rule7 = {
|
|
2531
2593
|
}
|
2532
2594
|
};
|
2533
2595
|
|
2534
|
-
// src/rules/no-deprecated.ts
|
2596
|
+
// src/rules/no-deprecated/index.ts
|
2535
2597
|
import { Kind as Kind10 } from "graphql";
|
2536
2598
|
var RULE_ID4 = "no-deprecated", rule8 = {
|
2537
2599
|
meta: {
|
@@ -2652,7 +2714,7 @@ var RULE_ID4 = "no-deprecated", rule8 = {
|
|
2652
2714
|
}
|
2653
2715
|
};
|
2654
2716
|
|
2655
|
-
// src/rules/no-duplicate-fields.ts
|
2717
|
+
// src/rules/no-duplicate-fields/index.ts
|
2656
2718
|
import { Kind as Kind11 } from "graphql";
|
2657
2719
|
var RULE_ID5 = "no-duplicate-fields", rule9 = {
|
2658
2720
|
meta: {
|
@@ -2766,7 +2828,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
|
|
2766
2828
|
}
|
2767
2829
|
};
|
2768
2830
|
|
2769
|
-
// src/rules/no-hashtag-description.ts
|
2831
|
+
// src/rules/no-hashtag-description/index.ts
|
2770
2832
|
import { TokenKind as TokenKind2 } from "graphql";
|
2771
2833
|
var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
|
2772
2834
|
meta: {
|
@@ -2869,8 +2931,8 @@ var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
|
|
2869
2931
|
}
|
2870
2932
|
};
|
2871
2933
|
|
2872
|
-
// src/rules/no-one-place-fragments.ts
|
2873
|
-
import { relative } from "path";
|
2934
|
+
// src/rules/no-one-place-fragments/index.ts
|
2935
|
+
import { relative } from "node:path";
|
2874
2936
|
import { visit as visit4 } from "graphql";
|
2875
2937
|
var RULE_ID7 = "no-one-place-fragments", rule11 = {
|
2876
2938
|
meta: {
|
@@ -2949,7 +3011,7 @@ var RULE_ID7 = "no-one-place-fragments", rule11 = {
|
|
2949
3011
|
}
|
2950
3012
|
};
|
2951
3013
|
|
2952
|
-
// src/rules/no-root-type.ts
|
3014
|
+
// src/rules/no-root-type/index.ts
|
2953
3015
|
var schema7 = {
|
2954
3016
|
type: "array",
|
2955
3017
|
minItems: 1,
|
@@ -3029,7 +3091,7 @@ var schema7 = {
|
|
3029
3091
|
}
|
3030
3092
|
};
|
3031
3093
|
|
3032
|
-
// src/rules/no-scalar-result-type-on-mutation.ts
|
3094
|
+
// src/rules/no-scalar-result-type-on-mutation/index.ts
|
3033
3095
|
import { isScalarType, Kind as Kind12 } from "graphql";
|
3034
3096
|
var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
|
3035
3097
|
meta: {
|
@@ -3095,7 +3157,7 @@ var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
|
|
3095
3157
|
}
|
3096
3158
|
};
|
3097
3159
|
|
3098
|
-
// src/rules/no-typename-prefix.ts
|
3160
|
+
// src/rules/no-typename-prefix/index.ts
|
3099
3161
|
var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
|
3100
3162
|
meta: {
|
3101
3163
|
type: "suggestion",
|
@@ -3164,7 +3226,7 @@ var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
|
|
3164
3226
|
}
|
3165
3227
|
};
|
3166
3228
|
|
3167
|
-
// src/rules/no-unreachable-types.ts
|
3229
|
+
// src/rules/no-unreachable-types/index.ts
|
3168
3230
|
import {
|
3169
3231
|
DirectiveLocation,
|
3170
3232
|
isInterfaceType,
|
@@ -3186,7 +3248,7 @@ var RULE_ID9 = "no-unreachable-types", KINDS = [
|
|
3186
3248
|
Kind13.UNION_TYPE_EXTENSION,
|
3187
3249
|
Kind13.ENUM_TYPE_DEFINITION,
|
3188
3250
|
Kind13.ENUM_TYPE_EXTENSION
|
3189
|
-
], reachableTypesCache, RequestDirectiveLocations = /* @__PURE__ */ new Set([
|
3251
|
+
], reachableTypesCache = new ModuleCache(), RequestDirectiveLocations = /* @__PURE__ */ new Set([
|
3190
3252
|
DirectiveLocation.QUERY,
|
3191
3253
|
DirectiveLocation.MUTATION,
|
3192
3254
|
DirectiveLocation.SUBSCRIPTION,
|
@@ -3197,8 +3259,9 @@ var RULE_ID9 = "no-unreachable-types", KINDS = [
|
|
3197
3259
|
DirectiveLocation.VARIABLE_DEFINITION
|
3198
3260
|
]);
|
3199
3261
|
function getReachableTypes(schema15) {
|
3200
|
-
|
3201
|
-
|
3262
|
+
let cachedValue = reachableTypesCache.get(schema15);
|
3263
|
+
if (cachedValue)
|
3264
|
+
return cachedValue;
|
3202
3265
|
let reachableTypes = /* @__PURE__ */ new Set(), collect = (node) => {
|
3203
3266
|
let typeName = getTypeName(node);
|
3204
3267
|
if (reachableTypes.has(typeName))
|
@@ -3235,7 +3298,7 @@ function getReachableTypes(schema15) {
|
|
3235
3298
|
argTypeName && reachableTypes.add(argTypeName);
|
3236
3299
|
}
|
3237
3300
|
}
|
3238
|
-
return reachableTypesCache
|
3301
|
+
return reachableTypesCache.set(schema15, reachableTypes), reachableTypes;
|
3239
3302
|
}
|
3240
3303
|
var rule15 = {
|
3241
3304
|
meta: {
|
@@ -3314,12 +3377,13 @@ var rule15 = {
|
|
3314
3377
|
}
|
3315
3378
|
};
|
3316
3379
|
|
3317
|
-
// src/rules/no-unused-fields.ts
|
3380
|
+
// src/rules/no-unused-fields/index.ts
|
3318
3381
|
import { TypeInfo as TypeInfo2, visit as visit6, visitWithTypeInfo as visitWithTypeInfo2 } from "graphql";
|
3319
|
-
var RULE_ID10 = "no-unused-fields", usedFieldsCache;
|
3382
|
+
var RULE_ID10 = "no-unused-fields", usedFieldsCache = new ModuleCache();
|
3320
3383
|
function getUsedFields(schema15, operations) {
|
3321
|
-
|
3322
|
-
|
3384
|
+
let cachedValue = usedFieldsCache.get(schema15);
|
3385
|
+
if (cachedValue)
|
3386
|
+
return cachedValue;
|
3323
3387
|
let usedFields = /* @__PURE__ */ Object.create(null), typeInfo = new TypeInfo2(schema15), visitor = visitWithTypeInfo2(typeInfo, {
|
3324
3388
|
Field(node) {
|
3325
3389
|
if (!typeInfo.getFieldDef())
|
@@ -3330,7 +3394,7 @@ function getUsedFields(schema15, operations) {
|
|
3330
3394
|
}), allDocuments = [...operations.getOperations(), ...operations.getFragments()];
|
3331
3395
|
for (let { document } of allDocuments)
|
3332
3396
|
visit6(document, visitor);
|
3333
|
-
return usedFieldsCache
|
3397
|
+
return usedFieldsCache.set(schema15, usedFields), usedFields;
|
3334
3398
|
}
|
3335
3399
|
var rule16 = {
|
3336
3400
|
meta: {
|
@@ -3423,7 +3487,7 @@ var rule16 = {
|
|
3423
3487
|
}
|
3424
3488
|
};
|
3425
3489
|
|
3426
|
-
// src/rules/relay-arguments.ts
|
3490
|
+
// src/rules/relay-arguments/index.ts
|
3427
3491
|
import { isScalarType as isScalarType2, Kind as Kind14 } from "graphql";
|
3428
3492
|
var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema8 = {
|
3429
3493
|
type: "array",
|
@@ -3526,7 +3590,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
|
|
3526
3590
|
}
|
3527
3591
|
};
|
3528
3592
|
|
3529
|
-
// src/rules/relay-connection-types.ts
|
3593
|
+
// src/rules/relay-connection-types/index.ts
|
3530
3594
|
import { Kind as Kind15 } from "graphql";
|
3531
3595
|
var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUST_CONTAIN_FIELD_EDGES", MUST_CONTAIN_FIELD_PAGE_INFO = "MUST_CONTAIN_FIELD_PAGE_INFO", MUST_HAVE_CONNECTION_SUFFIX = "MUST_HAVE_CONNECTION_SUFFIX", EDGES_FIELD_MUST_RETURN_LIST_TYPE = "EDGES_FIELD_MUST_RETURN_LIST_TYPE", PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE = "PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE", NON_OBJECT_TYPES = [
|
3532
3596
|
Kind15.SCALAR_TYPE_DEFINITION,
|
@@ -3613,7 +3677,7 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
|
|
3613
3677
|
}
|
3614
3678
|
};
|
3615
3679
|
|
3616
|
-
// src/rules/relay-edge-types.ts
|
3680
|
+
// src/rules/relay-edge-types/index.ts
|
3617
3681
|
import {
|
3618
3682
|
isObjectType as isObjectType2,
|
3619
3683
|
isScalarType as isScalarType3,
|
@@ -3757,7 +3821,7 @@ var schema9 = {
|
|
3757
3821
|
}
|
3758
3822
|
};
|
3759
3823
|
|
3760
|
-
// src/rules/relay-page-info.ts
|
3824
|
+
// src/rules/relay-page-info/index.ts
|
3761
3825
|
import { isScalarType as isScalarType4, Kind as Kind17 } from "graphql";
|
3762
3826
|
var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", MESSAGE_MUST_BE_OBJECT_TYPE2 = "MESSAGE_MUST_BE_OBJECT_TYPE", notPageInfoTypesSelector = `:matches(${NON_OBJECT_TYPES})[name.value=PageInfo] > .name`, hasPageInfoChecked = !1, rule20 = {
|
3763
3827
|
meta: {
|
@@ -3830,7 +3894,7 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
|
|
3830
3894
|
}
|
3831
3895
|
};
|
3832
3896
|
|
3833
|
-
// src/rules/require-deprecation-date.ts
|
3897
|
+
// src/rules/require-deprecation-date/index.ts
|
3834
3898
|
var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIRE_DATE", MESSAGE_INVALID_FORMAT = "MESSAGE_INVALID_FORMAT", MESSAGE_INVALID_DATE = "MESSAGE_INVALID_DATE", MESSAGE_CAN_BE_REMOVED = "MESSAGE_CAN_BE_REMOVED", schema10 = {
|
3835
3899
|
type: "array",
|
3836
3900
|
maxItems: 1,
|
@@ -3955,7 +4019,7 @@ var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIR
|
|
3955
4019
|
}
|
3956
4020
|
};
|
3957
4021
|
|
3958
|
-
// src/rules/require-deprecation-reason.ts
|
4022
|
+
// src/rules/require-deprecation-reason/index.ts
|
3959
4023
|
var rule22 = {
|
3960
4024
|
meta: {
|
3961
4025
|
docs: {
|
@@ -4017,7 +4081,7 @@ var rule22 = {
|
|
4017
4081
|
}
|
4018
4082
|
};
|
4019
4083
|
|
4020
|
-
// src/rules/require-description.ts
|
4084
|
+
// src/rules/require-description/index.ts
|
4021
4085
|
import { Kind as Kind18, TokenKind as TokenKind3 } from "graphql";
|
4022
4086
|
import { getRootTypeNames } from "@graphql-tools/utils";
|
4023
4087
|
var RULE_ID14 = "require-description", ALLOWED_KINDS2 = [
|
@@ -4172,7 +4236,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
4172
4236
|
}
|
4173
4237
|
};
|
4174
4238
|
|
4175
|
-
// src/rules/require-field-of-type-query-in-mutation-result.ts
|
4239
|
+
// src/rules/require-field-of-type-query-in-mutation-result/index.ts
|
4176
4240
|
import { isObjectType as isObjectType3 } from "graphql";
|
4177
4241
|
var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
|
4178
4242
|
meta: {
|
@@ -4237,8 +4301,8 @@ var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
|
|
4237
4301
|
}
|
4238
4302
|
};
|
4239
4303
|
|
4240
|
-
// src/rules/require-import-fragment.ts
|
4241
|
-
import path from "path";
|
4304
|
+
// src/rules/require-import-fragment/index.ts
|
4305
|
+
import path from "node:path";
|
4242
4306
|
var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expression", rule25 = {
|
4243
4307
|
meta: {
|
4244
4308
|
type: "suggestion",
|
@@ -4323,7 +4387,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
|
|
4323
4387
|
).test(comment.value)) continue;
|
4324
4388
|
let extractedImportPath = comment.value.match(/(["'])((?:\1|.)*?)\1/)?.[2];
|
4325
4389
|
if (!extractedImportPath) continue;
|
4326
|
-
let importPath = path.join(
|
4390
|
+
let importPath = path.join(filePath, "..", extractedImportPath);
|
4327
4391
|
if (fragmentsFromSiblings.some(
|
4328
4392
|
(source) => source.filePath === importPath
|
4329
4393
|
)) return;
|
@@ -4331,7 +4395,12 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
|
|
4331
4395
|
if (fragmentsFromSiblings.some(
|
4332
4396
|
(source) => source.filePath === filePath
|
4333
4397
|
)) return;
|
4334
|
-
let suggestedFilePaths = fragmentsFromSiblings.length ? fragmentsFromSiblings.map(
|
4398
|
+
let suggestedFilePaths = fragmentsFromSiblings.length ? fragmentsFromSiblings.map(
|
4399
|
+
(o) => (
|
4400
|
+
// Use always forward slash for suggested import path
|
4401
|
+
slash(path.relative(path.dirname(filePath), o.filePath))
|
4402
|
+
)
|
4403
|
+
) : ["CHANGE_ME.graphql"];
|
4335
4404
|
context.report({
|
4336
4405
|
node,
|
4337
4406
|
messageId: RULE_ID16,
|
@@ -4351,7 +4420,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
|
|
4351
4420
|
}
|
4352
4421
|
};
|
4353
4422
|
|
4354
|
-
// src/rules/require-nullable-fields-with-oneof.ts
|
4423
|
+
// src/rules/require-nullable-fields-with-oneof/index.ts
|
4355
4424
|
import { Kind as Kind19 } from "graphql";
|
4356
4425
|
var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
|
4357
4426
|
meta: {
|
@@ -4410,7 +4479,7 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
|
|
4410
4479
|
}
|
4411
4480
|
};
|
4412
4481
|
|
4413
|
-
// src/rules/require-nullable-result-in-root.ts
|
4482
|
+
// src/rules/require-nullable-result-in-root/index.ts
|
4414
4483
|
import { Kind as Kind20 } from "graphql";
|
4415
4484
|
var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
|
4416
4485
|
meta: {
|
@@ -4487,7 +4556,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
|
|
4487
4556
|
}
|
4488
4557
|
};
|
4489
4558
|
|
4490
|
-
// src/rules/require-selections.ts
|
4559
|
+
// src/rules/require-selections/index.ts
|
4491
4560
|
import {
|
4492
4561
|
GraphQLInterfaceType,
|
4493
4562
|
GraphQLObjectType,
|
@@ -4613,13 +4682,19 @@ Include it in your selection set{{ addition }}.`
|
|
4613
4682
|
let rawType = getBaseType(type);
|
4614
4683
|
if (rawType instanceof GraphQLObjectType || rawType instanceof GraphQLInterfaceType)
|
4615
4684
|
checkFields(rawType);
|
4616
|
-
else if (rawType instanceof GraphQLUnionType)
|
4617
|
-
for (let selection of node.selections)
|
4685
|
+
else if (rawType instanceof GraphQLUnionType)
|
4686
|
+
for (let selection of node.selections) {
|
4687
|
+
let types = rawType.getTypes();
|
4618
4688
|
if (selection.kind === Kind21.INLINE_FRAGMENT) {
|
4619
|
-
let t =
|
4689
|
+
let t = types.find((t2) => t2.name === selection.typeCondition.name.value);
|
4620
4690
|
t && checkFields(t);
|
4691
|
+
} else if (selection.kind === Kind21.FRAGMENT_SPREAD) {
|
4692
|
+
let [foundSpread] = siblings.getFragment(selection.name.value);
|
4693
|
+
if (!foundSpread) return;
|
4694
|
+
let fragmentSpread = foundSpread.document, t = fragmentSpread.typeCondition.name.value === rawType.name ? rawType : types.find((t2) => t2.name === fragmentSpread.typeCondition.name.value);
|
4695
|
+
checkedFragmentSpreads.add(fragmentSpread.name.value), checkSelections(fragmentSpread.selectionSet, t, loc, parent, checkedFragmentSpreads);
|
4621
4696
|
}
|
4622
|
-
|
4697
|
+
}
|
4623
4698
|
function checkFields(rawType2) {
|
4624
4699
|
let fields = rawType2.getFields();
|
4625
4700
|
if (!idNames.some((name) => fields[name]))
|
@@ -4672,7 +4747,7 @@ Include it in your selection set{{ addition }}.`
|
|
4672
4747
|
}
|
4673
4748
|
};
|
4674
4749
|
|
4675
|
-
// src/rules/require-type-pattern-with-oneof.ts
|
4750
|
+
// src/rules/require-type-pattern-with-oneof/index.ts
|
4676
4751
|
var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
|
4677
4752
|
meta: {
|
4678
4753
|
type: "suggestion",
|
@@ -4732,7 +4807,7 @@ var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
|
|
4732
4807
|
}
|
4733
4808
|
};
|
4734
4809
|
|
4735
|
-
// src/rules/selection-set-depth.ts
|
4810
|
+
// src/rules/selection-set-depth/index.ts
|
4736
4811
|
import { Kind as Kind22 } from "graphql";
|
4737
4812
|
import depthLimit from "graphql-depth-limit";
|
4738
4813
|
var RULE_ID21 = "selection-set-depth", schema13 = {
|
@@ -4825,7 +4900,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
|
|
4825
4900
|
checkFn({
|
4826
4901
|
getDocument: () => document,
|
4827
4902
|
reportError(error) {
|
4828
|
-
let { line, column } = error.locations[0], token = context.getAncestors()[0].tokens.find(
|
4903
|
+
let { line, column } = error.locations[0], token = context.sourceCode.getAncestors(node)[0].tokens.find(
|
4829
4904
|
(token2) => token2.loc.start.line === line && token2.loc.start.column === column - 1
|
4830
4905
|
);
|
4831
4906
|
context.report({
|
@@ -4862,7 +4937,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
|
|
4862
4937
|
}
|
4863
4938
|
};
|
4864
4939
|
|
4865
|
-
// src/rules/strict-id-in-types.ts
|
4940
|
+
// src/rules/strict-id-in-types/index.ts
|
4866
4941
|
import { Kind as Kind23 } from "graphql";
|
4867
4942
|
var RULE_ID22 = "strict-id-in-types", schema14 = {
|
4868
4943
|
type: "array",
|
@@ -5007,7 +5082,7 @@ Accepted type${pluralTypesSuffix}: ${englishJoinWords(options.acceptedIdTypes)}.
|
|
5007
5082
|
}
|
5008
5083
|
};
|
5009
5084
|
|
5010
|
-
// src/rules/unique-enum-value-names.ts
|
5085
|
+
// src/rules/unique-enum-value-names/index.ts
|
5011
5086
|
import { Kind as Kind24 } from "graphql";
|
5012
5087
|
var rule32 = {
|
5013
5088
|
meta: {
|
@@ -5076,12 +5151,12 @@ var rule32 = {
|
|
5076
5151
|
}
|
5077
5152
|
};
|
5078
5153
|
|
5079
|
-
// src/rules/unique-fragment-name.ts
|
5080
|
-
import { relative as relative2 } from "path";
|
5154
|
+
// src/rules/unique-fragment-name/index.ts
|
5155
|
+
import { relative as relative2 } from "node:path";
|
5081
5156
|
import { Kind as Kind25 } from "graphql";
|
5082
5157
|
var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
|
5083
5158
|
let documentName = node.name.value, siblings = requireSiblingsOperations(ruleId, context), siblingDocuments = node.kind === Kind25.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName), filepath = context.filename, conflictingDocuments = siblingDocuments.filter((f) => {
|
5084
|
-
let isSameName = f.document.name?.value === documentName, isSamePath =
|
5159
|
+
let isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
|
5085
5160
|
return isSameName && !isSamePath;
|
5086
5161
|
});
|
5087
5162
|
conflictingDocuments.length > 0 && context.report({
|
@@ -5159,7 +5234,7 @@ var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
|
|
5159
5234
|
}
|
5160
5235
|
};
|
5161
5236
|
|
5162
|
-
// src/rules/unique-operation-name.ts
|
5237
|
+
// src/rules/unique-operation-name/index.ts
|
5163
5238
|
var RULE_ID24 = "unique-operation-name", rule34 = {
|
5164
5239
|
meta: {
|
5165
5240
|
type: "suggestion",
|
@@ -5269,50 +5344,36 @@ var rules = {
|
|
5269
5344
|
};
|
5270
5345
|
|
5271
5346
|
// src/configs/index.ts
|
5272
|
-
var import_operations_all = __toESM(require_operations_all()), import_operations_recommended = __toESM(require_operations_recommended()), import_schema_all = __toESM(require_schema_all()), import_schema_recommended = __toESM(require_schema_recommended()), import_schema_relay = __toESM(require_schema_relay()), configs = {
|
5347
|
+
var import_operations_all = __toESM(require_operations_all(), 1), import_operations_recommended = __toESM(require_operations_recommended(), 1), import_schema_all = __toESM(require_schema_all(), 1), import_schema_recommended = __toESM(require_schema_recommended(), 1), import_schema_relay = __toESM(require_schema_relay(), 1), configs = {
|
5273
5348
|
"schema-recommended": import_schema_recommended.default,
|
5274
5349
|
"schema-all": import_schema_all.default,
|
5275
5350
|
"schema-relay": import_schema_relay.default,
|
5276
5351
|
"operations-recommended": import_operations_recommended.default,
|
5277
|
-
"operations-all": import_operations_all.default
|
5278
|
-
|
5279
|
-
|
5280
|
-
|
5281
|
-
|
5282
|
-
parser: { parseForESLint }
|
5283
|
-
}, flatConfigs = {
|
5284
|
-
"operations-all": {
|
5285
|
-
languageOptions,
|
5352
|
+
"operations-all": import_operations_all.default,
|
5353
|
+
"flat/schema-recommended": {
|
5354
|
+
rules: import_schema_recommended.default.rules
|
5355
|
+
},
|
5356
|
+
"flat/schema-all": {
|
5286
5357
|
rules: {
|
5287
|
-
...
|
5288
|
-
...
|
5358
|
+
...import_schema_recommended.default.rules,
|
5359
|
+
...import_schema_all.default.rules
|
5289
5360
|
}
|
5290
5361
|
},
|
5291
|
-
"
|
5292
|
-
|
5293
|
-
rules: configs["operations-recommended"].rules
|
5362
|
+
"flat/schema-relay": {
|
5363
|
+
rules: import_schema_relay.default.rules
|
5294
5364
|
},
|
5295
|
-
"
|
5296
|
-
|
5297
|
-
rules: configs["schema-relay"].rules
|
5365
|
+
"flat/operations-recommended": {
|
5366
|
+
rules: import_operations_recommended.default.rules
|
5298
5367
|
},
|
5299
|
-
"
|
5300
|
-
languageOptions,
|
5368
|
+
"flat/operations-all": {
|
5301
5369
|
rules: {
|
5302
|
-
...
|
5303
|
-
...
|
5370
|
+
...import_operations_recommended.default.rules,
|
5371
|
+
...import_operations_all.default.rules
|
5304
5372
|
}
|
5305
|
-
},
|
5306
|
-
"schema-recommended": {
|
5307
|
-
languageOptions,
|
5308
|
-
rules: configs["schema-recommended"].rules
|
5309
5373
|
}
|
5310
5374
|
};
|
5311
5375
|
export {
|
5312
5376
|
configs,
|
5313
|
-
|
5314
|
-
parseForESLint,
|
5315
|
-
requireGraphQLSchemaFromContext,
|
5316
|
-
requireSiblingsOperations,
|
5377
|
+
parser,
|
5317
5378
|
rules
|
5318
5379
|
};
|