@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.mjs CHANGED
@@ -65,6 +65,16 @@ const allConfig = {
65
65
  ...recommendedConfig,
66
66
  rules: {
67
67
  ...recommendedConfig.rules,
68
+ '@graphql-eslint/alphabetize': [
69
+ 'error',
70
+ {
71
+ fields: ['ObjectTypeDefinition', 'InterfaceTypeDefinition', 'InputObjectTypeDefinition'],
72
+ values: ['EnumTypeDefinition'],
73
+ selections: ['OperationDefinition', 'FragmentDefinition'],
74
+ variables: ['OperationDefinition'],
75
+ arguments: ['FieldDefinition', 'Field', 'DirectiveDefinition', 'Directive'],
76
+ },
77
+ ],
68
78
  '@graphql-eslint/avoid-duplicate-fields': 'error',
69
79
  '@graphql-eslint/avoid-operation-name-prefix': 'error',
70
80
  '@graphql-eslint/avoid-scalar-result-type-on-mutation': 'error',
@@ -399,7 +409,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
399
409
  description: `A GraphQL fragment is only valid when it does not have cycles in fragments usage.`,
400
410
  }), validationToRule('no-undefined-variables', 'NoUndefinedVariables', {
401
411
  description: `A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.`,
402
- }), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
412
+ }, importFiles), validationToRule('no-unused-fragments', 'NoUnusedFragments', {
403
413
  description: `A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.`,
404
414
  requiresSiblings: true,
405
415
  }, context => {
@@ -475,6 +485,240 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign({}, validationToRule('executable-de
475
485
  description: `Variables passed to field arguments conform to type.`,
476
486
  }));
477
487
 
488
+ const ALPHABETIZE = 'ALPHABETIZE';
489
+ const fieldsEnum = [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION];
490
+ const valuesEnum = [Kind.ENUM_TYPE_DEFINITION];
491
+ const selectionsEnum = [Kind.OPERATION_DEFINITION, Kind.FRAGMENT_DEFINITION];
492
+ const variablesEnum = [Kind.OPERATION_DEFINITION];
493
+ const argumentsEnum = [Kind.FIELD_DEFINITION, Kind.FIELD, Kind.DIRECTIVE_DEFINITION, Kind.DIRECTIVE];
494
+ const rule = {
495
+ meta: {
496
+ type: 'suggestion',
497
+ docs: {
498
+ category: 'Best Practices',
499
+ description: 'Enforce arrange in alphabetical order for type fields, enum values, input object fields, operation selections and more.',
500
+ url: 'https://github.com/dotansimha/graphql-eslint/blob/master/docs/rules/alphabetize.md',
501
+ examples: [
502
+ {
503
+ title: 'Incorrect',
504
+ usage: [{ fields: [Kind.OBJECT_TYPE_DEFINITION] }],
505
+ code: /* GraphQL */ `
506
+ type User {
507
+ password: String
508
+ firstName: String! # should be before "password"
509
+ age: Int # should be before "firstName"
510
+ lastName: String!
511
+ }
512
+ `,
513
+ },
514
+ {
515
+ title: 'Correct',
516
+ usage: [{ fields: [Kind.OBJECT_TYPE_DEFINITION] }],
517
+ code: /* GraphQL */ `
518
+ type User {
519
+ age: Int
520
+ firstName: String!
521
+ lastName: String!
522
+ password: String
523
+ }
524
+ `,
525
+ },
526
+ {
527
+ title: 'Incorrect',
528
+ usage: [{ values: [Kind.ENUM_TYPE_DEFINITION] }],
529
+ code: /* GraphQL */ `
530
+ enum Role {
531
+ SUPER_ADMIN
532
+ ADMIN # should be before "SUPER_ADMIN"
533
+ USER
534
+ GOD # should be before "USER"
535
+ }
536
+ `,
537
+ },
538
+ {
539
+ title: 'Correct',
540
+ usage: [{ values: [Kind.ENUM_TYPE_DEFINITION] }],
541
+ code: /* GraphQL */ `
542
+ enum Role {
543
+ ADMIN
544
+ GOD
545
+ SUPER_ADMIN
546
+ USER
547
+ }
548
+ `,
549
+ },
550
+ {
551
+ title: 'Incorrect',
552
+ usage: [{ selections: [Kind.OPERATION_DEFINITION] }],
553
+ code: /* GraphQL */ `
554
+ query {
555
+ me {
556
+ firstName
557
+ lastName
558
+ email # should be before "lastName"
559
+ }
560
+ }
561
+ `,
562
+ },
563
+ {
564
+ title: 'Correct',
565
+ usage: [{ selections: [Kind.OPERATION_DEFINITION] }],
566
+ code: /* GraphQL */ `
567
+ query {
568
+ me {
569
+ email
570
+ firstName
571
+ lastName
572
+ }
573
+ }
574
+ `,
575
+ },
576
+ ],
577
+ optionsForConfig: [
578
+ {
579
+ fields: fieldsEnum,
580
+ values: valuesEnum,
581
+ selections: selectionsEnum,
582
+ variables: variablesEnum,
583
+ arguments: argumentsEnum,
584
+ },
585
+ ],
586
+ },
587
+ messages: {
588
+ [ALPHABETIZE]: '"{{ currName }}" should be before "{{ prevName }}".',
589
+ },
590
+ schema: {
591
+ type: 'array',
592
+ minItems: 1,
593
+ maxItems: 1,
594
+ items: {
595
+ type: 'object',
596
+ additionalProperties: false,
597
+ minProperties: 1,
598
+ properties: {
599
+ fields: {
600
+ type: 'array',
601
+ contains: {
602
+ enum: fieldsEnum,
603
+ },
604
+ description: 'Fields of `type`, `interface`, and `input`.',
605
+ },
606
+ values: {
607
+ type: 'array',
608
+ contains: {
609
+ enum: valuesEnum,
610
+ },
611
+ description: 'Values of `enum`.',
612
+ },
613
+ selections: {
614
+ type: 'array',
615
+ contains: {
616
+ enum: selectionsEnum,
617
+ },
618
+ description: 'Selections of operations (`query`, `mutation` and `subscription`) and `fragment`.',
619
+ },
620
+ variables: {
621
+ type: 'array',
622
+ contains: {
623
+ enum: variablesEnum,
624
+ },
625
+ description: 'Variables of operations (`query`, `mutation` and `subscription`).',
626
+ },
627
+ arguments: {
628
+ type: 'array',
629
+ contains: {
630
+ enum: argumentsEnum,
631
+ },
632
+ description: 'Arguments of fields and directives.',
633
+ },
634
+ },
635
+ },
636
+ },
637
+ },
638
+ create(context) {
639
+ var _a, _b, _c, _d, _e;
640
+ function checkNodes(nodes) {
641
+ let prevName = null;
642
+ for (const node of nodes) {
643
+ const currName = node.name.value;
644
+ if (prevName && prevName > currName) {
645
+ const { start, end } = node.name.loc;
646
+ const isVariableNode = node.kind === Kind.VARIABLE;
647
+ context.report({
648
+ loc: {
649
+ start: {
650
+ line: start.line,
651
+ column: start.column - (isVariableNode ? 2 : 1),
652
+ },
653
+ end: {
654
+ line: end.line,
655
+ column: end.column,
656
+ },
657
+ },
658
+ messageId: ALPHABETIZE,
659
+ data: isVariableNode
660
+ ? {
661
+ currName: `$${currName}`,
662
+ prevName: `$${prevName}`,
663
+ }
664
+ : { currName, prevName },
665
+ });
666
+ }
667
+ prevName = currName;
668
+ }
669
+ }
670
+ const opts = context.options[0];
671
+ const fields = new Set((_a = opts.fields) !== null && _a !== void 0 ? _a : []);
672
+ const listeners = {};
673
+ const fieldsSelector = [
674
+ fields.has(Kind.OBJECT_TYPE_DEFINITION) && [Kind.OBJECT_TYPE_DEFINITION, Kind.OBJECT_TYPE_EXTENSION],
675
+ fields.has(Kind.INTERFACE_TYPE_DEFINITION) && [Kind.INTERFACE_TYPE_DEFINITION, Kind.INTERFACE_TYPE_EXTENSION],
676
+ fields.has(Kind.INPUT_OBJECT_TYPE_DEFINITION) && [
677
+ Kind.INPUT_OBJECT_TYPE_DEFINITION,
678
+ Kind.INPUT_OBJECT_TYPE_EXTENSION,
679
+ ],
680
+ ]
681
+ .flat()
682
+ .join(',');
683
+ const hasEnumValues = ((_b = opts.values) === null || _b === void 0 ? void 0 : _b[0]) === Kind.ENUM_TYPE_DEFINITION;
684
+ const selectionsSelector = (_c = opts.selections) === null || _c === void 0 ? void 0 : _c.join(',');
685
+ const hasVariables = ((_d = opts.variables) === null || _d === void 0 ? void 0 : _d[0]) === Kind.OPERATION_DEFINITION;
686
+ const argumentsSelector = (_e = opts.arguments) === null || _e === void 0 ? void 0 : _e.join(',');
687
+ if (fieldsSelector) {
688
+ listeners[fieldsSelector] = (node) => {
689
+ checkNodes(node.fields);
690
+ };
691
+ }
692
+ if (hasEnumValues) {
693
+ const enumValuesSelector = [Kind.ENUM_TYPE_DEFINITION, Kind.ENUM_TYPE_EXTENSION].join(',');
694
+ listeners[enumValuesSelector] = (node) => {
695
+ checkNodes(node.values);
696
+ };
697
+ }
698
+ if (selectionsSelector) {
699
+ listeners[`:matches(${selectionsSelector}) SelectionSet`] = (node) => {
700
+ checkNodes(node.selections
701
+ // inline fragment don't have name, so we skip them
702
+ .filter(selection => selection.kind !== Kind.INLINE_FRAGMENT)
703
+ .map(selection =>
704
+ // sort by alias is field is renamed
705
+ 'alias' in selection && selection.alias ? { name: selection.alias } : selection));
706
+ };
707
+ }
708
+ if (hasVariables) {
709
+ listeners.OperationDefinition = (node) => {
710
+ checkNodes(node.variableDefinitions.map(varDef => varDef.variable));
711
+ };
712
+ }
713
+ if (argumentsSelector) {
714
+ listeners[argumentsSelector] = (node) => {
715
+ checkNodes(node.arguments);
716
+ };
717
+ }
718
+ return listeners;
719
+ },
720
+ };
721
+
478
722
  const AVOID_DUPLICATE_FIELDS = 'AVOID_DUPLICATE_FIELDS';
479
723
  const ensureUnique = () => {
480
724
  const set = new Set();
@@ -489,7 +733,7 @@ const ensureUnique = () => {
489
733
  },
490
734
  };
491
735
  };
492
- const rule = {
736
+ const rule$1 = {
493
737
  meta: {
494
738
  type: 'suggestion',
495
739
  docs: {
@@ -540,6 +784,7 @@ const rule = {
540
784
  messages: {
541
785
  [AVOID_DUPLICATE_FIELDS]: `{{ type }} "{{ fieldName }}" defined multiple times.`,
542
786
  },
787
+ schema: [],
543
788
  },
544
789
  create(context) {
545
790
  return {
@@ -597,7 +842,7 @@ const rule = {
597
842
  };
598
843
 
599
844
  const AVOID_OPERATION_NAME_PREFIX = 'AVOID_OPERATION_NAME_PREFIX';
600
- const rule$1 = {
845
+ const rule$2 = {
601
846
  meta: {
602
847
  type: 'suggestion',
603
848
  docs: {
@@ -683,7 +928,7 @@ const rule$1 = {
683
928
  },
684
929
  };
685
930
 
686
- const rule$2 = {
931
+ const rule$3 = {
687
932
  meta: {
688
933
  type: 'suggestion',
689
934
  docs: {
@@ -710,6 +955,7 @@ const rule$2 = {
710
955
  },
711
956
  ],
712
957
  },
958
+ schema: [],
713
959
  },
714
960
  create(context) {
715
961
  const schema = requireGraphQLSchemaFromContext('avoid-scalar-result-type-on-mutation', context);
@@ -735,7 +981,7 @@ const rule$2 = {
735
981
  };
736
982
 
737
983
  const AVOID_TYPENAME_PREFIX = 'AVOID_TYPENAME_PREFIX';
738
- const rule$3 = {
984
+ const rule$4 = {
739
985
  meta: {
740
986
  type: 'suggestion',
741
987
  docs: {
@@ -765,6 +1011,7 @@ const rule$3 = {
765
1011
  messages: {
766
1012
  [AVOID_TYPENAME_PREFIX]: `Field "{{ fieldName }}" starts with the name of the parent type "{{ typeName }}"`,
767
1013
  },
1014
+ schema: [],
768
1015
  },
769
1016
  create(context) {
770
1017
  return {
@@ -789,7 +1036,7 @@ const rule$3 = {
789
1036
  },
790
1037
  };
791
1038
 
792
- const rule$4 = {
1039
+ const rule$5 = {
793
1040
  meta: {
794
1041
  type: 'suggestion',
795
1042
  docs: {
@@ -800,9 +1047,9 @@ const rule$4 = {
800
1047
  code: /* GraphQL */ `
801
1048
  """ Description """
802
1049
  type someTypeName {
803
- ...
1050
+ # ...
804
1051
  }
805
- `,
1052
+ `,
806
1053
  },
807
1054
  {
808
1055
  title: 'Correct',
@@ -810,9 +1057,9 @@ const rule$4 = {
810
1057
  code: /* GraphQL */ `
811
1058
  " Description "
812
1059
  type someTypeName {
813
- ...
1060
+ # ...
814
1061
  }
815
- `,
1062
+ `,
816
1063
  },
817
1064
  ],
818
1065
  description: 'Require all comments to follow the same style (either block or inline).',
@@ -849,7 +1096,7 @@ const rule$4 = {
849
1096
  },
850
1097
  };
851
1098
 
852
- const rule$5 = {
1099
+ const rule$6 = {
853
1100
  meta: {
854
1101
  type: 'suggestion',
855
1102
  docs: {
@@ -974,7 +1221,7 @@ const CASE_STYLES = [
974
1221
  const schemaOption = {
975
1222
  oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
976
1223
  };
977
- const rule$6 = {
1224
+ const rule$7 = {
978
1225
  meta: {
979
1226
  type: 'suggestion',
980
1227
  docs: {
@@ -1219,7 +1466,7 @@ function checkNameFormat(params) {
1219
1466
  const schemaOption$1 = {
1220
1467
  oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }],
1221
1468
  };
1222
- const rule$7 = {
1469
+ const rule$8 = {
1223
1470
  meta: {
1224
1471
  type: 'suggestion',
1225
1472
  docs: {
@@ -1331,18 +1578,18 @@ const rule$7 = {
1331
1578
  style,
1332
1579
  leadingUnderscore: options.leadingUnderscore,
1333
1580
  trailingUnderscore: options.trailingUnderscore,
1334
- prefix: prefix,
1335
- suffix: suffix,
1336
- forbiddenPrefixes: forbiddenPrefixes,
1337
- forbiddenSuffixes: forbiddenSuffixes,
1581
+ prefix,
1582
+ suffix,
1583
+ forbiddenPrefixes,
1584
+ forbiddenSuffixes,
1338
1585
  });
1339
1586
  if (result.ok === false) {
1340
1587
  context.report({
1341
1588
  node,
1342
1589
  message: result.errorMessage,
1343
1590
  data: {
1344
- prefix: prefix,
1345
- suffix: suffix,
1591
+ prefix,
1592
+ suffix,
1346
1593
  format: style,
1347
1594
  forbiddenPrefixes: forbiddenPrefixes.join(', '),
1348
1595
  forbiddenSuffixes: forbiddenSuffixes.join(', '),
@@ -1448,7 +1695,7 @@ const rule$7 = {
1448
1695
  };
1449
1696
 
1450
1697
  const NO_ANONYMOUS_OPERATIONS = 'NO_ANONYMOUS_OPERATIONS';
1451
- const rule$8 = {
1698
+ const rule$9 = {
1452
1699
  meta: {
1453
1700
  type: 'suggestion',
1454
1701
  docs: {
@@ -1478,6 +1725,7 @@ const rule$8 = {
1478
1725
  messages: {
1479
1726
  [NO_ANONYMOUS_OPERATIONS]: `Anonymous GraphQL operations are forbidden. Please make sure to name your {{ operation }}!`,
1480
1727
  },
1728
+ schema: [],
1481
1729
  },
1482
1730
  create(context) {
1483
1731
  return {
@@ -1506,7 +1754,7 @@ const rule$8 = {
1506
1754
  };
1507
1755
 
1508
1756
  const ERROR_MESSAGE_ID = 'NO_CASE_INSENSITIVE_ENUM_VALUES_DUPLICATES';
1509
- const rule$9 = {
1757
+ const rule$a = {
1510
1758
  meta: {
1511
1759
  type: 'suggestion',
1512
1760
  docs: {
@@ -1541,6 +1789,7 @@ const rule$9 = {
1541
1789
  messages: {
1542
1790
  [ERROR_MESSAGE_ID]: `Case-insensitive enum values duplicates are not allowed! Found: "{{ found }}"`,
1543
1791
  },
1792
+ schema: [],
1544
1793
  },
1545
1794
  create(context) {
1546
1795
  return {
@@ -1561,7 +1810,7 @@ const rule$9 = {
1561
1810
  };
1562
1811
 
1563
1812
  const NO_DEPRECATED = 'NO_DEPRECATED';
1564
- const rule$a = {
1813
+ const rule$b = {
1565
1814
  meta: {
1566
1815
  type: 'suggestion',
1567
1816
  docs: {
@@ -1635,6 +1884,7 @@ const rule$a = {
1635
1884
  messages: {
1636
1885
  [NO_DEPRECATED]: `This {{ type }} is marked as deprecated in your GraphQL schema {{ reason }}`,
1637
1886
  },
1887
+ schema: [],
1638
1888
  },
1639
1889
  create(context) {
1640
1890
  return {
@@ -1642,7 +1892,7 @@ const rule$a = {
1642
1892
  requireGraphQLSchemaFromContext('no-deprecated', context);
1643
1893
  const typeInfo = node.typeInfo();
1644
1894
  if (typeInfo && typeInfo.enumValue) {
1645
- if (typeInfo.enumValue.isDeprecated) {
1895
+ if (typeInfo.enumValue.deprecationReason) {
1646
1896
  context.report({
1647
1897
  loc: node.loc,
1648
1898
  messageId: NO_DEPRECATED,
@@ -1658,7 +1908,7 @@ const rule$a = {
1658
1908
  requireGraphQLSchemaFromContext('no-deprecated', context);
1659
1909
  const typeInfo = node.typeInfo();
1660
1910
  if (typeInfo && typeInfo.fieldDef) {
1661
- if (typeInfo.fieldDef.isDeprecated) {
1911
+ if (typeInfo.fieldDef.deprecationReason) {
1662
1912
  context.report({
1663
1913
  loc: node.loc,
1664
1914
  messageId: NO_DEPRECATED,
@@ -1675,7 +1925,7 @@ const rule$a = {
1675
1925
  };
1676
1926
 
1677
1927
  const HASHTAG_COMMENT = 'HASHTAG_COMMENT';
1678
- const rule$b = {
1928
+ const rule$c = {
1679
1929
  meta: {
1680
1930
  messages: {
1681
1931
  [HASHTAG_COMMENT]: 'Using hashtag (#) for adding GraphQL descriptions is not allowed. Prefer using """ for multiline, or " for a single line description.',
@@ -1721,6 +1971,7 @@ const rule$b = {
1721
1971
  ],
1722
1972
  },
1723
1973
  type: 'suggestion',
1974
+ schema: [],
1724
1975
  },
1725
1976
  create(context) {
1726
1977
  return {
@@ -1750,7 +2001,7 @@ const rule$b = {
1750
2001
  };
1751
2002
 
1752
2003
  const NO_OPERATION_NAME_SUFFIX = 'NO_OPERATION_NAME_SUFFIX';
1753
- const rule$c = {
2004
+ const rule$d = {
1754
2005
  meta: {
1755
2006
  fixable: 'code',
1756
2007
  type: 'suggestion',
@@ -1781,6 +2032,7 @@ const rule$c = {
1781
2032
  messages: {
1782
2033
  [NO_OPERATION_NAME_SUFFIX]: `Unnecessary "{{ invalidSuffix }}" suffix in your operation name!`,
1783
2034
  },
2035
+ schema: [],
1784
2036
  },
1785
2037
  create(context) {
1786
2038
  return {
@@ -1805,7 +2057,7 @@ const rule$c = {
1805
2057
 
1806
2058
  const UNREACHABLE_TYPE = 'UNREACHABLE_TYPE';
1807
2059
  const RULE_NAME = 'no-unreachable-types';
1808
- const rule$d = {
2060
+ const rule$e = {
1809
2061
  meta: {
1810
2062
  messages: {
1811
2063
  [UNREACHABLE_TYPE]: `Type "{{ typeName }}" is unreachable`,
@@ -1846,6 +2098,7 @@ const rule$d = {
1846
2098
  },
1847
2099
  fixable: 'code',
1848
2100
  type: 'suggestion',
2101
+ schema: [],
1849
2102
  },
1850
2103
  create(context) {
1851
2104
  const reachableTypes = requireReachableTypesFromContext(RULE_NAME, context);
@@ -1880,7 +2133,7 @@ const rule$d = {
1880
2133
 
1881
2134
  const UNUSED_FIELD = 'UNUSED_FIELD';
1882
2135
  const RULE_NAME$1 = 'no-unused-fields';
1883
- const rule$e = {
2136
+ const rule$f = {
1884
2137
  meta: {
1885
2138
  messages: {
1886
2139
  [UNUSED_FIELD]: `Field "{{fieldName}}" is unused`,
@@ -1937,6 +2190,7 @@ const rule$e = {
1937
2190
  },
1938
2191
  fixable: 'code',
1939
2192
  type: 'suggestion',
2193
+ schema: [],
1940
2194
  },
1941
2195
  create(context) {
1942
2196
  const usedFields = requireUsedFieldsFromContext(RULE_NAME$1, context);
@@ -2067,7 +2321,7 @@ const MESSAGE_REQUIRE_DATE = 'MESSAGE_REQUIRE_DATE';
2067
2321
  const MESSAGE_INVALID_FORMAT = 'MESSAGE_INVALID_FORMAT';
2068
2322
  const MESSAGE_INVALID_DATE = 'MESSAGE_INVALID_DATE';
2069
2323
  const MESSAGE_CAN_BE_REMOVED = 'MESSAGE_CAN_BE_REMOVED';
2070
- const rule$f = {
2324
+ const rule$g = {
2071
2325
  meta: {
2072
2326
  type: 'suggestion',
2073
2327
  docs: {
@@ -2167,7 +2421,7 @@ const rule$f = {
2167
2421
  },
2168
2422
  };
2169
2423
 
2170
- const rule$g = {
2424
+ const rule$h = {
2171
2425
  meta: {
2172
2426
  docs: {
2173
2427
  description: `Require all deprecation directives to specify a reason.`,
@@ -2202,6 +2456,7 @@ const rule$g = {
2202
2456
  ],
2203
2457
  },
2204
2458
  type: 'suggestion',
2459
+ schema: [],
2205
2460
  },
2206
2461
  create(context) {
2207
2462
  return {
@@ -2257,7 +2512,7 @@ function verifyRule(context, node) {
2257
2512
  }
2258
2513
  }
2259
2514
  }
2260
- const rule$h = {
2515
+ const rule$i = {
2261
2516
  meta: {
2262
2517
  docs: {
2263
2518
  category: 'Best Practices',
@@ -2266,7 +2521,7 @@ const rule$h = {
2266
2521
  examples: [
2267
2522
  {
2268
2523
  title: 'Incorrect',
2269
- usage: [{ on: ['ObjectTypeDefinition', 'FieldDefinition'] }],
2524
+ usage: [{ on: [Kind.OBJECT_TYPE_DEFINITION, Kind.FIELD_DEFINITION] }],
2270
2525
  code: /* GraphQL */ `
2271
2526
  type someTypeName {
2272
2527
  name: String
@@ -2275,7 +2530,7 @@ const rule$h = {
2275
2530
  },
2276
2531
  {
2277
2532
  title: 'Correct',
2278
- usage: [{ on: ['ObjectTypeDefinition', 'FieldDefinition'] }],
2533
+ usage: [{ on: [Kind.OBJECT_TYPE_DEFINITION, Kind.FIELD_DEFINITION] }],
2279
2534
  code: /* GraphQL */ `
2280
2535
  """
2281
2536
  Some type description
@@ -2322,7 +2577,7 @@ const rule$h = {
2322
2577
  };
2323
2578
 
2324
2579
  const RULE_NAME$2 = 'require-field-of-type-query-in-mutation-result';
2325
- const rule$i = {
2580
+ const rule$j = {
2326
2581
  meta: {
2327
2582
  type: 'suggestion',
2328
2583
  docs: {
@@ -2360,6 +2615,7 @@ const rule$i = {
2360
2615
  },
2361
2616
  ],
2362
2617
  },
2618
+ schema: [],
2363
2619
  },
2364
2620
  create(context) {
2365
2621
  const schema = requireGraphQLSchemaFromContext(RULE_NAME$2, context);
@@ -2485,7 +2741,7 @@ const convertNode = (typeInfo) => (node, key, parent) => {
2485
2741
 
2486
2742
  const REQUIRE_ID_WHEN_AVAILABLE = 'REQUIRE_ID_WHEN_AVAILABLE';
2487
2743
  const DEFAULT_ID_FIELD_NAME = 'id';
2488
- const rule$j = {
2744
+ const rule$k = {
2489
2745
  meta: {
2490
2746
  type: 'suggestion',
2491
2747
  docs: {
@@ -2621,7 +2877,7 @@ const rule$j = {
2621
2877
  },
2622
2878
  };
2623
2879
 
2624
- const rule$k = {
2880
+ const rule$l = {
2625
2881
  meta: {
2626
2882
  docs: {
2627
2883
  category: 'Best Practices',
@@ -2743,7 +2999,7 @@ const shouldIgnoreNode = ({ node, exceptions }) => {
2743
2999
  }
2744
3000
  return false;
2745
3001
  };
2746
- const rule$l = {
3002
+ const rule$m = {
2747
3003
  meta: {
2748
3004
  type: 'suggestion',
2749
3005
  docs: {
@@ -2933,7 +3189,7 @@ const checkNode = (context, node, ruleName, messageId) => {
2933
3189
  });
2934
3190
  }
2935
3191
  };
2936
- const rule$m = {
3192
+ const rule$n = {
2937
3193
  meta: {
2938
3194
  type: 'suggestion',
2939
3195
  docs: {
@@ -2979,6 +3235,7 @@ const rule$m = {
2979
3235
  messages: {
2980
3236
  [UNIQUE_FRAGMENT_NAME]: 'Fragment named "{{ documentName }}" already defined in:\n{{ summary }}',
2981
3237
  },
3238
+ schema: [],
2982
3239
  },
2983
3240
  create(context) {
2984
3241
  return {
@@ -2991,7 +3248,7 @@ const rule$m = {
2991
3248
 
2992
3249
  const RULE_NAME$4 = 'unique-operation-name';
2993
3250
  const UNIQUE_OPERATION_NAME = 'UNIQUE_OPERATION_NAME';
2994
- const rule$n = {
3251
+ const rule$o = {
2995
3252
  meta: {
2996
3253
  type: 'suggestion',
2997
3254
  docs: {
@@ -3041,6 +3298,7 @@ const rule$n = {
3041
3298
  messages: {
3042
3299
  [UNIQUE_OPERATION_NAME]: 'Operation named "{{ documentName }}" already defined in:\n{{ summary }}',
3043
3300
  },
3301
+ schema: [],
3044
3302
  },
3045
3303
  create(context) {
3046
3304
  return {
@@ -3056,30 +3314,31 @@ const rule$n = {
3056
3314
  */
3057
3315
  const rules = {
3058
3316
  ...GRAPHQL_JS_VALIDATIONS,
3059
- 'avoid-duplicate-fields': rule,
3060
- 'avoid-operation-name-prefix': rule$1,
3061
- 'avoid-scalar-result-type-on-mutation': rule$2,
3062
- 'avoid-typename-prefix': rule$3,
3063
- 'description-style': rule$4,
3064
- 'input-name': rule$5,
3065
- 'match-document-filename': rule$6,
3066
- 'naming-convention': rule$7,
3067
- 'no-anonymous-operations': rule$8,
3068
- 'no-case-insensitive-enum-values-duplicates': rule$9,
3069
- 'no-deprecated': rule$a,
3070
- 'no-hashtag-description': rule$b,
3071
- 'no-operation-name-suffix': rule$c,
3072
- 'no-unreachable-types': rule$d,
3073
- 'no-unused-fields': rule$e,
3074
- 'require-deprecation-date': rule$f,
3075
- 'require-deprecation-reason': rule$g,
3076
- 'require-description': rule$h,
3077
- 'require-field-of-type-query-in-mutation-result': rule$i,
3078
- 'require-id-when-available': rule$j,
3079
- 'selection-set-depth': rule$k,
3080
- 'strict-id-in-types': rule$l,
3081
- 'unique-fragment-name': rule$m,
3082
- 'unique-operation-name': rule$n,
3317
+ alphabetize: rule,
3318
+ 'avoid-duplicate-fields': rule$1,
3319
+ 'avoid-operation-name-prefix': rule$2,
3320
+ 'avoid-scalar-result-type-on-mutation': rule$3,
3321
+ 'avoid-typename-prefix': rule$4,
3322
+ 'description-style': rule$5,
3323
+ 'input-name': rule$6,
3324
+ 'match-document-filename': rule$7,
3325
+ 'naming-convention': rule$8,
3326
+ 'no-anonymous-operations': rule$9,
3327
+ 'no-case-insensitive-enum-values-duplicates': rule$a,
3328
+ 'no-deprecated': rule$b,
3329
+ 'no-hashtag-description': rule$c,
3330
+ 'no-operation-name-suffix': rule$d,
3331
+ 'no-unreachable-types': rule$e,
3332
+ 'no-unused-fields': rule$f,
3333
+ 'require-deprecation-date': rule$g,
3334
+ 'require-deprecation-reason': rule$h,
3335
+ 'require-description': rule$i,
3336
+ 'require-field-of-type-query-in-mutation-result': rule$j,
3337
+ 'require-id-when-available': rule$k,
3338
+ 'selection-set-depth': rule$l,
3339
+ 'strict-id-in-types': rule$m,
3340
+ 'unique-fragment-name': rule$n,
3341
+ 'unique-operation-name': rule$o,
3083
3342
  };
3084
3343
 
3085
3344
  const RELEVANT_KEYWORDS = ['gql', 'graphql', '/* GraphQL */'];