@graphql-eslint/eslint-plugin 4.0.0-alpha.5 → 4.0.0-alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/cache.js +8 -36
- package/cjs/chunk-UIAXBAMD.js +8 -0
- package/cjs/configs/index.d.cts +15 -5
- package/cjs/configs/index.js +31 -45
- 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 +12 -37
- package/cjs/estree-converter/converter.js +16 -30
- package/cjs/estree-converter/index.js +3 -23
- package/cjs/estree-converter/types.js +1 -14
- package/cjs/estree-converter/utils.js +22 -40
- package/cjs/graphql-config.js +15 -41
- package/cjs/index.d.cts +165 -10
- package/cjs/index.js +24 -41
- package/cjs/meta.d.cts +1 -1
- package/cjs/meta.js +5 -34
- package/cjs/parser.d.cts +1 -1
- package/cjs/parser.js +29 -49
- package/cjs/processor.d.cts +1 -1
- package/cjs/processor.js +22 -35
- package/{esm/rules/alphabetize.d.ts → cjs/rules/alphabetize/index.d.cts} +3 -3
- package/cjs/rules/{alphabetize.js → alphabetize/index.js} +47 -71
- package/{esm/rules/description-style.d.ts → cjs/rules/description-style/index.d.cts} +3 -3
- package/cjs/rules/{description-style.js → description-style/index.js} +7 -27
- package/cjs/rules/graphql-js-validation.js +93 -70
- package/cjs/rules/index.d.cts +5 -5
- package/cjs/rules/index.js +74 -60
- package/{esm/rules/input-name.d.ts → cjs/rules/input-name/index.d.cts} +3 -3
- package/cjs/rules/{input-name.js → input-name/index.js} +10 -28
- package/{esm/rules/lone-executable-definition.d.ts → cjs/rules/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.cts → match-document-filename/index.d.cts} +4 -4
- package/cjs/rules/{match-document-filename.js → match-document-filename/index.js} +20 -34
- package/{esm/rules/naming-convention.d.ts → cjs/rules/naming-convention/index.d.cts} +3 -3
- 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/cjs/rules/{no-deprecated.d.cts → 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.cts → 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.cts → 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} +12 -30
- package/{esm/rules/relay-arguments.d.ts → 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.ts → 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/{esm/rules/relay-edge-types.d.ts → cjs/rules/relay-edge-types/index.d.cts} +3 -3
- package/cjs/rules/{relay-edge-types.js → relay-edge-types/index.js} +30 -43
- package/cjs/rules/relay-page-info/index.d.cts +13 -0
- package/cjs/rules/{relay-page-info.js → relay-page-info/index.js} +12 -30
- package/{esm/rules/require-deprecation-date.d.ts → 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/cjs/rules/{require-description.d.cts → 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} +11 -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/cjs/rules/{require-selections.d.cts → require-selections/index.d.cts} +3 -3
- package/cjs/rules/{require-selections.js → require-selections/index.js} +38 -43
- 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.ts → cjs/rules/selection-set-depth/index.d.cts} +3 -3
- package/cjs/rules/{selection-set-depth.js → selection-set-depth/index.js} +15 -41
- package/cjs/rules/{strict-id-in-types.d.cts → strict-id-in-types/index.d.cts} +3 -3
- 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.ts → 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/cjs/schema.js +11 -36
- package/cjs/siblings.js +17 -33
- package/cjs/types.js +1 -14
- package/cjs/utils.d.cts +2 -2
- package/cjs/utils.js +71 -115
- package/esm/configs/index.d.ts +15 -5
- package/esm/configs/index.js +17 -7
- package/esm/index.d.ts +165 -10
- package/esm/index.js +9 -2
- package/esm/meta.d.ts +1 -1
- package/esm/meta.js +1 -2
- package/esm/parser.d.ts +1 -1
- package/esm/processor.d.ts +1 -1
- package/{cjs/rules/alphabetize.d.cts → esm/rules/alphabetize/index.d.ts} +3 -3
- package/esm/rules/{alphabetize.js → alphabetize/index.js} +2 -2
- package/{cjs/rules/description-style.d.cts → esm/rules/description-style/index.d.ts} +3 -3
- package/esm/rules/{description-style.js → description-style/index.js} +2 -2
- package/esm/rules/index.d.ts +5 -5
- package/esm/rules/index.js +34 -34
- package/{cjs/rules/input-name.d.cts → esm/rules/input-name/index.d.ts} +3 -3
- package/esm/rules/{input-name.js → input-name/index.js} +1 -1
- package/{cjs/rules/lone-executable-definition.d.cts → esm/rules/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.ts → match-document-filename/index.d.ts} +4 -4
- package/esm/rules/{match-document-filename.js → match-document-filename/index.js} +2 -2
- package/{cjs/rules/naming-convention.d.cts → esm/rules/naming-convention/index.d.ts} +3 -3
- package/esm/rules/{naming-convention.js → naming-convention/index.js} +2 -2
- package/{cjs/rules/no-anonymous-operations.d.cts → 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/esm/rules/{no-deprecated.d.ts → no-deprecated/index.d.ts} +3 -3
- package/esm/rules/{no-deprecated.js → no-deprecated/index.js} +2 -2
- package/{cjs/rules/no-one-place-fragments.d.cts → 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.ts → 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-duplicate-fields.d.cts → 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.ts → 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-scalar-result-type-on-mutation.d.cts → 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} +3 -3
- package/esm/rules/no-unused-fields/index.d.ts +13 -0
- package/esm/rules/{no-unused-fields.js → no-unused-fields/index.js} +3 -3
- package/{cjs/rules/relay-arguments.d.cts → 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.cts → 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/{cjs/rules/relay-edge-types.d.cts → esm/rules/relay-edge-types/index.d.ts} +3 -3
- package/esm/rules/{relay-edge-types.js → relay-edge-types/index.js} +2 -2
- package/esm/rules/relay-page-info/index.d.ts +13 -0
- package/esm/rules/{relay-page-info.js → relay-page-info/index.js} +3 -3
- package/{cjs/rules/require-deprecation-date.d.cts → 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/esm/rules/{require-description.d.ts → 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} +2 -2
- 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/esm/rules/{require-selections.d.ts → require-selections/index.d.ts} +3 -3
- package/esm/rules/{require-selections.js → require-selections/index.js} +3 -4
- 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.cts → esm/rules/selection-set-depth/index.d.ts} +3 -3
- package/esm/rules/{selection-set-depth.js → selection-set-depth/index.js} +2 -2
- package/esm/rules/{strict-id-in-types.d.ts → strict-id-in-types/index.d.ts} +3 -3
- 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.cts → 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/esm/utils.d.ts +2 -2
- package/esm/utils.js +2 -2
- package/index.browser.js +54 -115
- package/package.json +2 -2
- package/cjs/rules/no-scalar-result-type-on-mutation.js +0 -88
- package/cjs/rules/no-typename-prefix.d.cts +0 -13
- package/cjs/rules/no-unreachable-types.d.cts +0 -13
- package/cjs/rules/no-unreachable-types.js +0 -175
- package/cjs/rules/no-unused-fields.d.cts +0 -13
- package/cjs/rules/relay-page-info.d.cts +0 -13
- package/cjs/rules/require-deprecation-reason.d.cts +0 -13
- package/cjs/rules/require-deprecation-reason.js +0 -85
- package/cjs/rules/require-field-of-type-query-in-mutation-result.d.cts +0 -13
- package/cjs/rules/require-import-fragment.d.cts +0 -13
- package/cjs/rules/require-nullable-fields-with-oneof.d.cts +0 -13
- package/cjs/rules/require-nullable-fields-with-oneof.js +0 -81
- package/cjs/rules/require-nullable-result-in-root.d.cts +0 -13
- package/cjs/rules/require-type-pattern-with-oneof.d.cts +0 -13
- package/cjs/rules/require-type-pattern-with-oneof.js +0 -83
- package/cjs/rules/unique-enum-value-names.d.cts +0 -13
- package/cjs/rules/unique-fragment-name.js +0 -106
- package/cjs/rules/unique-operation-name.d.cts +0 -13
- package/esm/rules/no-anonymous-operations.d.ts +0 -13
- package/esm/rules/no-duplicate-fields.d.ts +0 -13
- package/esm/rules/no-one-place-fragments.d.ts +0 -13
- package/esm/rules/no-scalar-result-type-on-mutation.d.ts +0 -13
- package/esm/rules/no-typename-prefix.d.ts +0 -13
- package/esm/rules/no-unreachable-types.d.ts +0 -13
- package/esm/rules/no-unused-fields.d.ts +0 -13
- package/esm/rules/relay-page-info.d.ts +0 -13
- package/esm/rules/require-deprecation-reason.d.ts +0 -13
- package/esm/rules/require-field-of-type-query-in-mutation-result.d.ts +0 -13
- package/esm/rules/require-import-fragment.d.ts +0 -13
- package/esm/rules/require-nullable-fields-with-oneof.d.ts +0 -13
- package/esm/rules/require-nullable-result-in-root.d.ts +0 -13
- package/esm/rules/require-type-pattern-with-oneof.d.ts +0 -13
- package/esm/rules/unique-enum-value-names.d.ts +0 -13
- package/esm/rules/unique-operation-name.d.ts +0 -13
package/cjs/meta.js
CHANGED
@@ -1,34 +1,5 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
10
|
-
}, __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from == "object" || typeof from == "function")
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
return to;
|
15
|
-
};
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
22
|
-
mod
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
24
|
-
var meta_exports = {};
|
25
|
-
__export(meta_exports, {
|
26
|
-
version: () => version
|
27
|
-
});
|
28
|
-
module.exports = __toCommonJS(meta_exports);
|
29
|
-
var import_package = __toESM(require("../package.json"), 1);
|
30
|
-
const { version } = import_package.default;
|
31
|
-
// Annotate the CommonJS export names for ESM import in node:
|
32
|
-
0 && (module.exports = {
|
33
|
-
version
|
34
|
-
});
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-UIAXBAMD.js');
|
2
|
+
const version = "4.0.0-alpha.7";
|
3
|
+
|
4
|
+
|
5
|
+
exports.version = version;
|
package/cjs/parser.d.cts
CHANGED
package/cjs/parser.js
CHANGED
@@ -1,35 +1,16 @@
|
|
1
|
-
"use strict";
|
2
|
-
var
|
3
|
-
var
|
4
|
-
var
|
5
|
-
var
|
6
|
-
var
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return to;
|
15
|
-
};
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
22
|
-
mod
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
24
|
-
var parser_exports = {};
|
25
|
-
__export(parser_exports, {
|
26
|
-
parseForESLint: () => parseForESLint,
|
27
|
-
parser: () => parser
|
28
|
-
});
|
29
|
-
module.exports = __toCommonJS(parser_exports);
|
30
|
-
var import_debug = __toESM(require("debug"), 1), import_graphql = require("graphql"), import_utils = require("@graphql-tools/utils"), import_documents = require("./documents.js"), import_estree_converter = require("./estree-converter/index.js"), import_graphql_config2 = require("./graphql-config.js"), import_meta = require("./meta.js"), import_schema = require("./schema.js"), import_siblings = require("./siblings.js"), import_utils2 = require("./utils.js");
|
31
|
-
const debug = (0, import_debug.default)("graphql-eslint:parser");
|
32
|
-
debug("cwd %o", import_utils2.CWD);
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-UIAXBAMD.js');
|
2
|
+
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
3
|
+
var _graphql = require('graphql');
|
4
|
+
var _utils = require('@graphql-tools/utils');
|
5
|
+
var _documentsjs = require('./documents.js');
|
6
|
+
var _indexjs = require('./estree-converter/index.js');
|
7
|
+
var _graphqlconfigjs = require('./graphql-config.js');
|
8
|
+
var _metajs = require('./meta.js');
|
9
|
+
var _schemajs = require('./schema.js');
|
10
|
+
var _siblingsjs = require('./siblings.js');
|
11
|
+
var _utilsjs = require('./utils.js');
|
12
|
+
const debug = _debug2.default.call(void 0, "graphql-eslint:parser");
|
13
|
+
debug("cwd %o", _utilsjs.CWD);
|
33
14
|
const LEGACY_PARSER_OPTIONS_KEYS = [
|
34
15
|
"schema",
|
35
16
|
"documents",
|
@@ -49,26 +30,26 @@ function parseForESLint(code, options) {
|
|
49
30
|
`\`parserOptions.${key}\` was removed in graphql-eslint@4. Use physical graphql-config for setting schema and documents or \`parserOptions.graphQLConfig\` for programmatic usage.`
|
50
31
|
);
|
51
32
|
try {
|
52
|
-
const { filePath } = options, { document } = (0,
|
33
|
+
const { filePath } = options, { document } = _utils.parseGraphQLSDL.call(void 0, filePath, code, { noLocation: !1 });
|
53
34
|
let project, schema, documents;
|
54
35
|
{
|
55
|
-
const gqlConfig = (0,
|
56
|
-
project = gqlConfig.getProjectForFile(realFilepath), documents = (0,
|
36
|
+
const gqlConfig = _graphqlconfigjs.loadGraphQLConfig.call(void 0, options), realFilepath = filePath.replace(_utilsjs.VIRTUAL_DOCUMENT_REGEX, "");
|
37
|
+
project = gqlConfig.getProjectForFile(realFilepath), documents = _documentsjs.getDocuments.call(void 0, project);
|
57
38
|
}
|
58
39
|
try {
|
59
|
-
schema = (0,
|
40
|
+
schema = _schemajs.getSchema.call(void 0, project);
|
60
41
|
} catch (error) {
|
61
42
|
throw error instanceof Error && (error.message = `Error while loading schema: ${error.message}`), error;
|
62
43
|
}
|
63
|
-
const rootTree = (0,
|
44
|
+
const rootTree = _indexjs.convertToESTree.call(void 0, document, schema);
|
64
45
|
return {
|
65
46
|
services: {
|
66
47
|
schema,
|
67
|
-
siblingOperations: (0,
|
48
|
+
siblingOperations: _siblingsjs.getSiblings.call(void 0, documents)
|
68
49
|
},
|
69
50
|
ast: {
|
70
|
-
comments: (0,
|
71
|
-
tokens: (0,
|
51
|
+
comments: _indexjs.extractComments.call(void 0, document.loc),
|
52
|
+
tokens: _indexjs.extractTokens.call(void 0, filePath, code),
|
72
53
|
loc: rootTree.loc,
|
73
54
|
range: rootTree.range,
|
74
55
|
type: "Program",
|
@@ -77,10 +58,10 @@ function parseForESLint(code, options) {
|
|
77
58
|
}
|
78
59
|
};
|
79
60
|
} catch (error) {
|
80
|
-
if (error instanceof Error && (error.message = `[graphql-eslint] ${error.message}`), error instanceof
|
81
|
-
const location = error.locations
|
61
|
+
if (error instanceof Error && (error.message = `[graphql-eslint] ${error.message}`), error instanceof _graphql.GraphQLError) {
|
62
|
+
const location = _optionalChain([error, 'access', _ => _.locations, 'optionalAccess', _2 => _2[0]]);
|
82
63
|
throw {
|
83
|
-
index: error.positions
|
64
|
+
index: _optionalChain([error, 'access', _3 => _3.positions, 'optionalAccess', _4 => _4[0]]),
|
84
65
|
...location && {
|
85
66
|
lineNumber: location.line,
|
86
67
|
column: location.column - 1
|
@@ -95,11 +76,10 @@ const parser = {
|
|
95
76
|
parseForESLint,
|
96
77
|
meta: {
|
97
78
|
name: "@graphql-eslint/parser",
|
98
|
-
version:
|
79
|
+
version: _metajs.version
|
99
80
|
}
|
100
81
|
};
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
});
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
exports.parseForESLint = parseForESLint; exports.parser = parser;
|
package/cjs/processor.d.cts
CHANGED
package/cjs/processor.js
CHANGED
@@ -1,36 +1,24 @@
|
|
1
|
-
"use strict";
|
2
|
-
var
|
3
|
-
|
4
|
-
|
5
|
-
var
|
6
|
-
var
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
-
return to;
|
14
|
-
};
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
16
|
-
var processor_exports = {};
|
17
|
-
__export(processor_exports, {
|
18
|
-
processor: () => processor
|
19
|
-
});
|
20
|
-
module.exports = __toCommonJS(processor_exports);
|
21
|
-
var import_node_path = require("node:path"), import_graphql_tag_pluck = require("@graphql-tools/graphql-tag-pluck"), import_utils = require("@graphql-tools/utils"), import_graphql_config2 = require("./graphql-config.js"), import_meta = require("./meta.js"), import_utils2 = require("./utils.js");
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-UIAXBAMD.js');
|
2
|
+
var _nodepath = require('node:path');
|
3
|
+
|
4
|
+
|
5
|
+
var _graphqltagpluck = require('@graphql-tools/graphql-tag-pluck');
|
6
|
+
var _utils = require('@graphql-tools/utils');
|
7
|
+
var _graphqlconfigjs = require('./graphql-config.js');
|
8
|
+
var _metajs = require('./meta.js');
|
9
|
+
var _utilsjs = require('./utils.js');
|
22
10
|
const blocksMap = /* @__PURE__ */ new Map();
|
23
11
|
let onDiskConfig, onDiskConfigLoaded = !1;
|
24
|
-
const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = {
|
12
|
+
const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = exports.processor = {
|
25
13
|
meta: {
|
26
14
|
name: "@graphql-eslint/processor",
|
27
|
-
version:
|
15
|
+
version: _metajs.version
|
28
16
|
},
|
29
17
|
supportsAutofix: !0,
|
30
18
|
preprocess(code, filePath) {
|
31
|
-
onDiskConfigLoaded || (onDiskConfig = (0,
|
19
|
+
onDiskConfigLoaded || (onDiskConfig = _graphqlconfigjs.loadOnDiskGraphQLConfig.call(void 0, filePath), onDiskConfigLoaded = !0);
|
32
20
|
let keywords = RELEVANT_KEYWORDS;
|
33
|
-
const pluckConfig = onDiskConfig
|
21
|
+
const pluckConfig = _optionalChain([onDiskConfig, 'optionalAccess', _ => _.getProjectForFile, 'call', _2 => _2(filePath), 'access', _3 => _3.extensions, 'access', _4 => _4.pluckConfig]);
|
34
22
|
if (pluckConfig) {
|
35
23
|
const {
|
36
24
|
modules = [],
|
@@ -41,16 +29,16 @@ const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = {
|
|
41
29
|
...new Set(
|
42
30
|
[
|
43
31
|
...modules.map(({ identifier }) => identifier),
|
44
|
-
...(0,
|
32
|
+
..._utils.asArray.call(void 0, globalGqlIdentifierName),
|
45
33
|
gqlMagicComment
|
46
|
-
].filter(
|
34
|
+
].filter(_utilsjs.truthy)
|
47
35
|
)
|
48
36
|
];
|
49
37
|
}
|
50
38
|
if (keywords.every((keyword) => !code.includes(keyword)))
|
51
39
|
return [code];
|
52
40
|
try {
|
53
|
-
const blocks = (0,
|
41
|
+
const blocks = _graphqltagpluck.gqlPluckFromCodeStringSync.call(void 0, filePath, code, {
|
54
42
|
skipIndent: !0,
|
55
43
|
...pluckConfig
|
56
44
|
}).map((item) => ({
|
@@ -66,8 +54,8 @@ const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = {
|
|
66
54
|
/* source code must be provided and be last */
|
67
55
|
];
|
68
56
|
} catch (error) {
|
69
|
-
return error instanceof Error && (error.message = `[graphql-eslint] Error while preprocessing "${(0,
|
70
|
-
|
57
|
+
return error instanceof Error && (error.message = `[graphql-eslint] Error while preprocessing "${_nodepath.relative.call(void 0,
|
58
|
+
_utilsjs.CWD,
|
71
59
|
filePath
|
72
60
|
)}" file
|
73
61
|
|
@@ -80,7 +68,7 @@ ${error.message}`), console.error(error), [code];
|
|
80
68
|
const { lineOffset, offset } = blocks[i];
|
81
69
|
for (const message of messages[i] || []) {
|
82
70
|
if (/\.(vue|svelte)$/.test(filePath)) {
|
83
|
-
delete message.endLine, delete message.endColumn, delete message.fix, delete message.suggestions, Object.assign(message,
|
71
|
+
delete message.endLine, delete message.endColumn, delete message.fix, delete message.suggestions, Object.assign(message, _utilsjs.REPORT_ON_FIRST_CHARACTER);
|
84
72
|
continue;
|
85
73
|
}
|
86
74
|
message.line += lineOffset, typeof message.endLine == "number" && (message.endLine += lineOffset), message.fix && (message.fix.range[0] += offset, message.fix.range[1] += offset);
|
@@ -93,7 +81,6 @@ ${error.message}`), console.error(error), [code];
|
|
93
81
|
return messages.flat().sort((a, b) => a.line - b.line || a.column - b.column);
|
94
82
|
}
|
95
83
|
};
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
});
|
84
|
+
|
85
|
+
|
86
|
+
exports.processor = processor;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
|
-
import { GraphQLESLintRule } from '
|
2
|
+
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import 'eslint';
|
4
4
|
import 'estree';
|
5
5
|
import 'graphql';
|
6
6
|
import 'graphql-config';
|
7
|
-
import '
|
8
|
-
import '
|
7
|
+
import '../../estree-converter/types.cjs';
|
8
|
+
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
11
11
|
declare const schema: {
|
@@ -1,44 +1,21 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
var
|
5
|
-
var
|
6
|
-
var
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
10
|
-
}, __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from == "object" || typeof from == "function")
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
return to;
|
15
|
-
};
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
22
|
-
mod
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
24
|
-
var alphabetize_exports = {};
|
25
|
-
__export(alphabetize_exports, {
|
26
|
-
rule: () => rule
|
27
|
-
});
|
28
|
-
module.exports = __toCommonJS(alphabetize_exports);
|
29
|
-
var import_graphql = require("graphql"), import_lodash = __toESM(require("lodash.lowercase"), 1), import_utils = require("../utils.js");
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../../chunk-UIAXBAMD.js');
|
2
|
+
|
3
|
+
|
4
|
+
var _graphql = require('graphql');
|
5
|
+
var _lodashlowercase = require('lodash.lowercase'); var _lodashlowercase2 = _interopRequireDefault(_lodashlowercase);
|
6
|
+
var _utilsjs = require('../../utils.js');
|
30
7
|
const RULE_ID = "alphabetize", fieldsEnum = [
|
31
|
-
|
32
|
-
|
33
|
-
|
8
|
+
_graphql.Kind.OBJECT_TYPE_DEFINITION,
|
9
|
+
_graphql.Kind.INTERFACE_TYPE_DEFINITION,
|
10
|
+
_graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION
|
34
11
|
], selectionsEnum = [
|
35
|
-
|
36
|
-
|
12
|
+
_graphql.Kind.OPERATION_DEFINITION,
|
13
|
+
_graphql.Kind.FRAGMENT_DEFINITION
|
37
14
|
], argumentsEnum = [
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
15
|
+
_graphql.Kind.FIELD_DEFINITION,
|
16
|
+
_graphql.Kind.FIELD,
|
17
|
+
_graphql.Kind.DIRECTIVE_DEFINITION,
|
18
|
+
_graphql.Kind.DIRECTIVE
|
42
19
|
], schema = {
|
43
20
|
type: "array",
|
44
21
|
minItems: 1,
|
@@ -49,7 +26,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
49
26
|
minProperties: 1,
|
50
27
|
properties: {
|
51
28
|
fields: {
|
52
|
-
...
|
29
|
+
..._utilsjs.ARRAY_DEFAULT_OPTIONS,
|
53
30
|
items: {
|
54
31
|
enum: fieldsEnum
|
55
32
|
},
|
@@ -60,7 +37,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
60
37
|
description: "Values of `enum`."
|
61
38
|
},
|
62
39
|
selections: {
|
63
|
-
...
|
40
|
+
..._utilsjs.ARRAY_DEFAULT_OPTIONS,
|
64
41
|
items: {
|
65
42
|
enum: selectionsEnum
|
66
43
|
},
|
@@ -71,7 +48,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
71
48
|
description: "Variables of operations `query`, `mutation` and `subscription`."
|
72
49
|
},
|
73
50
|
arguments: {
|
74
|
-
...
|
51
|
+
..._utilsjs.ARRAY_DEFAULT_OPTIONS,
|
75
52
|
items: {
|
76
53
|
enum: argumentsEnum
|
77
54
|
},
|
@@ -82,13 +59,13 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
82
59
|
description: "Definitions \u2013 `type`, `interface`, `enum`, `scalar`, `input`, `union` and `directive`."
|
83
60
|
},
|
84
61
|
groups: {
|
85
|
-
...
|
62
|
+
..._utilsjs.ARRAY_DEFAULT_OPTIONS,
|
86
63
|
minItems: 2,
|
87
64
|
description: "Custom order group. Example: `['id', '*', 'createdAt', 'updatedAt']` where `*` says for everything else."
|
88
65
|
}
|
89
66
|
}
|
90
67
|
}
|
91
|
-
}, rule = {
|
68
|
+
}, rule = exports.rule = {
|
92
69
|
meta: {
|
93
70
|
type: "suggestion",
|
94
71
|
fixable: "code",
|
@@ -99,7 +76,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
99
76
|
examples: [
|
100
77
|
{
|
101
78
|
title: "Incorrect",
|
102
|
-
usage: [{ fields: [
|
79
|
+
usage: [{ fields: [_graphql.Kind.OBJECT_TYPE_DEFINITION] }],
|
103
80
|
code: (
|
104
81
|
/* GraphQL */
|
105
82
|
`
|
@@ -114,7 +91,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
114
91
|
},
|
115
92
|
{
|
116
93
|
title: "Correct",
|
117
|
-
usage: [{ fields: [
|
94
|
+
usage: [{ fields: [_graphql.Kind.OBJECT_TYPE_DEFINITION] }],
|
118
95
|
code: (
|
119
96
|
/* GraphQL */
|
120
97
|
`
|
@@ -159,7 +136,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
159
136
|
},
|
160
137
|
{
|
161
138
|
title: "Incorrect",
|
162
|
-
usage: [{ selections: [
|
139
|
+
usage: [{ selections: [_graphql.Kind.OPERATION_DEFINITION] }],
|
163
140
|
code: (
|
164
141
|
/* GraphQL */
|
165
142
|
`
|
@@ -175,7 +152,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
175
152
|
},
|
176
153
|
{
|
177
154
|
title: "Correct",
|
178
|
-
usage: [{ selections: [
|
155
|
+
usage: [{ selections: [_graphql.Kind.OPERATION_DEFINITION] }],
|
179
156
|
code: (
|
180
157
|
/* GraphQL */
|
181
158
|
`
|
@@ -205,7 +182,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
205
182
|
definitions: !0,
|
206
183
|
selections: selectionsEnum,
|
207
184
|
variables: !0,
|
208
|
-
arguments: [
|
185
|
+
arguments: [_graphql.Kind.FIELD, _graphql.Kind.DIRECTIVE],
|
209
186
|
groups: ["id", "*", "createdAt", "updatedAt"]
|
210
187
|
}
|
211
188
|
]
|
@@ -238,20 +215,20 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
238
215
|
return filteredComments;
|
239
216
|
}
|
240
217
|
function getRangeWithComments(node) {
|
241
|
-
node.kind ===
|
218
|
+
node.kind === _graphql.Kind.VARIABLE && (node = node.parent);
|
242
219
|
const [firstBeforeComment] = getBeforeComments(node), [firstAfterComment] = sourceCode.getCommentsAfter(node), from = firstBeforeComment || node, to = firstAfterComment && isNodeAndCommentOnSameLine(node, firstAfterComment) ? firstAfterComment : node;
|
243
220
|
return [from.range[0], to.range[1]];
|
244
221
|
}
|
245
222
|
function checkNodes(nodes = []) {
|
246
223
|
for (let i = 1; i < nodes.length; i += 1) {
|
247
|
-
const currNode = nodes[i], currName = "alias" in currNode && currNode.alias
|
224
|
+
const currNode = nodes[i], currName = "alias" in currNode && _optionalChain([currNode, 'access', _ => _.alias, 'optionalAccess', _2 => _2.value]) || "name" in currNode && _optionalChain([currNode, 'access', _3 => _3.name, 'optionalAccess', _4 => _4.value]);
|
248
225
|
if (!currName)
|
249
226
|
continue;
|
250
|
-
const prevNode = nodes[i - 1], prevName = "alias" in prevNode && prevNode.alias
|
227
|
+
const prevNode = nodes[i - 1], prevName = "alias" in prevNode && _optionalChain([prevNode, 'access', _5 => _5.alias, 'optionalAccess', _6 => _6.value]) || "name" in prevNode && _optionalChain([prevNode, 'access', _7 => _7.name, 'optionalAccess', _8 => _8.value]);
|
251
228
|
if (prevName) {
|
252
229
|
const compareResult = prevName.localeCompare(currName), { groups } = opts;
|
253
230
|
let shouldSortByGroup = !1;
|
254
|
-
if (groups
|
231
|
+
if (_optionalChain([groups, 'optionalAccess', _9 => _9.length])) {
|
255
232
|
if (!groups.includes("*"))
|
256
233
|
throw new Error("`groups` option should contain `*` string.");
|
257
234
|
let indexForPrev = groups.indexOf(prevName);
|
@@ -268,8 +245,8 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
268
245
|
node: "alias" in currNode && currNode.alias || currNode.name,
|
269
246
|
messageId: RULE_ID,
|
270
247
|
data: {
|
271
|
-
currNode: (0,
|
272
|
-
prevNode: prevName ? (0,
|
248
|
+
currNode: _utilsjs.displayNodeName.call(void 0, currNode),
|
249
|
+
prevNode: prevName ? _utilsjs.displayNodeName.call(void 0, prevNode) : _lodashlowercase2.default.call(void 0, prevNode.kind)
|
273
250
|
},
|
274
251
|
*fix(fixer) {
|
275
252
|
const prevRange = getRangeWithComments(prevNode), currRange = getRangeWithComments(currNode);
|
@@ -284,24 +261,24 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
284
261
|
});
|
285
262
|
}
|
286
263
|
}
|
287
|
-
const opts = context.options[0], fields = new Set(opts.fields
|
288
|
-
fields.has(
|
289
|
-
|
290
|
-
|
264
|
+
const opts = context.options[0], fields = new Set(_nullishCoalesce(opts.fields, () => ( []))), listeners = {}, fieldsSelector = [
|
265
|
+
fields.has(_graphql.Kind.OBJECT_TYPE_DEFINITION) && [
|
266
|
+
_graphql.Kind.OBJECT_TYPE_DEFINITION,
|
267
|
+
_graphql.Kind.OBJECT_TYPE_EXTENSION
|
291
268
|
],
|
292
|
-
fields.has(
|
293
|
-
|
294
|
-
|
269
|
+
fields.has(_graphql.Kind.INTERFACE_TYPE_DEFINITION) && [
|
270
|
+
_graphql.Kind.INTERFACE_TYPE_DEFINITION,
|
271
|
+
_graphql.Kind.INTERFACE_TYPE_EXTENSION
|
295
272
|
],
|
296
|
-
fields.has(
|
297
|
-
|
298
|
-
|
273
|
+
fields.has(_graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION) && [
|
274
|
+
_graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
275
|
+
_graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION
|
299
276
|
]
|
300
|
-
].filter(
|
277
|
+
].filter(_utilsjs.truthy).flat().join(","), selectionsSelector = _optionalChain([opts, 'access', _10 => _10.selections, 'optionalAccess', _11 => _11.join, 'call', _12 => _12(",")]), argumentsSelector = _optionalChain([opts, 'access', _13 => _13.arguments, 'optionalAccess', _14 => _14.join, 'call', _15 => _15(",")]);
|
301
278
|
if (fieldsSelector && (listeners[fieldsSelector] = (node) => {
|
302
279
|
checkNodes(node.fields);
|
303
280
|
}), opts.values) {
|
304
|
-
const enumValuesSelector = [
|
281
|
+
const enumValuesSelector = [_graphql.Kind.ENUM_TYPE_DEFINITION, _graphql.Kind.ENUM_TYPE_EXTENSION].join(",");
|
305
282
|
listeners[enumValuesSelector] = (node) => {
|
306
283
|
checkNodes(node.values);
|
307
284
|
};
|
@@ -309,7 +286,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
309
286
|
return selectionsSelector && (listeners[`:matches(${selectionsSelector}) SelectionSet`] = (node) => {
|
310
287
|
checkNodes(node.selections);
|
311
288
|
}), opts.variables && (listeners.OperationDefinition = (node) => {
|
312
|
-
checkNodes(node.variableDefinitions
|
289
|
+
checkNodes(_optionalChain([node, 'access', _16 => _16.variableDefinitions, 'optionalAccess', _17 => _17.map, 'call', _18 => _18((varDef) => varDef.variable)]));
|
313
290
|
}), argumentsSelector && (listeners[argumentsSelector] = (node) => {
|
314
291
|
checkNodes(node.arguments);
|
315
292
|
}), opts.definitions && (listeners.Document = (node) => {
|
@@ -317,7 +294,6 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
317
294
|
}), listeners;
|
318
295
|
}
|
319
296
|
};
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
});
|
297
|
+
|
298
|
+
|
299
|
+
exports.rule = rule;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { FromSchema } from 'json-schema-to-ts';
|
2
|
-
import { GraphQLESLintRule } from '
|
2
|
+
import { GraphQLESLintRule } from '../../types.cjs';
|
3
3
|
import 'eslint';
|
4
4
|
import 'estree';
|
5
5
|
import 'graphql';
|
6
6
|
import 'graphql-config';
|
7
|
-
import '
|
8
|
-
import '
|
7
|
+
import '../../estree-converter/types.cjs';
|
8
|
+
import '../../siblings.cjs';
|
9
9
|
import '@graphql-tools/utils';
|
10
10
|
|
11
11
|
declare const schema: {
|
@@ -1,24 +1,5 @@
|
|
1
|
-
"use strict";
|
2
|
-
var
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
-
return to;
|
14
|
-
};
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
16
|
-
var description_style_exports = {};
|
17
|
-
__export(description_style_exports, {
|
18
|
-
rule: () => rule
|
19
|
-
});
|
20
|
-
module.exports = __toCommonJS(description_style_exports);
|
21
|
-
var import_utils = require("../utils.js");
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-UIAXBAMD.js');
|
2
|
+
var _utilsjs = require('../../utils.js');
|
22
3
|
const schema = {
|
23
4
|
type: "array",
|
24
5
|
maxItems: 1,
|
@@ -33,7 +14,7 @@ const schema = {
|
|
33
14
|
}
|
34
15
|
}
|
35
16
|
}
|
36
|
-
}, rule = {
|
17
|
+
}, rule = exports.rule = {
|
37
18
|
meta: {
|
38
19
|
type: "suggestion",
|
39
20
|
hasSuggestions: !0,
|
@@ -79,7 +60,7 @@ const schema = {
|
|
79
60
|
[`.description[type=StringValue][block!=${isBlock}]`](node) {
|
80
61
|
context.report({
|
81
62
|
loc: isBlock ? node.loc : node.loc.start,
|
82
|
-
message: `Unexpected ${isBlock ? "inline" : "block"} description for ${(0,
|
63
|
+
message: `Unexpected ${isBlock ? "inline" : "block"} description for ${_utilsjs.getNodeName.call(void 0,
|
83
64
|
node.parent
|
84
65
|
)}`,
|
85
66
|
suggest: [
|
@@ -96,7 +77,6 @@ const schema = {
|
|
96
77
|
};
|
97
78
|
}
|
98
79
|
};
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
});
|
80
|
+
|
81
|
+
|
82
|
+
exports.rule = rule;
|