@graphql-eslint/eslint-plugin 2.3.0-alpha-6ba4002.0 → 2.4.0-alpha-be7d9d8.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/index.js CHANGED
@@ -71,6 +71,16 @@ 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
+ ],
74
84
  '@graphql-eslint/avoid-duplicate-fields': 'error',
75
85
  '@graphql-eslint/avoid-operation-name-prefix': 'error',
76
86
  '@graphql-eslint/avoid-scalar-result-type-on-mutation': 'error',
@@ -405,7 +415,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
405
415
  description: `A GraphQL fragment is only valid when it does not have cycles in fragments usage.`,
406
416
  }), validationToRule('no-undefined-variables', 'NoUndefinedVariables', {
407
417
  description: `A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.`,
408
- }), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
418
+ }, importFiles), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
409
419
  description: `A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.`,
410
420
  requiresSiblings: true,
411
421
  }, context => {
@@ -481,6 +491,240 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
481
491
  description: `Variables passed to field arguments conform to type.`,
482
492
  }));
483
493
 
494
+ const ALPHABETIZE = 'ALPHABETIZE';
495
+ const fieldsEnum = [graphql.Kind.OBJECT_TYPE_DEFINITION, graphql.Kind.INTERFACE_TYPE_DEFINITION, graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION];
496
+ const valuesEnum = [graphql.Kind.ENUM_TYPE_DEFINITION];
497
+ const selectionsEnum = [graphql.Kind.OPERATION_DEFINITION, graphql.Kind.FRAGMENT_DEFINITION];
498
+ const variablesEnum = [graphql.Kind.OPERATION_DEFINITION];
499
+ const argumentsEnum = [graphql.Kind.FIELD_DEFINITION, graphql.Kind.FIELD, graphql.Kind.DIRECTIVE_DEFINITION, graphql.Kind.DIRECTIVE];
500
+ const rule = {
501
+ meta: {
502
+ type: 'suggestion',
503
+ docs: {
504
+ category: 'Best Practices',
505
+ description: 'Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.',
506
+ url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/alphabetize.md',
507
+ examples: [
508
+ {
509
+ title: 'Incorrect',
510
+ usage: [{ fields: [graphql.Kind.OBJECT_TYPE_DEFINITION] }],
511
+ code: /* GraphQL */ `
512
+ type User {
513
+ password: String
514
+ firstName: String! # should be before "password"
515
+ age: Int # should be before "firstName"
516
+ lastName: String!
517
+ }
518
+ `,
519
+ },
520
+ {
521
+ title: 'Correct',
522
+ usage: [{ fields: [graphql.Kind.OBJECT_TYPE_DEFINITION] }],
523
+ code: /* GraphQL */ `
524
+ type User {
525
+ age: Int
526
+ firstName: String!
527
+ lastName: String!
528
+ password: String
529
+ }
530
+ `,
531
+ },
532
+ {
533
+ title: 'Incorrect',
534
+ usage: [{ values: [graphql.Kind.ENUM_TYPE_DEFINITION] }],
535
+ code: /* GraphQL */ `
536
+ enum Role {
537
+ SUPER_ADMIN
538
+ ADMIN # should be before "SUPER_ADMIN"
539
+ USER
540
+ GOD # should be before "USER"
541
+ }
542
+ `,
543
+ },
544
+ {
545
+ title: 'Correct',
546
+ usage: [{ values: [graphql.Kind.ENUM_TYPE_DEFINITION] }],
547
+ code: /* GraphQL */ `
548
+ enum Role {
549
+ ADMIN
550
+ GOD
551
+ SUPER_ADMIN
552
+ USER
553
+ }
554
+ `,
555
+ },
556
+ {
557
+ title: 'Incorrect',
558
+ usage: [{ selections: [graphql.Kind.OPERATION_DEFINITION] }],
559
+ code: /* GraphQL */ `
560
+ query {
561
+ me {
562
+ firstName
563
+ lastName
564
+ email # should be before "lastName"
565
+ }
566
+ }
567
+ `,
568
+ },
569
+ {
570
+ title: 'Correct',
571
+ usage: [{ selections: [graphql.Kind.OPERATION_DEFINITION] }],
572
+ code: /* GraphQL */ `
573
+ query {
574
+ me {
575
+ email
576
+ firstName
577
+ lastName
578
+ }
579
+ }
580
+ `,
581
+ },
582
+ ],
583
+ optionsForConfig: [
584
+ {
585
+ fields: fieldsEnum,
586
+ values: valuesEnum,
587
+ selections: selectionsEnum,
588
+ variables: variablesEnum,
589
+ arguments: argumentsEnum,
590
+ },
591
+ ],
592
+ },
593
+ messages: {
594
+ [ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}".',
595
+ },
596
+ schema: {
597
+ type: 'array',
598
+ minItems: 1,
599
+ maxItems: 1,
600
+ items: {
601
+ type: 'object',
602
+ additionalProperties: false,
603
+ minProperties: 1,
604
+ properties: {
605
+ fields: {
606
+ type: 'array',
607
+ contains: {
608
+ enum: fieldsEnum,
609
+ },
610
+ description: 'Fields of `type`, `interface`, and `input`.',
611
+ },
612
+ values: {
613
+ type: 'array',
614
+ contains: {
615
+ enum: valuesEnum,
616
+ },
617
+ description: 'Values of `enum`.',
618
+ },
619
+ selections: {
620
+ type: 'array',
621
+ contains: {
622
+ enum: selectionsEnum,
623
+ },
624
+ description: 'Selections of operations (`query`, `mutation` and `subscription`) and `fragment`.',
625
+ },
626
+ variables: {
627
+ type: 'array',
628
+ contains: {
629
+ enum: variablesEnum,
630
+ },
631
+ description: 'Variables of operations (`query`, `mutation` and `subscription`).',
632
+ },
633
+ arguments: {
634
+ type: 'array',
635
+ contains: {
636
+ enum: argumentsEnum,
637
+ },
638
+ description: 'Arguments of fields and directives.',
639
+ },
640
+ },
641
+ },
642
+ },
643
+ },
644
+ create(context) {
645
+ var _a, _b, _c, _d, _e;
646
+ function checkNodes(nodes) {
647
+ let prevName = null;
648
+ for (const node of nodes) {
649
+ const currName = node.name.value;
650
+ if (prevName && prevName > currName) {
651
+ const { start, end } = node.name.loc;
652
+ const isVariableNode = node.kind === graphql.Kind.VARIABLE;
653
+ context.report({
654
+ loc: {
655
+ start: {
656
+ line: start.line,
657
+ column: start.column - (isVariableNode ? 2 : 1),
658
+ },
659
+ end: {
660
+ line: end.line,
661
+ column: end.column,
662
+ },
663
+ },
664
+ messageId: ALPHABETIZE,
665
+ data: isVariableNode
666
+ ? {
667
+ currName: `$${currName}`,
668
+ prevName: `$${prevName}`,
669
+ }
670
+ : { currName, prevName },
671
+ });
672
+ }
673
+ prevName = currName;
674
+ }
675
+ }
676
+ const opts = context.options[0];
677
+ const fields = new Set((_a = opts.fields) !== null && _a !== void 0 ? _a : []);
678
+ const listeners = {};
679
+ const fieldsSelector = [
680
+ fields.has(graphql.Kind.OBJECT_TYPE_DEFINITION) && [graphql.Kind.OBJECT_TYPE_DEFINITION, graphql.Kind.OBJECT_TYPE_EXTENSION],
681
+ fields.has(graphql.Kind.INTERFACE_TYPE_DEFINITION) && [graphql.Kind.INTERFACE_TYPE_DEFINITION, graphql.Kind.INTERFACE_TYPE_EXTENSION],
682
+ fields.has(graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION) && [
683
+ graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION,
684
+ graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION,
685
+ ],
686
+ ]
687
+ .flat()
688
+ .join(',');
689
+ const hasEnumValues = ((_b = opts.values) === null || _b === void 0 ? void 0 : _b[0]) === graphql.Kind.ENUM_TYPE_DEFINITION;
690
+ const selectionsSelector = (_c = opts.selections) === null || _c === void 0 ? void 0 : _c.join(',');
691
+ const hasVariables = ((_d = opts.variables) === null || _d === void 0 ? void 0 : _d[0]) === graphql.Kind.OPERATION_DEFINITION;
692
+ const argumentsSelector = (_e = opts.arguments) === null || _e === void 0 ? void 0 : _e.join(',');
693
+ if (fieldsSelector) {
694
+ listeners[fieldsSelector] = (node) => {
695
+ checkNodes(node.fields);
696
+ };
697
+ }
698
+ if (hasEnumValues) {
699
+ const enumValuesSelector = [graphql.Kind.ENUM_TYPE_DEFINITION, graphql.Kind.ENUM_TYPE_EXTENSION].join(',');
700
+ listeners[enumValuesSelector] = (node) => {
701
+ checkNodes(node.values);
702
+ };
703
+ }
704
+ if (selectionsSelector) {
705
+ listeners[`:matches(${selectionsSelector}) SelectionSet`] = (node) => {
706
+ checkNodes(node.selections
707
+ // inline fragment don't have name, so we skip them
708
+ .filter(selection => selection.kind !== graphql.Kind.INLINE_FRAGMENT)
709
+ .map(selection =>
710
+ // sort by alias is field is renamed
711
+ 'alias' in selection && selection.alias ? { name: selection.alias } : selection));
712
+ };
713
+ }
714
+ if (hasVariables) {
715
+ listeners.OperationDefinition = (node) => {
716
+ checkNodes(node.variableDefinitions.map(varDef => varDef.variable));
717
+ };
718
+ }
719
+ if (argumentsSelector) {
720
+ listeners[argumentsSelector] = (node) => {
721
+ checkNodes(node.arguments);
722
+ };
723
+ }
724
+ return listeners;
725
+ },
726
+ };
727
+
484
728
  const AVOID_DUPLICATE_FIELDS = 'AVOID_DUPLICATE_FIELDS';
485
729
  const ensureUnique = () => {
486
730
  const set = new Set();
@@ -495,7 +739,7 @@ const ensureUnique = () => {
495
739
  },
496
740
  };
497
741
  };
498
- const rule = {
742
+ const rule$1 = {
499
743
  meta: {
500
744
  type: 'suggestion',
501
745
  docs: {
@@ -546,6 +790,7 @@ const rule = {
546
790
  messages: {
547
791
  [AVOID_DUPLICATE_FIELDS]: `{{ type }} "{{ fieldName }}" defined multiple times.`,
548
792
  },
793
+ schema: [],
549
794
  },
550
795
  create(context) {
551
796
  return {
@@ -603,7 +848,7 @@ const rule = {
603
848
  };
604
849
 
605
850
  const AVOID_OPERATION_NAME_PREFIX = 'AVOID_OPERATION_NAME_PREFIX';
606
- const rule$1 = {
851
+ const rule$2 = {
607
852
  meta: {
608
853
  type: 'suggestion',
609
854
  docs: {
@@ -689,7 +934,7 @@ const rule$1 = {
689
934
  },
690
935
  };
691
936
 
692
- const rule$2 = {
937
+ const rule$3 = {
693
938
  meta: {
694
939
  type: 'suggestion',
695
940
  docs: {
@@ -716,6 +961,7 @@ const rule$2 = {
716
961
  },
717
962
  ],
718
963
  },
964
+ schema: [],
719
965
  },
720
966
  create(context) {
721
967
  const schema = requireGraphQLSchemaFromContext('avoid-scalar-result-type-on-mutation', context);
@@ -741,7 +987,7 @@ const rule$2 = {
741
987
  };
742
988
 
743
989
  const AVOID_TYPENAME_PREFIX = 'AVOID_TYPENAME_PREFIX';
744
- const rule$3 = {
990
+ const rule$4 = {
745
991
  meta: {
746
992
  type: 'suggestion',
747
993
  docs: {
@@ -771,6 +1017,7 @@ const rule$3 = {
771
1017
  messages: {
772
1018
  [AVOID_TYPENAME_PREFIX]: `Field "{{ fieldName }}" starts with the name of the parent type "{{ typeName }}"`,
773
1019
  },
1020
+ schema: [],
774
1021
  },
775
1022
  create(context) {
776
1023
  return {
@@ -795,7 +1042,7 @@ const rule$3 = {
795
1042
  },
796
1043
  };
797
1044
 
798
- const rule$4 = {
1045
+ const rule$5 = {
799
1046
  meta: {
800
1047
  type: 'suggestion',
801
1048
  docs: {
@@ -806,9 +1053,9 @@ const rule$4 = {
806
1053
  code: /* GraphQL */ `
807
1054
  """ Description """
808
1055
  type someTypeName {
809
- ...
1056
+ # ...
810
1057
  }
811
- `,
1058
+ `,
812
1059
  },
813
1060
  {
814
1061
  title: 'Correct',
@@ -816,9 +1063,9 @@ const rule$4 = {
816
1063
  code: /* GraphQL */ `
817
1064
  " Description "
818
1065
  type someTypeName {
819
- ...
1066
+ # ...
820
1067
  }
821
- `,
1068
+ `,
822
1069
  },
823
1070
  ],
824
1071
  description: 'Require all comments to follow the same style (either block or inline).',
@@ -855,7 +1102,7 @@ const rule$4 = {
855
1102
  },
856
1103
  };
857
1104
 
858
- const rule$5 = {
1105
+ const rule$6 = {
859
1106
  meta: {
860
1107
  type: 'suggestion',
861
1108
  docs: {
@@ -980,7 +1227,7 @@ const CASE_STYLES = [
980
1227
  const schemaOption = {
981
1228
  oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
982
1229
  };
983
- const rule$6 = {
1230
+ const rule$7 = {
984
1231
  meta: {
985
1232
  type: 'suggestion',
986
1233
  docs: {
@@ -1225,7 +1472,7 @@ function checkNameFormat(params) {
1225
1472
  const schemaOption$1 = {
1226
1473
  oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
1227
1474
  };
1228
- const rule$7 = {
1475
+ const rule$8 = {
1229
1476
  meta: {
1230
1477
  type: 'suggestion',
1231
1478
  docs: {
@@ -1337,18 +1584,18 @@ const rule$7 = {
1337
1584
  style,
1338
1585
  leadingUnderscore: options.leadingUnderscore,
1339
1586
  trailingUnderscore: options.trailingUnderscore,
1340
- prefix: prefix,
1341
- suffix: suffix,
1342
- forbiddenPrefixes: forbiddenPrefixes,
1343
- forbiddenSuffixes: forbiddenSuffixes,
1587
+ prefix,
1588
+ suffix,
1589
+ forbiddenPrefixes,
1590
+ forbiddenSuffixes,
1344
1591
  });
1345
1592
  if (result.ok === false) {
1346
1593
  context.report({
1347
1594
  node,
1348
1595
  message: result.errorMessage,
1349
1596
  data: {
1350
- prefix: prefix,
1351
- suffix: suffix,
1597
+ prefix,
1598
+ suffix,
1352
1599
  format: style,
1353
1600
  forbiddenPrefixes: forbiddenPrefixes.join(', '),
1354
1601
  forbiddenSuffixes: forbiddenSuffixes.join(', '),
@@ -1454,7 +1701,7 @@ const rule$7 = {
1454
1701
  };
1455
1702
 
1456
1703
  const NO_ANONYMOUS_OPERATIONS = 'NO_ANONYMOUS_OPERATIONS';
1457
- const rule$8 = {
1704
+ const rule$9 = {
1458
1705
  meta: {
1459
1706
  type: 'suggestion',
1460
1707
  docs: {
@@ -1484,6 +1731,7 @@ const rule$8 = {
1484
1731
  messages: {
1485
1732
  [NO_ANONYMOUS_OPERATIONS]: `Anonymous GraphQL operations are forbidden. Please make sure to name your {{ operation }}!`,
1486
1733
  },
1734
+ schema: [],
1487
1735
  },
1488
1736
  create(context) {
1489
1737
  return {
@@ -1512,7 +1760,7 @@ const rule$8 = {
1512
1760
  };
1513
1761
 
1514
1762
  const ERROR_MESSAGE_ID = 'NO_CASE_INSENSITIVE_ENUM_VALUES_DUPLICATES';
1515
- const rule$9 = {
1763
+ const rule$a = {
1516
1764
  meta: {
1517
1765
  type: 'suggestion',
1518
1766
  docs: {
@@ -1547,6 +1795,7 @@ const rule$9 = {
1547
1795
  messages: {
1548
1796
  [ERROR_MESSAGE_ID]: `Case-insensitive enum values duplicates are not allowed! Found: "{{ found }}"`,
1549
1797
  },
1798
+ schema: [],
1550
1799
  },
1551
1800
  create(context) {
1552
1801
  return {
@@ -1567,7 +1816,7 @@ const rule$9 = {
1567
1816
  };
1568
1817
 
1569
1818
  const NO_DEPRECATED = 'NO_DEPRECATED';
1570
- const rule$a = {
1819
+ const rule$b = {
1571
1820
  meta: {
1572
1821
  type: 'suggestion',
1573
1822
  docs: {
@@ -1641,6 +1890,7 @@ const rule$a = {
1641
1890
  messages: {
1642
1891
  [NO_DEPRECATED]: `This {{ type }} is marked as deprecated in your GraphQL schema {{ reason }}`,
1643
1892
  },
1893
+ schema: [],
1644
1894
  },
1645
1895
  create(context) {
1646
1896
  return {
@@ -1648,7 +1898,7 @@ const rule$a = {
1648
1898
  requireGraphQLSchemaFromContext('no-deprecated', context);
1649
1899
  const typeInfo = node.typeInfo();
1650
1900
  if (typeInfo && typeInfo.enumValue) {
1651
- if (typeInfo.enumValue.isDeprecated) {
1901
+ if (typeInfo.enumValue.deprecationReason) {
1652
1902
  context.report({
1653
1903
  loc: node.loc,
1654
1904
  messageId: NO_DEPRECATED,
@@ -1664,7 +1914,7 @@ const rule$a = {
1664
1914
  requireGraphQLSchemaFromContext('no-deprecated', context);
1665
1915
  const typeInfo = node.typeInfo();
1666
1916
  if (typeInfo && typeInfo.fieldDef) {
1667
- if (typeInfo.fieldDef.isDeprecated) {
1917
+ if (typeInfo.fieldDef.deprecationReason) {
1668
1918
  context.report({
1669
1919
  loc: node.loc,
1670
1920
  messageId: NO_DEPRECATED,
@@ -1681,7 +1931,7 @@ const rule$a = {
1681
1931
  };
1682
1932
 
1683
1933
  const HASHTAG_COMMENT = 'HASHTAG_COMMENT';
1684
- const rule$b = {
1934
+ const rule$c = {
1685
1935
  meta: {
1686
1936
  messages: {
1687
1937
  [HASHTAG_COMMENT]: 'Using hashtag (#) for adding GraphQL descriptions is not allowed. Prefer using """ for multiline, or " for a single line description.',
@@ -1727,6 +1977,7 @@ const rule$b = {
1727
1977
  ],
1728
1978
  },
1729
1979
  type: 'suggestion',
1980
+ schema: [],
1730
1981
  },
1731
1982
  create(context) {
1732
1983
  return {
@@ -1756,7 +2007,7 @@ const rule$b = {
1756
2007
  };
1757
2008
 
1758
2009
  const NO_OPERATION_NAME_SUFFIX = 'NO_OPERATION_NAME_SUFFIX';
1759
- const rule$c = {
2010
+ const rule$d = {
1760
2011
  meta: {
1761
2012
  fixable: 'code',
1762
2013
  type: 'suggestion',
@@ -1787,6 +2038,7 @@ const rule$c = {
1787
2038
  messages: {
1788
2039
  [NO_OPERATION_NAME_SUFFIX]: `Unnecessary "{{ invalidSuffix }}" suffix in your operation name!`,
1789
2040
  },
2041
+ schema: [],
1790
2042
  },
1791
2043
  create(context) {
1792
2044
  return {
@@ -1811,7 +2063,7 @@ const rule$c = {
1811
2063
 
1812
2064
  const UNREACHABLE_TYPE = 'UNREACHABLE_TYPE';
1813
2065
  const RULE_NAME = 'no-unreachable-types';
1814
- const rule$d = {
2066
+ const rule$e = {
1815
2067
  meta: {
1816
2068
  messages: {
1817
2069
  [UNREACHABLE_TYPE]: `Type "{{ typeName }}" is unreachable`,
@@ -1852,6 +2104,7 @@ const rule$d = {
1852
2104
  },
1853
2105
  fixable: 'code',
1854
2106
  type: 'suggestion',
2107
+ schema: [],
1855
2108
  },
1856
2109
  create(context) {
1857
2110
  const reachableTypes = requireReachableTypesFromContext(RULE_NAME, context);
@@ -1886,7 +2139,7 @@ const rule$d = {
1886
2139
 
1887
2140
  const UNUSED_FIELD = 'UNUSED_FIELD';
1888
2141
  const RULE_NAME$1 = 'no-unused-fields';
1889
- const rule$e = {
2142
+ const rule$f = {
1890
2143
  meta: {
1891
2144
  messages: {
1892
2145
  [UNUSED_FIELD]: `Field "{{fieldName}}" is unused`,
@@ -1943,6 +2196,7 @@ const rule$e = {
1943
2196
  },
1944
2197
  fixable: 'code',
1945
2198
  type: 'suggestion',
2199
+ schema: [],
1946
2200
  },
1947
2201
  create(context) {
1948
2202
  const usedFields = requireUsedFieldsFromContext(RULE_NAME$1, context);
@@ -2073,7 +2327,7 @@ const MESSAGE_REQUIRE_DATE = 'MESSAGE_REQUIRE_DATE';
2073
2327
  const MESSAGE_INVALID_FORMAT = 'MESSAGE_INVALID_FORMAT';
2074
2328
  const MESSAGE_INVALID_DATE = 'MESSAGE_INVALID_DATE';
2075
2329
  const MESSAGE_CAN_BE_REMOVED = 'MESSAGE_CAN_BE_REMOVED';
2076
- const rule$f = {
2330
+ const rule$g = {
2077
2331
  meta: {
2078
2332
  type: 'suggestion',
2079
2333
  docs: {
@@ -2173,7 +2427,7 @@ const rule$f = {
2173
2427
  },
2174
2428
  };
2175
2429
 
2176
- const rule$g = {
2430
+ const rule$h = {
2177
2431
  meta: {
2178
2432
  docs: {
2179
2433
  description: `Require all deprecation directives to specify a reason.`,
@@ -2208,6 +2462,7 @@ const rule$g = {
2208
2462
  ],
2209
2463
  },
2210
2464
  type: 'suggestion',
2465
+ schema: [],
2211
2466
  },
2212
2467
  create(context) {
2213
2468
  return {
@@ -2263,7 +2518,7 @@ function verifyRule(context, node) {
2263
2518
  }
2264
2519
  }
2265
2520
  }
2266
- const rule$h = {
2521
+ const rule$i = {
2267
2522
  meta: {
2268
2523
  docs: {
2269
2524
  category: 'Best Practices',
@@ -2272,7 +2527,7 @@ const rule$h = {
2272
2527
  examples: [
2273
2528
  {
2274
2529
  title: 'Incorrect',
2275
- usage: [{ on: ['ObjectTypeDefinition', 'FieldDefinition'] }],
2530
+ usage: [{ on: [graphql.Kind.OBJECT_TYPE_DEFINITION, graphql.Kind.FIELD_DEFINITION] }],
2276
2531
  code: /* GraphQL */ `
2277
2532
  type someTypeName {
2278
2533
  name: String
@@ -2281,7 +2536,7 @@ const rule$h = {
2281
2536
  },
2282
2537
  {
2283
2538
  title: 'Correct',
2284
- usage: [{ on: ['ObjectTypeDefinition', 'FieldDefinition'] }],
2539
+ usage: [{ on: [graphql.Kind.OBJECT_TYPE_DEFINITION, graphql.Kind.FIELD_DEFINITION] }],
2285
2540
  code: /* GraphQL */ `
2286
2541
  """
2287
2542
  Some type description
@@ -2328,7 +2583,7 @@ const rule$h = {
2328
2583
  };
2329
2584
 
2330
2585
  const RULE_NAME$2 = 'require-field-of-type-query-in-mutation-result';
2331
- const rule$i = {
2586
+ const rule$j = {
2332
2587
  meta: {
2333
2588
  type: 'suggestion',
2334
2589
  docs: {
@@ -2366,6 +2621,7 @@ const rule$i = {
2366
2621
  },
2367
2622
  ],
2368
2623
  },
2624
+ schema: [],
2369
2625
  },
2370
2626
  create(context) {
2371
2627
  const schema = requireGraphQLSchemaFromContext(RULE_NAME$2, context);
@@ -2491,7 +2747,7 @@ const convertNode = (typeInfo) => (node, key, parent) => {
2491
2747
 
2492
2748
  const REQUIRE_ID_WHEN_AVAILABLE = 'REQUIRE_ID_WHEN_AVAILABLE';
2493
2749
  const DEFAULT_ID_FIELD_NAME = 'id';
2494
- const rule$j = {
2750
+ const rule$k = {
2495
2751
  meta: {
2496
2752
  type: 'suggestion',
2497
2753
  docs: {
@@ -2627,7 +2883,7 @@ const rule$j = {
2627
2883
  },
2628
2884
  };
2629
2885
 
2630
- const rule$k = {
2886
+ const rule$l = {
2631
2887
  meta: {
2632
2888
  docs: {
2633
2889
  category: 'Best Practices',
@@ -2749,7 +3005,7 @@ const shouldIgnoreNode = ({ node, exceptions }) => {
2749
3005
  }
2750
3006
  return false;
2751
3007
  };
2752
- const rule$l = {
3008
+ const rule$m = {
2753
3009
  meta: {
2754
3010
  type: 'suggestion',
2755
3011
  docs: {
@@ -2939,7 +3195,7 @@ const checkNode = (context, node, ruleName, messageId) => {
2939
3195
  });
2940
3196
  }
2941
3197
  };
2942
- const rule$m = {
3198
+ const rule$n = {
2943
3199
  meta: {
2944
3200
  type: 'suggestion',
2945
3201
  docs: {
@@ -2985,6 +3241,7 @@ const rule$m = {
2985
3241
  messages: {
2986
3242
  [UNIQUE_FRAGMENT_NAME]: 'Fragment named "{{ documentName }}" already defined in:\n{{ summary }}',
2987
3243
  },
3244
+ schema: [],
2988
3245
  },
2989
3246
  create(context) {
2990
3247
  return {
@@ -2997,7 +3254,7 @@ const rule$m = {
2997
3254
 
2998
3255
  const RULE_NAME$4 = 'unique-operation-name';
2999
3256
  const UNIQUE_OPERATION_NAME = 'UNIQUE_OPERATION_NAME';
3000
- const rule$n = {
3257
+ const rule$o = {
3001
3258
  meta: {
3002
3259
  type: 'suggestion',
3003
3260
  docs: {
@@ -3047,6 +3304,7 @@ const rule$n = {
3047
3304
  messages: {
3048
3305
  [UNIQUE_OPERATION_NAME]: 'Operation named "{{ documentName }}" already defined in:\n{{ summary }}',
3049
3306
  },
3307
+ schema: [],
3050
3308
  },
3051
3309
  create(context) {
3052
3310
  return {
@@ -3062,30 +3320,31 @@ const rule$n = {
3062
3320
  */
3063
3321
  const rules = {
3064
3322
  ...GRAPHQL_JS_VALIDATIONS,
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,
3323
+ alphabetize: rule,
3324
+ 'avoid-duplicate-fields': rule$1,
3325
+ 'avoid-operation-name-prefix': rule$2,
3326
+ 'avoid-scalar-result-type-on-mutation': rule$3,
3327
+ 'avoid-typename-prefix': rule$4,
3328
+ 'description-style': rule$5,
3329
+ 'input-name': rule$6,
3330
+ 'match-document-filename': rule$7,
3331
+ 'naming-convention': rule$8,
3332
+ 'no-anonymous-operations': rule$9,
3333
+ 'no-case-insensitive-enum-values-duplicates': rule$a,
3334
+ 'no-deprecated': rule$b,
3335
+ 'no-hashtag-description': rule$c,
3336
+ 'no-operation-name-suffix': rule$d,
3337
+ 'no-unreachable-types': rule$e,
3338
+ 'no-unused-fields': rule$f,
3339
+ 'require-deprecation-date': rule$g,
3340
+ 'require-deprecation-reason': rule$h,
3341
+ 'require-description': rule$i,
3342
+ 'require-field-of-type-query-in-mutation-result': rule$j,
3343
+ 'require-id-when-available': rule$k,
3344
+ 'selection-set-depth': rule$l,
3345
+ 'strict-id-in-types': rule$m,
3346
+ 'unique-fragment-name': rule$n,
3347
+ 'unique-operation-name': rule$o,
3089
3348
  };
3090
3349
 
3091
3350
  const RELEVANT_KEYWORDS = ['gql', 'graphql', '/* GraphQL */'];