@graphql-eslint/eslint-plugin 2.3.0-alpha-4c161e5.0 → 2.3.0-alpha-6ba4002.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/all.d.ts +0 -7
- package/configs/index.d.ts +0 -7
- package/docs/README.md +0 -1
- package/docs/rules/avoid-operation-name-prefix.md +7 -3
- package/docs/rules/description-style.md +8 -4
- package/docs/rules/input-name.md +9 -5
- package/docs/rules/match-document-filename.md +10 -6
- package/docs/rules/naming-convention.md +19 -15
- package/docs/rules/require-deprecation-date.md +6 -2
- package/docs/rules/require-description.md +10 -2
- package/docs/rules/require-id-when-available.md +6 -2
- package/docs/rules/selection-set-depth.md +12 -4
- package/docs/rules/strict-id-in-types.md +10 -6
- package/index.js +68 -312
- package/index.mjs +68 -312
- package/package.json +1 -1
- package/rules/index.d.ts +0 -7
- package/testkit.d.ts +1 -1
- package/types.d.ts +0 -1
- package/docs/rules/alphabetize.md +0 -140
- package/rules/alphabetize.d.ts +0 -17
package/index.js
CHANGED
@@ -71,16 +71,6 @@ const allConfig = {
|
|
71
71
|
...recommendedConfig,
|
72
72
|
rules: {
|
73
73
|
...recommendedConfig.rules,
|
74
|
-
'@graphql-eslint/alphabetize': [
|
75
|
-
'error',
|
76
|
-
{
|
77
|
-
fields: ['ObjectTypeDefinition', 'InterfaceTypeDefinition', 'InputObjectTypeDefinition'],
|
78
|
-
values: ['EnumTypeDefinition'],
|
79
|
-
selections: ['OperationDefinition', 'FragmentDefinition'],
|
80
|
-
variables: ['OperationDefinition'],
|
81
|
-
arguments: ['FieldDefinition', 'Field', 'DirectiveDefinition', 'Directive'],
|
82
|
-
},
|
83
|
-
],
|
84
74
|
'@graphql-eslint/avoid-duplicate-fields': 'error',
|
85
75
|
'@graphql-eslint/avoid-operation-name-prefix': 'error',
|
86
76
|
'@graphql-eslint/avoid-scalar-result-type-on-mutation': 'error',
|
@@ -320,6 +310,14 @@ const validationToRule = (name, ruleName, docs, getDocumentNode) => {
|
|
320
310
|
},
|
321
311
|
};
|
322
312
|
};
|
313
|
+
const importFiles = (context) => {
|
314
|
+
const code = context.getSourceCode().text;
|
315
|
+
if (!isGraphQLImportFile(code)) {
|
316
|
+
return null;
|
317
|
+
}
|
318
|
+
// Import documents because file contains '#import' comments
|
319
|
+
return _import.processImport(context.getFilename());
|
320
|
+
};
|
323
321
|
const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-definitions', 'ExecutableDefinitions', {
|
324
322
|
description: `A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.`,
|
325
323
|
}), validationToRule('fields-on-correct-type', 'FieldsOnCorrectType', {
|
@@ -396,14 +394,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
396
394
|
\``,
|
397
395
|
},
|
398
396
|
],
|
399
|
-
},
|
400
|
-
const code = context.getSourceCode().text;
|
401
|
-
if (!isGraphQLImportFile(code)) {
|
402
|
-
return null;
|
403
|
-
}
|
404
|
-
// Import documents because file contains '#import' comments
|
405
|
-
return _import.processImport(context.getFilename());
|
406
|
-
}), validationToRule('known-type-names', 'KnownTypeNames', {
|
397
|
+
}, importFiles), validationToRule('known-type-names', 'KnownTypeNames', {
|
407
398
|
description: `A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.`,
|
408
399
|
}), validationToRule('lone-anonymous-operation', 'LoneAnonymousOperation', {
|
409
400
|
description: `A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition.`,
|
@@ -445,7 +436,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
445
436
|
return getParentNode(context.getFilename());
|
446
437
|
}), validationToRule('no-unused-variables', 'NoUnusedVariables', {
|
447
438
|
description: `A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.`,
|
448
|
-
}), validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
|
439
|
+
}, importFiles), validationToRule('overlapping-fields-can-be-merged', 'OverlappingFieldsCanBeMerged', {
|
449
440
|
description: `A selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.`,
|
450
441
|
}), validationToRule('possible-fragment-spread', 'PossibleFragmentSpreads', {
|
451
442
|
description: `A fragment spread is only valid if the type condition could ever possibly be true: if there is a non-empty intersection of the possible parent types, and possible types which pass the type condition.`,
|
@@ -490,240 +481,6 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
|
|
490
481
|
description: `Variables passed to field arguments conform to type.`,
|
491
482
|
}));
|
492
483
|
|
493
|
-
const ALPHABETIZE = 'ALPHABETIZE';
|
494
|
-
const fieldsEnum = [graphql.Kind.OBJECT_TYPE_DEFINITION, graphql.Kind.INTERFACE_TYPE_DEFINITION, graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION];
|
495
|
-
const valuesEnum = [graphql.Kind.ENUM_TYPE_DEFINITION];
|
496
|
-
const selectionsEnum = [graphql.Kind.OPERATION_DEFINITION, graphql.Kind.FRAGMENT_DEFINITION];
|
497
|
-
const variablesEnum = [graphql.Kind.OPERATION_DEFINITION];
|
498
|
-
const argumentsEnum = [graphql.Kind.FIELD_DEFINITION, graphql.Kind.FIELD, graphql.Kind.DIRECTIVE_DEFINITION, graphql.Kind.DIRECTIVE];
|
499
|
-
const rule = {
|
500
|
-
meta: {
|
501
|
-
type: 'suggestion',
|
502
|
-
docs: {
|
503
|
-
category: 'Best Practices',
|
504
|
-
description: 'Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.',
|
505
|
-
url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/alphabetize.md',
|
506
|
-
examples: [
|
507
|
-
{
|
508
|
-
title: 'Incorrect',
|
509
|
-
usage: [{ fields: [graphql.Kind.OBJECT_TYPE_DEFINITION] }],
|
510
|
-
code: /* GraphQL */ `
|
511
|
-
type User {
|
512
|
-
password: String
|
513
|
-
firstName: String! # should be before "password"
|
514
|
-
age: Int # should be before "firstName"
|
515
|
-
lastName: String!
|
516
|
-
}
|
517
|
-
`,
|
518
|
-
},
|
519
|
-
{
|
520
|
-
title: 'Correct',
|
521
|
-
usage: [{ fields: [graphql.Kind.OBJECT_TYPE_DEFINITION] }],
|
522
|
-
code: /* GraphQL */ `
|
523
|
-
type User {
|
524
|
-
age: Int
|
525
|
-
firstName: String!
|
526
|
-
lastName: String!
|
527
|
-
password: String
|
528
|
-
}
|
529
|
-
`,
|
530
|
-
},
|
531
|
-
{
|
532
|
-
title: 'Incorrect',
|
533
|
-
usage: [{ values: [graphql.Kind.ENUM_TYPE_DEFINITION] }],
|
534
|
-
code: /* GraphQL */ `
|
535
|
-
enum Role {
|
536
|
-
SUPER_ADMIN
|
537
|
-
ADMIN # should be before "SUPER_ADMIN"
|
538
|
-
USER
|
539
|
-
GOD # should be before "USER"
|
540
|
-
}
|
541
|
-
`,
|
542
|
-
},
|
543
|
-
{
|
544
|
-
title: 'Correct',
|
545
|
-
usage: [{ values: [graphql.Kind.ENUM_TYPE_DEFINITION] }],
|
546
|
-
code: /* GraphQL */ `
|
547
|
-
enum Role {
|
548
|
-
ADMIN
|
549
|
-
GOD
|
550
|
-
SUPER_ADMIN
|
551
|
-
USER
|
552
|
-
}
|
553
|
-
`,
|
554
|
-
},
|
555
|
-
{
|
556
|
-
title: 'Incorrect',
|
557
|
-
usage: [{ selections: [graphql.Kind.OPERATION_DEFINITION] }],
|
558
|
-
code: /* GraphQL */ `
|
559
|
-
query {
|
560
|
-
me {
|
561
|
-
firstName
|
562
|
-
lastName
|
563
|
-
email # should be before "lastName"
|
564
|
-
}
|
565
|
-
}
|
566
|
-
`,
|
567
|
-
},
|
568
|
-
{
|
569
|
-
title: 'Correct',
|
570
|
-
usage: [{ selections: [graphql.Kind.OPERATION_DEFINITION] }],
|
571
|
-
code: /* GraphQL */ `
|
572
|
-
query {
|
573
|
-
me {
|
574
|
-
email
|
575
|
-
firstName
|
576
|
-
lastName
|
577
|
-
}
|
578
|
-
}
|
579
|
-
`,
|
580
|
-
},
|
581
|
-
],
|
582
|
-
optionsForConfig: [
|
583
|
-
{
|
584
|
-
fields: fieldsEnum,
|
585
|
-
values: valuesEnum,
|
586
|
-
selections: selectionsEnum,
|
587
|
-
variables: variablesEnum,
|
588
|
-
arguments: argumentsEnum,
|
589
|
-
},
|
590
|
-
],
|
591
|
-
},
|
592
|
-
messages: {
|
593
|
-
[ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}".',
|
594
|
-
},
|
595
|
-
schema: {
|
596
|
-
type: 'array',
|
597
|
-
minItems: 1,
|
598
|
-
maxItems: 1,
|
599
|
-
items: {
|
600
|
-
type: 'object',
|
601
|
-
additionalProperties: false,
|
602
|
-
minProperties: 1,
|
603
|
-
properties: {
|
604
|
-
fields: {
|
605
|
-
type: 'array',
|
606
|
-
contains: {
|
607
|
-
enum: fieldsEnum,
|
608
|
-
},
|
609
|
-
description: 'Fields of `type`, `interface`, and `input`.',
|
610
|
-
},
|
611
|
-
values: {
|
612
|
-
type: 'array',
|
613
|
-
contains: {
|
614
|
-
enum: valuesEnum,
|
615
|
-
},
|
616
|
-
description: 'Values of `enum`.',
|
617
|
-
},
|
618
|
-
selections: {
|
619
|
-
type: 'array',
|
620
|
-
contains: {
|
621
|
-
enum: selectionsEnum,
|
622
|
-
},
|
623
|
-
description: 'Selections of operations (`query`, `mutation` and `subscription`) and `fragment`.',
|
624
|
-
},
|
625
|
-
variables: {
|
626
|
-
type: 'array',
|
627
|
-
contains: {
|
628
|
-
enum: variablesEnum,
|
629
|
-
},
|
630
|
-
description: 'Variables of operations (`query`, `mutation` and `subscription`).',
|
631
|
-
},
|
632
|
-
arguments: {
|
633
|
-
type: 'array',
|
634
|
-
contains: {
|
635
|
-
enum: argumentsEnum,
|
636
|
-
},
|
637
|
-
description: 'Arguments of fields and directives.',
|
638
|
-
},
|
639
|
-
},
|
640
|
-
},
|
641
|
-
},
|
642
|
-
},
|
643
|
-
create(context) {
|
644
|
-
var _a, _b, _c, _d, _e;
|
645
|
-
function checkNodes(nodes) {
|
646
|
-
let prevName = null;
|
647
|
-
for (const node of nodes) {
|
648
|
-
const currName = node.name.value;
|
649
|
-
if (prevName && prevName > currName) {
|
650
|
-
const { start, end } = node.name.loc;
|
651
|
-
const isVariableNode = node.kind === graphql.Kind.VARIABLE;
|
652
|
-
context.report({
|
653
|
-
loc: {
|
654
|
-
start: {
|
655
|
-
line: start.line,
|
656
|
-
column: start.column - (isVariableNode ? 2 : 1),
|
657
|
-
},
|
658
|
-
end: {
|
659
|
-
line: end.line,
|
660
|
-
column: end.column,
|
661
|
-
},
|
662
|
-
},
|
663
|
-
messageId: ALPHABETIZE,
|
664
|
-
data: isVariableNode
|
665
|
-
? {
|
666
|
-
currName: `$${currName}`,
|
667
|
-
prevName: `$${prevName}`,
|
668
|
-
}
|
669
|
-
: { currName, prevName },
|
670
|
-
});
|
671
|
-
}
|
672
|
-
prevName = currName;
|
673
|
-
}
|
674
|
-
}
|
675
|
-
const opts = context.options[0];
|
676
|
-
const fields = new Set((_a = opts.fields) !== null && _a !== void 0 ? _a : []);
|
677
|
-
const listeners = {};
|
678
|
-
const fieldsSelector = [
|
679
|
-
fields.has(graphql.Kind.OBJECT_TYPE_DEFINITION) && [graphql.Kind.OBJECT_TYPE_DEFINITION, graphql.Kind.OBJECT_TYPE_EXTENSION],
|
680
|
-
fields.has(graphql.Kind.INTERFACE_TYPE_DEFINITION) && [graphql.Kind.INTERFACE_TYPE_DEFINITION, graphql.Kind.INTERFACE_TYPE_EXTENSION],
|
681
|
-
fields.has(graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION) && [
|
682
|
-
graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
683
|
-
graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION,
|
684
|
-
],
|
685
|
-
]
|
686
|
-
.flat()
|
687
|
-
.join(',');
|
688
|
-
const hasEnumValues = ((_b = opts.values) === null || _b === void 0 ? void 0 : _b[0]) === graphql.Kind.ENUM_TYPE_DEFINITION;
|
689
|
-
const selectionsSelector = (_c = opts.selections) === null || _c === void 0 ? void 0 : _c.join(',');
|
690
|
-
const hasVariables = ((_d = opts.variables) === null || _d === void 0 ? void 0 : _d[0]) === graphql.Kind.OPERATION_DEFINITION;
|
691
|
-
const argumentsSelector = (_e = opts.arguments) === null || _e === void 0 ? void 0 : _e.join(',');
|
692
|
-
if (fieldsSelector) {
|
693
|
-
listeners[fieldsSelector] = (node) => {
|
694
|
-
checkNodes(node.fields);
|
695
|
-
};
|
696
|
-
}
|
697
|
-
if (hasEnumValues) {
|
698
|
-
const enumValuesSelector = [graphql.Kind.ENUM_TYPE_DEFINITION, graphql.Kind.ENUM_TYPE_EXTENSION].join(',');
|
699
|
-
listeners[enumValuesSelector] = (node) => {
|
700
|
-
checkNodes(node.values);
|
701
|
-
};
|
702
|
-
}
|
703
|
-
if (selectionsSelector) {
|
704
|
-
listeners[`:matches(${selectionsSelector}) SelectionSet`] = (node) => {
|
705
|
-
checkNodes(node.selections
|
706
|
-
// inline fragment don't have name, so we skip them
|
707
|
-
.filter(selection => selection.kind !== graphql.Kind.INLINE_FRAGMENT)
|
708
|
-
.map(selection =>
|
709
|
-
// sort by alias is field is renamed
|
710
|
-
'alias' in selection && selection.alias ? { name: selection.alias } : selection));
|
711
|
-
};
|
712
|
-
}
|
713
|
-
if (hasVariables) {
|
714
|
-
listeners.OperationDefinition = (node) => {
|
715
|
-
checkNodes(node.variableDefinitions.map(varDef => varDef.variable));
|
716
|
-
};
|
717
|
-
}
|
718
|
-
if (argumentsSelector) {
|
719
|
-
listeners[argumentsSelector] = (node) => {
|
720
|
-
checkNodes(node.arguments);
|
721
|
-
};
|
722
|
-
}
|
723
|
-
return listeners;
|
724
|
-
},
|
725
|
-
};
|
726
|
-
|
727
484
|
const AVOID_DUPLICATE_FIELDS = 'AVOID_DUPLICATE_FIELDS';
|
728
485
|
const ensureUnique = () => {
|
729
486
|
const set = new Set();
|
@@ -738,7 +495,7 @@ const ensureUnique = () => {
|
|
738
495
|
},
|
739
496
|
};
|
740
497
|
};
|
741
|
-
const rule
|
498
|
+
const rule = {
|
742
499
|
meta: {
|
743
500
|
type: 'suggestion',
|
744
501
|
docs: {
|
@@ -846,7 +603,7 @@ const rule$1 = {
|
|
846
603
|
};
|
847
604
|
|
848
605
|
const AVOID_OPERATION_NAME_PREFIX = 'AVOID_OPERATION_NAME_PREFIX';
|
849
|
-
const rule$
|
606
|
+
const rule$1 = {
|
850
607
|
meta: {
|
851
608
|
type: 'suggestion',
|
852
609
|
docs: {
|
@@ -932,7 +689,7 @@ const rule$2 = {
|
|
932
689
|
},
|
933
690
|
};
|
934
691
|
|
935
|
-
const rule$
|
692
|
+
const rule$2 = {
|
936
693
|
meta: {
|
937
694
|
type: 'suggestion',
|
938
695
|
docs: {
|
@@ -984,7 +741,7 @@ const rule$3 = {
|
|
984
741
|
};
|
985
742
|
|
986
743
|
const AVOID_TYPENAME_PREFIX = 'AVOID_TYPENAME_PREFIX';
|
987
|
-
const rule$
|
744
|
+
const rule$3 = {
|
988
745
|
meta: {
|
989
746
|
type: 'suggestion',
|
990
747
|
docs: {
|
@@ -1038,7 +795,7 @@ const rule$4 = {
|
|
1038
795
|
},
|
1039
796
|
};
|
1040
797
|
|
1041
|
-
const rule$
|
798
|
+
const rule$4 = {
|
1042
799
|
meta: {
|
1043
800
|
type: 'suggestion',
|
1044
801
|
docs: {
|
@@ -1049,9 +806,9 @@ const rule$5 = {
|
|
1049
806
|
code: /* GraphQL */ `
|
1050
807
|
""" Description """
|
1051
808
|
type someTypeName {
|
1052
|
-
|
809
|
+
...
|
1053
810
|
}
|
1054
|
-
|
811
|
+
`,
|
1055
812
|
},
|
1056
813
|
{
|
1057
814
|
title: 'Correct',
|
@@ -1059,9 +816,9 @@ const rule$5 = {
|
|
1059
816
|
code: /* GraphQL */ `
|
1060
817
|
" Description "
|
1061
818
|
type someTypeName {
|
1062
|
-
|
819
|
+
...
|
1063
820
|
}
|
1064
|
-
|
821
|
+
`,
|
1065
822
|
},
|
1066
823
|
],
|
1067
824
|
description: 'Require all comments to follow the same style (either block or inline).',
|
@@ -1098,7 +855,7 @@ const rule$5 = {
|
|
1098
855
|
},
|
1099
856
|
};
|
1100
857
|
|
1101
|
-
const rule$
|
858
|
+
const rule$5 = {
|
1102
859
|
meta: {
|
1103
860
|
type: 'suggestion',
|
1104
861
|
docs: {
|
@@ -1223,7 +980,7 @@ const CASE_STYLES = [
|
|
1223
980
|
const schemaOption = {
|
1224
981
|
oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
|
1225
982
|
};
|
1226
|
-
const rule$
|
983
|
+
const rule$6 = {
|
1227
984
|
meta: {
|
1228
985
|
type: 'suggestion',
|
1229
986
|
docs: {
|
@@ -1468,7 +1225,7 @@ function checkNameFormat(params) {
|
|
1468
1225
|
const schemaOption$1 = {
|
1469
1226
|
oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
|
1470
1227
|
};
|
1471
|
-
const rule$
|
1228
|
+
const rule$7 = {
|
1472
1229
|
meta: {
|
1473
1230
|
type: 'suggestion',
|
1474
1231
|
docs: {
|
@@ -1580,18 +1337,18 @@ const rule$8 = {
|
|
1580
1337
|
style,
|
1581
1338
|
leadingUnderscore: options.leadingUnderscore,
|
1582
1339
|
trailingUnderscore: options.trailingUnderscore,
|
1583
|
-
prefix,
|
1584
|
-
suffix,
|
1585
|
-
forbiddenPrefixes,
|
1586
|
-
forbiddenSuffixes,
|
1340
|
+
prefix: prefix,
|
1341
|
+
suffix: suffix,
|
1342
|
+
forbiddenPrefixes: forbiddenPrefixes,
|
1343
|
+
forbiddenSuffixes: forbiddenSuffixes,
|
1587
1344
|
});
|
1588
1345
|
if (result.ok === false) {
|
1589
1346
|
context.report({
|
1590
1347
|
node,
|
1591
1348
|
message: result.errorMessage,
|
1592
1349
|
data: {
|
1593
|
-
prefix,
|
1594
|
-
suffix,
|
1350
|
+
prefix: prefix,
|
1351
|
+
suffix: suffix,
|
1595
1352
|
format: style,
|
1596
1353
|
forbiddenPrefixes: forbiddenPrefixes.join(', '),
|
1597
1354
|
forbiddenSuffixes: forbiddenSuffixes.join(', '),
|
@@ -1697,7 +1454,7 @@ const rule$8 = {
|
|
1697
1454
|
};
|
1698
1455
|
|
1699
1456
|
const NO_ANONYMOUS_OPERATIONS = 'NO_ANONYMOUS_OPERATIONS';
|
1700
|
-
const rule$
|
1457
|
+
const rule$8 = {
|
1701
1458
|
meta: {
|
1702
1459
|
type: 'suggestion',
|
1703
1460
|
docs: {
|
@@ -1755,7 +1512,7 @@ const rule$9 = {
|
|
1755
1512
|
};
|
1756
1513
|
|
1757
1514
|
const ERROR_MESSAGE_ID = 'NO_CASE_INSENSITIVE_ENUM_VALUES_DUPLICATES';
|
1758
|
-
const rule$
|
1515
|
+
const rule$9 = {
|
1759
1516
|
meta: {
|
1760
1517
|
type: 'suggestion',
|
1761
1518
|
docs: {
|
@@ -1810,7 +1567,7 @@ const rule$a = {
|
|
1810
1567
|
};
|
1811
1568
|
|
1812
1569
|
const NO_DEPRECATED = 'NO_DEPRECATED';
|
1813
|
-
const rule$
|
1570
|
+
const rule$a = {
|
1814
1571
|
meta: {
|
1815
1572
|
type: 'suggestion',
|
1816
1573
|
docs: {
|
@@ -1924,7 +1681,7 @@ const rule$b = {
|
|
1924
1681
|
};
|
1925
1682
|
|
1926
1683
|
const HASHTAG_COMMENT = 'HASHTAG_COMMENT';
|
1927
|
-
const rule$
|
1684
|
+
const rule$b = {
|
1928
1685
|
meta: {
|
1929
1686
|
messages: {
|
1930
1687
|
[HASHTAG_COMMENT]: 'Using hashtag (#) for adding GraphQL descriptions is not allowed. Prefer using """ for multiline, or " for a single line description.',
|
@@ -1999,7 +1756,7 @@ const rule$c = {
|
|
1999
1756
|
};
|
2000
1757
|
|
2001
1758
|
const NO_OPERATION_NAME_SUFFIX = 'NO_OPERATION_NAME_SUFFIX';
|
2002
|
-
const rule$
|
1759
|
+
const rule$c = {
|
2003
1760
|
meta: {
|
2004
1761
|
fixable: 'code',
|
2005
1762
|
type: 'suggestion',
|
@@ -2054,7 +1811,7 @@ const rule$d = {
|
|
2054
1811
|
|
2055
1812
|
const UNREACHABLE_TYPE = 'UNREACHABLE_TYPE';
|
2056
1813
|
const RULE_NAME = 'no-unreachable-types';
|
2057
|
-
const rule$
|
1814
|
+
const rule$d = {
|
2058
1815
|
meta: {
|
2059
1816
|
messages: {
|
2060
1817
|
[UNREACHABLE_TYPE]: `Type "{{ typeName }}" is unreachable`,
|
@@ -2129,7 +1886,7 @@ const rule$e = {
|
|
2129
1886
|
|
2130
1887
|
const UNUSED_FIELD = 'UNUSED_FIELD';
|
2131
1888
|
const RULE_NAME$1 = 'no-unused-fields';
|
2132
|
-
const rule$
|
1889
|
+
const rule$e = {
|
2133
1890
|
meta: {
|
2134
1891
|
messages: {
|
2135
1892
|
[UNUSED_FIELD]: `Field "{{fieldName}}" is unused`,
|
@@ -2316,7 +2073,7 @@ const MESSAGE_REQUIRE_DATE = 'MESSAGE_REQUIRE_DATE';
|
|
2316
2073
|
const MESSAGE_INVALID_FORMAT = 'MESSAGE_INVALID_FORMAT';
|
2317
2074
|
const MESSAGE_INVALID_DATE = 'MESSAGE_INVALID_DATE';
|
2318
2075
|
const MESSAGE_CAN_BE_REMOVED = 'MESSAGE_CAN_BE_REMOVED';
|
2319
|
-
const rule$
|
2076
|
+
const rule$f = {
|
2320
2077
|
meta: {
|
2321
2078
|
type: 'suggestion',
|
2322
2079
|
docs: {
|
@@ -2416,7 +2173,7 @@ const rule$g = {
|
|
2416
2173
|
},
|
2417
2174
|
};
|
2418
2175
|
|
2419
|
-
const rule$
|
2176
|
+
const rule$g = {
|
2420
2177
|
meta: {
|
2421
2178
|
docs: {
|
2422
2179
|
description: `Require all deprecation directives to specify a reason.`,
|
@@ -2506,7 +2263,7 @@ function verifyRule(context, node) {
|
|
2506
2263
|
}
|
2507
2264
|
}
|
2508
2265
|
}
|
2509
|
-
const rule$
|
2266
|
+
const rule$h = {
|
2510
2267
|
meta: {
|
2511
2268
|
docs: {
|
2512
2269
|
category: 'Best Practices',
|
@@ -2571,7 +2328,7 @@ const rule$i = {
|
|
2571
2328
|
};
|
2572
2329
|
|
2573
2330
|
const RULE_NAME$2 = 'require-field-of-type-query-in-mutation-result';
|
2574
|
-
const rule$
|
2331
|
+
const rule$i = {
|
2575
2332
|
meta: {
|
2576
2333
|
type: 'suggestion',
|
2577
2334
|
docs: {
|
@@ -2734,7 +2491,7 @@ const convertNode = (typeInfo) => (node, key, parent) => {
|
|
2734
2491
|
|
2735
2492
|
const REQUIRE_ID_WHEN_AVAILABLE = 'REQUIRE_ID_WHEN_AVAILABLE';
|
2736
2493
|
const DEFAULT_ID_FIELD_NAME = 'id';
|
2737
|
-
const rule$
|
2494
|
+
const rule$j = {
|
2738
2495
|
meta: {
|
2739
2496
|
type: 'suggestion',
|
2740
2497
|
docs: {
|
@@ -2870,7 +2627,7 @@ const rule$k = {
|
|
2870
2627
|
},
|
2871
2628
|
};
|
2872
2629
|
|
2873
|
-
const rule$
|
2630
|
+
const rule$k = {
|
2874
2631
|
meta: {
|
2875
2632
|
docs: {
|
2876
2633
|
category: 'Best Practices',
|
@@ -2992,7 +2749,7 @@ const shouldIgnoreNode = ({ node, exceptions }) => {
|
|
2992
2749
|
}
|
2993
2750
|
return false;
|
2994
2751
|
};
|
2995
|
-
const rule$
|
2752
|
+
const rule$l = {
|
2996
2753
|
meta: {
|
2997
2754
|
type: 'suggestion',
|
2998
2755
|
docs: {
|
@@ -3182,7 +2939,7 @@ const checkNode = (context, node, ruleName, messageId) => {
|
|
3182
2939
|
});
|
3183
2940
|
}
|
3184
2941
|
};
|
3185
|
-
const rule$
|
2942
|
+
const rule$m = {
|
3186
2943
|
meta: {
|
3187
2944
|
type: 'suggestion',
|
3188
2945
|
docs: {
|
@@ -3240,7 +2997,7 @@ const rule$n = {
|
|
3240
2997
|
|
3241
2998
|
const RULE_NAME$4 = 'unique-operation-name';
|
3242
2999
|
const UNIQUE_OPERATION_NAME = 'UNIQUE_OPERATION_NAME';
|
3243
|
-
const rule$
|
3000
|
+
const rule$n = {
|
3244
3001
|
meta: {
|
3245
3002
|
type: 'suggestion',
|
3246
3003
|
docs: {
|
@@ -3305,31 +3062,30 @@ const rule$o = {
|
|
3305
3062
|
*/
|
3306
3063
|
const rules = {
|
3307
3064
|
...GRAPHQL_JS_VALIDATIONS,
|
3308
|
-
|
3309
|
-
'avoid-
|
3310
|
-
'avoid-
|
3311
|
-
'avoid-
|
3312
|
-
'
|
3313
|
-
'
|
3314
|
-
'
|
3315
|
-
'
|
3316
|
-
'
|
3317
|
-
'no-
|
3318
|
-
'no-
|
3319
|
-
'no-
|
3320
|
-
'no-
|
3321
|
-
'no-
|
3322
|
-
'no-
|
3323
|
-
'
|
3324
|
-
'require-deprecation-
|
3325
|
-
'require-
|
3326
|
-
'require-
|
3327
|
-
'require-
|
3328
|
-
'
|
3329
|
-
'
|
3330
|
-
'
|
3331
|
-
'unique-
|
3332
|
-
'unique-operation-name': rule$o,
|
3065
|
+
'avoid-duplicate-fields': rule,
|
3066
|
+
'avoid-operation-name-prefix': rule$1,
|
3067
|
+
'avoid-scalar-result-type-on-mutation': rule$2,
|
3068
|
+
'avoid-typename-prefix': rule$3,
|
3069
|
+
'description-style': rule$4,
|
3070
|
+
'input-name': rule$5,
|
3071
|
+
'match-document-filename': rule$6,
|
3072
|
+
'naming-convention': rule$7,
|
3073
|
+
'no-anonymous-operations': rule$8,
|
3074
|
+
'no-case-insensitive-enum-values-duplicates': rule$9,
|
3075
|
+
'no-deprecated': rule$a,
|
3076
|
+
'no-hashtag-description': rule$b,
|
3077
|
+
'no-operation-name-suffix': rule$c,
|
3078
|
+
'no-unreachable-types': rule$d,
|
3079
|
+
'no-unused-fields': rule$e,
|
3080
|
+
'require-deprecation-date': rule$f,
|
3081
|
+
'require-deprecation-reason': rule$g,
|
3082
|
+
'require-description': rule$h,
|
3083
|
+
'require-field-of-type-query-in-mutation-result': rule$i,
|
3084
|
+
'require-id-when-available': rule$j,
|
3085
|
+
'selection-set-depth': rule$k,
|
3086
|
+
'strict-id-in-types': rule$l,
|
3087
|
+
'unique-fragment-name': rule$m,
|
3088
|
+
'unique-operation-name': rule$n,
|
3333
3089
|
};
|
3334
3090
|
|
3335
3091
|
const RELEVANT_KEYWORDS = ['gql', 'graphql', '/* GraphQL */'];
|