@graphql-eslint/eslint-plugin 4.0.0-alpha-20230801163310-8bc4340 → 4.0.0-alpha-20230810155929-e89edf7
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
@@ -5,39 +5,30 @@ 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 match_document_filename_exports = {};
|
20
17
|
__export(match_document_filename_exports, {
|
21
18
|
rule: () => rule
|
22
19
|
});
|
23
20
|
module.exports = __toCommonJS(match_document_filename_exports);
|
24
|
-
var
|
25
|
-
|
26
|
-
var import_utils = require("../utils.js");
|
27
|
-
const MATCH_EXTENSION = "MATCH_EXTENSION";
|
28
|
-
const MATCH_STYLE = "MATCH_STYLE";
|
29
|
-
const CASE_STYLES = [
|
21
|
+
var import_node_path = require("node:path"), import_graphql = require("graphql"), import_utils = require("../utils.js");
|
22
|
+
const MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLES = [
|
30
23
|
"camelCase",
|
31
24
|
"PascalCase",
|
32
25
|
"snake_case",
|
33
26
|
"UPPER_CASE",
|
34
27
|
"kebab-case",
|
35
28
|
"matchDocumentStyle"
|
36
|
-
]
|
37
|
-
const schemaOption = {
|
29
|
+
], schemaOption = {
|
38
30
|
oneOf: [{ $ref: "#/definitions/asString" }, { $ref: "#/definitions/asObject" }]
|
39
|
-
}
|
40
|
-
const schema = {
|
31
|
+
}, schema = {
|
41
32
|
definitions: {
|
42
33
|
asString: {
|
43
34
|
enum: CASE_STYLES,
|
@@ -45,7 +36,7 @@ const schema = {
|
|
45
36
|
},
|
46
37
|
asObject: {
|
47
38
|
type: "object",
|
48
|
-
additionalProperties:
|
39
|
+
additionalProperties: !1,
|
49
40
|
minProperties: 1,
|
50
41
|
properties: {
|
51
42
|
style: { enum: CASE_STYLES },
|
@@ -59,7 +50,7 @@ const schema = {
|
|
59
50
|
maxItems: 1,
|
60
51
|
items: {
|
61
52
|
type: "object",
|
62
|
-
additionalProperties:
|
53
|
+
additionalProperties: !1,
|
63
54
|
minProperties: 1,
|
64
55
|
properties: {
|
65
56
|
fileExtension: { enum: [".gql", ".graphql"] },
|
@@ -69,8 +60,7 @@ const schema = {
|
|
69
60
|
fragment: schemaOption
|
70
61
|
}
|
71
62
|
}
|
72
|
-
}
|
73
|
-
const rule = {
|
63
|
+
}, rule = {
|
74
64
|
meta: {
|
75
65
|
type: "suggestion",
|
76
66
|
docs: {
|
@@ -210,68 +200,47 @@ const rule = {
|
|
210
200
|
create(context) {
|
211
201
|
const options = context.options[0] || {
|
212
202
|
fileExtension: null
|
213
|
-
};
|
214
|
-
|
215
|
-
const isVirtualFile = import_utils.VIRTUAL_DOCUMENT_REGEX.test(filePath);
|
216
|
-
if (isVirtualFile) {
|
203
|
+
}, filePath = context.filename;
|
204
|
+
if (import_utils.VIRTUAL_DOCUMENT_REGEX.test(filePath))
|
217
205
|
return {};
|
218
|
-
|
219
|
-
const fileExtension = (0, import_path.extname)(filePath);
|
220
|
-
const filename = (0, import_path.basename)(filePath, fileExtension);
|
206
|
+
const fileExtension = (0, import_node_path.extname)(filePath), filename = (0, import_node_path.basename)(filePath, fileExtension);
|
221
207
|
return {
|
222
208
|
Document(documentNode) {
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}
|
232
|
-
});
|
233
|
-
}
|
209
|
+
options.fileExtension && options.fileExtension !== fileExtension && context.report({
|
210
|
+
loc: import_utils.REPORT_ON_FIRST_CHARACTER,
|
211
|
+
messageId: MATCH_EXTENSION,
|
212
|
+
data: {
|
213
|
+
fileExtension,
|
214
|
+
expectedFileExtension: options.fileExtension
|
215
|
+
}
|
216
|
+
});
|
234
217
|
const firstOperation = documentNode.definitions.find(
|
235
218
|
(n) => n.kind === import_graphql.Kind.OPERATION_DEFINITION
|
236
|
-
)
|
237
|
-
const firstFragment = documentNode.definitions.find(
|
219
|
+
), firstFragment = documentNode.definitions.find(
|
238
220
|
(n) => n.kind === import_graphql.Kind.FRAGMENT_DEFINITION
|
239
|
-
);
|
240
|
-
|
241
|
-
if (!node) {
|
221
|
+
), node = firstOperation || firstFragment;
|
222
|
+
if (!node)
|
242
223
|
return;
|
243
|
-
|
244
|
-
|
245
|
-
if (!docName) {
|
224
|
+
const docName = node.name?.value;
|
225
|
+
if (!docName)
|
246
226
|
return;
|
247
|
-
}
|
248
227
|
const docType = "operation" in node ? node.operation : "fragment";
|
249
228
|
let option = options[docType];
|
250
|
-
if (!option)
|
229
|
+
if (!option)
|
251
230
|
return;
|
252
|
-
}
|
253
|
-
if (typeof option === "string") {
|
254
|
-
option = { style: option };
|
255
|
-
}
|
231
|
+
typeof option == "string" && (option = { style: option });
|
256
232
|
const expectedExtension = options.fileExtension || fileExtension;
|
257
233
|
let expectedFilename = option.prefix || "";
|
258
|
-
|
259
|
-
expectedFilename += option.style === "matchDocumentStyle" ? docName : (0, import_utils.convertCase)(option.style, docName);
|
260
|
-
} else {
|
261
|
-
expectedFilename += filename;
|
262
|
-
}
|
263
|
-
expectedFilename += (option.suffix || "") + expectedExtension;
|
234
|
+
option.style ? expectedFilename += option.style === "matchDocumentStyle" ? docName : (0, import_utils.convertCase)(option.style, docName) : expectedFilename += filename, expectedFilename += (option.suffix || "") + expectedExtension;
|
264
235
|
const filenameWithExtension = filename + expectedExtension;
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
});
|
274
|
-
}
|
236
|
+
expectedFilename !== filenameWithExtension && context.report({
|
237
|
+
loc: import_utils.REPORT_ON_FIRST_CHARACTER,
|
238
|
+
messageId: MATCH_STYLE,
|
239
|
+
data: {
|
240
|
+
expectedFilename,
|
241
|
+
filename: filenameWithExtension
|
242
|
+
}
|
243
|
+
});
|
275
244
|
}
|
276
245
|
};
|
277
246
|
}
|
@@ -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
|
type AllowedStyle = 'camelCase' | 'PascalCase' | 'snake_case' | 'UPPER_CASE';
|
11
12
|
declare const schema: {
|
@@ -5,24 +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 naming_convention_exports = {};
|
20
17
|
__export(naming_convention_exports, {
|
21
18
|
rule: () => rule
|
22
19
|
});
|
23
20
|
module.exports = __toCommonJS(naming_convention_exports);
|
24
|
-
var import_graphql = require("graphql");
|
25
|
-
var import_utils = require("../utils.js");
|
21
|
+
var import_graphql = require("graphql"), import_utils = require("../utils.js");
|
26
22
|
const KindToDisplayName = {
|
27
23
|
// types
|
28
24
|
[import_graphql.Kind.OBJECT_TYPE_DEFINITION]: "Type",
|
@@ -41,19 +37,14 @@ const KindToDisplayName = {
|
|
41
37
|
[import_graphql.Kind.OPERATION_DEFINITION]: "Operation",
|
42
38
|
[import_graphql.Kind.FRAGMENT_DEFINITION]: "Fragment",
|
43
39
|
[import_graphql.Kind.VARIABLE_DEFINITION]: "Variable"
|
44
|
-
}
|
45
|
-
const StyleToRegex = {
|
40
|
+
}, StyleToRegex = {
|
46
41
|
camelCase: /^[a-z][\dA-Za-z]*$/,
|
47
42
|
PascalCase: /^[A-Z][\dA-Za-z]*$/,
|
48
43
|
snake_case: /^[a-z][\d_a-z]*[\da-z]*$/,
|
49
44
|
UPPER_CASE: /^[A-Z][\dA-Z_]*[\dA-Z]*$/
|
50
|
-
}
|
51
|
-
const ALLOWED_KINDS = Object.keys(KindToDisplayName).sort();
|
52
|
-
const ALLOWED_STYLES = Object.keys(StyleToRegex);
|
53
|
-
const schemaOption = {
|
45
|
+
}, ALLOWED_KINDS = Object.keys(KindToDisplayName).sort(), ALLOWED_STYLES = Object.keys(StyleToRegex), schemaOption = {
|
54
46
|
oneOf: [{ $ref: "#/definitions/asString" }, { $ref: "#/definitions/asObject" }]
|
55
|
-
}
|
56
|
-
const schema = {
|
47
|
+
}, schema = {
|
57
48
|
definitions: {
|
58
49
|
asString: {
|
59
50
|
enum: ALLOWED_STYLES,
|
@@ -61,7 +52,7 @@ const schema = {
|
|
61
52
|
},
|
62
53
|
asObject: {
|
63
54
|
type: "object",
|
64
|
-
additionalProperties:
|
55
|
+
additionalProperties: !1,
|
65
56
|
properties: {
|
66
57
|
style: { enum: ALLOWED_STYLES },
|
67
58
|
prefix: { type: "string" },
|
@@ -81,12 +72,13 @@ const schema = {
|
|
81
72
|
maxItems: 1,
|
82
73
|
items: {
|
83
74
|
type: "object",
|
84
|
-
additionalProperties:
|
75
|
+
additionalProperties: !1,
|
85
76
|
properties: {
|
86
77
|
types: {
|
87
78
|
...schemaOption,
|
88
79
|
description: `Includes:
|
89
|
-
${import_utils.TYPES_KINDS.map((kind) => `- \`${kind}\``).join(
|
80
|
+
${import_utils.TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
81
|
+
`)}`
|
90
82
|
},
|
91
83
|
...Object.fromEntries(
|
92
84
|
ALLOWED_KINDS.map((kind) => [
|
@@ -99,11 +91,11 @@ ${import_utils.TYPES_KINDS.map((kind) => `- \`${kind}\``).join("\n")}`
|
|
99
91
|
),
|
100
92
|
allowLeadingUnderscore: {
|
101
93
|
type: "boolean",
|
102
|
-
default:
|
94
|
+
default: !1
|
103
95
|
},
|
104
96
|
allowTrailingUnderscore: {
|
105
97
|
type: "boolean",
|
106
|
-
default:
|
98
|
+
default: !1
|
107
99
|
}
|
108
100
|
},
|
109
101
|
patternProperties: {
|
@@ -115,16 +107,16 @@ ${import_utils.TYPES_KINDS.map((kind) => `- \`${kind}\``).join("\n")}`
|
|
115
107
|
"> Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector.",
|
116
108
|
">",
|
117
109
|
"> Example: pattern property `FieldDefinition[parent.name.value=Query]` will match only fields for type `Query`."
|
118
|
-
].join(
|
110
|
+
].join(`
|
111
|
+
`)
|
119
112
|
}
|
120
|
-
}
|
121
|
-
const rule = {
|
113
|
+
}, rule = {
|
122
114
|
meta: {
|
123
115
|
type: "suggestion",
|
124
116
|
docs: {
|
125
117
|
description: "Require names to follow specified conventions.",
|
126
118
|
category: ["Schema", "Operations"],
|
127
|
-
recommended:
|
119
|
+
recommended: !0,
|
128
120
|
url: "https://the-guild.dev/graphql/eslint/rules/naming-convention",
|
129
121
|
examples: [
|
130
122
|
{
|
@@ -280,6 +272,22 @@ const rule = {
|
|
280
272
|
"FieldDefinition[parent.name.value=Subscription]": {
|
281
273
|
forbiddenPrefixes: ["subscription"],
|
282
274
|
forbiddenSuffixes: ["Subscription"]
|
275
|
+
},
|
276
|
+
"EnumTypeDefinition,EnumTypeExtension": {
|
277
|
+
forbiddenPrefixes: ["Enum"],
|
278
|
+
forbiddenSuffixes: ["Enum"]
|
279
|
+
},
|
280
|
+
"InterfaceTypeDefinition,InterfaceTypeExtension": {
|
281
|
+
forbiddenPrefixes: ["Interface"],
|
282
|
+
forbiddenSuffixes: ["Interface"]
|
283
|
+
},
|
284
|
+
"UnionTypeDefinition,UnionTypeExtension": {
|
285
|
+
forbiddenPrefixes: ["Union"],
|
286
|
+
forbiddenSuffixes: ["Union"]
|
287
|
+
},
|
288
|
+
"ObjectTypeDefinition,ObjectTypeExtension": {
|
289
|
+
forbiddenPrefixes: ["Type"],
|
290
|
+
forbiddenSuffixes: ["Type"]
|
283
291
|
}
|
284
292
|
}
|
285
293
|
],
|
@@ -300,15 +308,14 @@ const rule = {
|
|
300
308
|
]
|
301
309
|
}
|
302
310
|
},
|
303
|
-
hasSuggestions:
|
311
|
+
hasSuggestions: !0,
|
304
312
|
schema
|
305
313
|
},
|
306
314
|
create(context) {
|
307
|
-
const options = context.options[0] || {};
|
308
|
-
const { allowLeadingUnderscore, allowTrailingUnderscore, types, ...restOptions } = options;
|
315
|
+
const options = context.options[0] || {}, { allowLeadingUnderscore, allowTrailingUnderscore, types, ...restOptions } = options;
|
309
316
|
function normalisePropertyOption(kind) {
|
310
317
|
const style = restOptions[kind] || types;
|
311
|
-
return typeof style
|
318
|
+
return typeof style == "object" ? style : { style };
|
312
319
|
}
|
313
320
|
function report(node, message, suggestedNames) {
|
314
321
|
context.report({
|
@@ -322,9 +329,8 @@ const rule = {
|
|
322
329
|
}
|
323
330
|
const checkNode = (selector) => (n) => {
|
324
331
|
const { name: node } = n.kind === import_graphql.Kind.VARIABLE_DEFINITION ? n.variable : n;
|
325
|
-
if (!node)
|
332
|
+
if (!node)
|
326
333
|
return;
|
327
|
-
}
|
328
334
|
const {
|
329
335
|
prefix,
|
330
336
|
suffix,
|
@@ -334,97 +340,73 @@ const rule = {
|
|
334
340
|
ignorePattern,
|
335
341
|
requiredPrefixes,
|
336
342
|
requiredSuffixes
|
337
|
-
} = normalisePropertyOption(selector);
|
338
|
-
const nodeType = KindToDisplayName[n.kind] || n.kind;
|
339
|
-
const nodeName = node.value;
|
340
|
-
const error = getError();
|
343
|
+
} = normalisePropertyOption(selector), nodeType = KindToDisplayName[n.kind] || n.kind, nodeName = node.value, error = getError();
|
341
344
|
if (error) {
|
342
|
-
const { errorMessage, renameToNames } = error
|
343
|
-
const [leadingUnderscores] = nodeName.match(/^_*/);
|
344
|
-
const [trailingUnderscores] = nodeName.match(/_*$/);
|
345
|
-
const suggestedNames = renameToNames.map(
|
345
|
+
const { errorMessage, renameToNames } = error, [leadingUnderscores] = nodeName.match(/^_*/), [trailingUnderscores] = nodeName.match(/_*$/), suggestedNames = renameToNames.map(
|
346
346
|
(renameToName) => leadingUnderscores + renameToName + trailingUnderscores
|
347
347
|
);
|
348
348
|
report(node, `${nodeType} "${nodeName}" should ${errorMessage}`, suggestedNames);
|
349
349
|
}
|
350
350
|
function getError() {
|
351
351
|
const name = nodeName.replace(/(^_+)|(_+$)/g, "");
|
352
|
-
if (ignorePattern && new RegExp(ignorePattern, "u").test(name))
|
352
|
+
if (ignorePattern && new RegExp(ignorePattern, "u").test(name))
|
353
353
|
return;
|
354
|
-
|
355
|
-
if (prefix && !name.startsWith(prefix)) {
|
354
|
+
if (prefix && !name.startsWith(prefix))
|
356
355
|
return {
|
357
356
|
errorMessage: `have "${prefix}" prefix`,
|
358
357
|
renameToNames: [prefix + name]
|
359
358
|
};
|
360
|
-
|
361
|
-
if (suffix && !name.endsWith(suffix)) {
|
359
|
+
if (suffix && !name.endsWith(suffix))
|
362
360
|
return {
|
363
361
|
errorMessage: `have "${suffix}" suffix`,
|
364
362
|
renameToNames: [name + suffix]
|
365
363
|
};
|
366
|
-
|
367
|
-
|
368
|
-
if (forbiddenPrefix) {
|
364
|
+
const forbiddenPrefix = forbiddenPrefixes?.find((prefix2) => name.startsWith(prefix2));
|
365
|
+
if (forbiddenPrefix)
|
369
366
|
return {
|
370
367
|
errorMessage: `not have "${forbiddenPrefix}" prefix`,
|
371
368
|
renameToNames: [name.replace(new RegExp(`^${forbiddenPrefix}`), "")]
|
372
369
|
};
|
373
|
-
|
374
|
-
|
375
|
-
if (forbiddenSuffix) {
|
370
|
+
const forbiddenSuffix = forbiddenSuffixes?.find((suffix2) => name.endsWith(suffix2));
|
371
|
+
if (forbiddenSuffix)
|
376
372
|
return {
|
377
373
|
errorMessage: `not have "${forbiddenSuffix}" suffix`,
|
378
374
|
renameToNames: [name.replace(new RegExp(`${forbiddenSuffix}$`), "")]
|
379
375
|
};
|
380
|
-
|
381
|
-
if (requiredPrefixes && !requiredPrefixes.some((requiredPrefix) => name.startsWith(requiredPrefix))) {
|
376
|
+
if (requiredPrefixes && !requiredPrefixes.some((requiredPrefix) => name.startsWith(requiredPrefix)))
|
382
377
|
return {
|
383
378
|
errorMessage: `have one of the following prefixes: ${(0, import_utils.englishJoinWords)(
|
384
379
|
requiredPrefixes
|
385
380
|
)}`,
|
386
381
|
renameToNames: style ? requiredPrefixes.map((prefix2) => (0, import_utils.convertCase)(style, `${prefix2} ${name}`)) : requiredPrefixes.map((prefix2) => `${prefix2}${name}`)
|
387
382
|
};
|
388
|
-
|
389
|
-
if (requiredSuffixes && !requiredSuffixes.some((requiredSuffix) => name.endsWith(requiredSuffix))) {
|
383
|
+
if (requiredSuffixes && !requiredSuffixes.some((requiredSuffix) => name.endsWith(requiredSuffix)))
|
390
384
|
return {
|
391
385
|
errorMessage: `have one of the following suffixes: ${(0, import_utils.englishJoinWords)(
|
392
386
|
requiredSuffixes
|
393
387
|
)}`,
|
394
388
|
renameToNames: style ? requiredSuffixes.map((suffix2) => (0, import_utils.convertCase)(style, `${name} ${suffix2}`)) : requiredSuffixes.map((suffix2) => `${name}${suffix2}`)
|
395
389
|
};
|
396
|
-
|
397
|
-
if (!style) {
|
390
|
+
if (!style)
|
398
391
|
return;
|
399
|
-
|
400
|
-
const caseRegex = StyleToRegex[style];
|
401
|
-
if (!caseRegex.test(name)) {
|
392
|
+
if (!StyleToRegex[style].test(name))
|
402
393
|
return {
|
403
394
|
errorMessage: `be in ${style} format`,
|
404
395
|
renameToNames: [(0, import_utils.convertCase)(style, name)]
|
405
396
|
};
|
406
|
-
}
|
407
397
|
}
|
408
|
-
}
|
409
|
-
const checkUnderscore = (isLeading) => (node) => {
|
398
|
+
}, checkUnderscore = (isLeading) => (node) => {
|
410
399
|
const suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
|
411
400
|
report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
|
412
401
|
suggestedName
|
413
402
|
]);
|
414
|
-
};
|
415
|
-
|
416
|
-
if (!allowLeadingUnderscore) {
|
417
|
-
listeners["Name[value=/^_/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(true);
|
418
|
-
}
|
419
|
-
if (!allowTrailingUnderscore) {
|
420
|
-
listeners["Name[value=/_$/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(false);
|
421
|
-
}
|
403
|
+
}, listeners = {};
|
404
|
+
allowLeadingUnderscore || (listeners["Name[value=/^_/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!1));
|
422
405
|
const selectors = new Set(
|
423
406
|
[types && import_utils.TYPES_KINDS, Object.keys(restOptions)].flat().filter(import_utils.truthy)
|
424
407
|
);
|
425
|
-
for (const selector of selectors)
|
408
|
+
for (const selector of selectors)
|
426
409
|
listeners[selector] = checkNode(selector);
|
427
|
-
}
|
428
410
|
return listeners;
|
429
411
|
}
|
430
412
|
};
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import '@graphql-tools/utils';
|
1
|
+
import { GraphQLESLintRule } from '../types.js';
|
3
2
|
import 'eslint';
|
4
3
|
import 'estree';
|
5
4
|
import 'graphql';
|
6
|
-
import 'graphql-config';
|
7
5
|
import 'json-schema-to-ts';
|
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 rule: GraphQLESLintRule;
|
11
12
|
|
@@ -5,33 +5,28 @@ 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 no_anonymous_operations_exports = {};
|
20
17
|
__export(no_anonymous_operations_exports, {
|
21
18
|
rule: () => rule
|
22
19
|
});
|
23
20
|
module.exports = __toCommonJS(no_anonymous_operations_exports);
|
24
|
-
var import_graphql = require("graphql");
|
25
|
-
|
26
|
-
const RULE_ID = "no-anonymous-operations";
|
27
|
-
const rule = {
|
21
|
+
var import_graphql = require("graphql"), import_utils = require("../utils.js");
|
22
|
+
const RULE_ID = "no-anonymous-operations", rule = {
|
28
23
|
meta: {
|
29
24
|
type: "suggestion",
|
30
|
-
hasSuggestions:
|
25
|
+
hasSuggestions: !0,
|
31
26
|
docs: {
|
32
27
|
category: "Operations",
|
33
28
|
description: "Require name for your GraphQL operations. This is useful since most GraphQL client libraries are using the operation name for caching purposes.",
|
34
|
-
recommended:
|
29
|
+
recommended: !0,
|
35
30
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
36
31
|
examples: [
|
37
32
|
{
|
@@ -66,8 +61,7 @@ const rule = {
|
|
66
61
|
create(context) {
|
67
62
|
return {
|
68
63
|
"OperationDefinition[name=undefined]"(node) {
|
69
|
-
const [firstSelection] = node.selectionSet.selections;
|
70
|
-
const suggestedName = firstSelection.kind === import_graphql.Kind.FIELD ? (firstSelection.alias || firstSelection.name).value : node.operation;
|
64
|
+
const [firstSelection] = node.selectionSet.selections, suggestedName = firstSelection.kind === import_graphql.Kind.FIELD ? (firstSelection.alias || firstSelection.name).value : node.operation;
|
71
65
|
context.report({
|
72
66
|
loc: (0, import_utils.getLocation)(node.loc.start, node.operation),
|
73
67
|
messageId: RULE_ID,
|
@@ -78,8 +72,7 @@ const rule = {
|
|
78
72
|
{
|
79
73
|
desc: `Rename to \`${suggestedName}\``,
|
80
74
|
fix(fixer) {
|
81
|
-
const
|
82
|
-
const hasQueryKeyword = sourceCode.getText({ range: [node.range[0], node.range[0] + 1] }) !== "{";
|
75
|
+
const hasQueryKeyword = context.getSourceCode().getText({ range: [node.range[0], node.range[0] + 1] }) !== "{";
|
83
76
|
return fixer.insertTextAfterRange(
|
84
77
|
[node.range[0], node.range[0] + (hasQueryKeyword ? node.operation.length : 0)],
|
85
78
|
`${hasQueryKeyword ? "" : "query"} ${suggestedName}${hasQueryKeyword ? "" : " "}`
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import '@graphql-tools/utils';
|
1
|
+
import { GraphQLESLintRule } from '../types.js';
|
3
2
|
import 'eslint';
|
4
3
|
import 'estree';
|
5
4
|
import 'graphql';
|
6
|
-
import 'graphql-config';
|
7
5
|
import 'json-schema-to-ts';
|
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 rule: GraphQLESLintRule<[], true>;
|
11
12
|
|
@@ -5,34 +5,29 @@ 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 no_deprecated_exports = {};
|
20
17
|
__export(no_deprecated_exports, {
|
21
18
|
rule: () => rule
|
22
19
|
});
|
23
20
|
module.exports = __toCommonJS(no_deprecated_exports);
|
24
|
-
var import_graphql = require("graphql");
|
25
|
-
|
26
|
-
const RULE_ID = "no-deprecated";
|
27
|
-
const rule = {
|
21
|
+
var import_graphql = require("graphql"), import_utils = require("../utils.js");
|
22
|
+
const RULE_ID = "no-deprecated", rule = {
|
28
23
|
meta: {
|
29
24
|
type: "suggestion",
|
30
|
-
hasSuggestions:
|
25
|
+
hasSuggestions: !0,
|
31
26
|
docs: {
|
32
27
|
category: "Operations",
|
33
28
|
description: "Enforce that deprecated fields or enum values are not in use by operations.",
|
34
29
|
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
35
|
-
requiresSchema:
|
30
|
+
requiresSchema: !0,
|
36
31
|
examples: [
|
37
32
|
{
|
38
33
|
title: "Incorrect (field)",
|
@@ -104,7 +99,7 @@ const rule = {
|
|
104
99
|
)
|
105
100
|
}
|
106
101
|
],
|
107
|
-
recommended:
|
102
|
+
recommended: !0
|
108
103
|
},
|
109
104
|
messages: {
|
110
105
|
[RULE_ID]: "This {{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
|
@@ -114,8 +109,7 @@ const rule = {
|
|
114
109
|
create(context) {
|
115
110
|
(0, import_utils.requireGraphQLSchemaFromContext)(RULE_ID, context);
|
116
111
|
function report(node, reason) {
|
117
|
-
const nodeName = node.kind === import_graphql.Kind.ENUM ? node.value : node.name.value;
|
118
|
-
const nodeType = node.kind === import_graphql.Kind.ENUM ? "enum value" : "field";
|
112
|
+
const nodeName = node.kind === import_graphql.Kind.ENUM ? node.value : node.name.value, nodeType = node.kind === import_graphql.Kind.ENUM ? "enum value" : "field";
|
119
113
|
context.report({
|
120
114
|
node,
|
121
115
|
messageId: RULE_ID,
|
@@ -133,20 +127,12 @@ const rule = {
|
|
133
127
|
}
|
134
128
|
return {
|
135
129
|
EnumValue(node) {
|
136
|
-
|
137
|
-
|
138
|
-
const reason = (_a = typeInfo.enumValue) == null ? void 0 : _a.deprecationReason;
|
139
|
-
if (reason) {
|
140
|
-
report(node, reason);
|
141
|
-
}
|
130
|
+
const reason = node.typeInfo().enumValue?.deprecationReason;
|
131
|
+
reason && report(node, reason);
|
142
132
|
},
|
143
133
|
Field(node) {
|
144
|
-
|
145
|
-
|
146
|
-
const reason = (_a = typeInfo.fieldDef) == null ? void 0 : _a.deprecationReason;
|
147
|
-
if (reason) {
|
148
|
-
report(node, reason);
|
149
|
-
}
|
134
|
+
const reason = node.typeInfo().fieldDef?.deprecationReason;
|
135
|
+
reason && report(node, reason);
|
150
136
|
}
|
151
137
|
};
|
152
138
|
}
|