@graphql-eslint/eslint-plugin 4.0.0-alpha.11 → 4.0.0-alpha.13

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/cjs/index.d.cts CHANGED
@@ -48,10 +48,10 @@ declare const _default: {
48
48
  };
49
49
  rules: {
50
50
  alphabetize: GraphQLESLintRule<{
51
- values?: boolean | undefined;
52
51
  definitions?: boolean | undefined;
53
52
  selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
54
53
  arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
54
+ values?: boolean | undefined;
55
55
  fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
56
56
  variables?: boolean | undefined;
57
57
  groups?: string[] | undefined;
package/cjs/meta.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-UIAXBAMD.js');
2
- const version = "4.0.0-alpha.11";
2
+ const version = "4.0.0-alpha.13";
3
3
 
4
4
 
5
5
  exports.version = version;
@@ -12,10 +12,10 @@ import 'json-schema-to-ts';
12
12
 
13
13
  declare const rules: {
14
14
  alphabetize: GraphQLESLintRule<{
15
- values?: boolean | undefined;
16
15
  definitions?: boolean | undefined;
17
16
  selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
18
17
  arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
18
+ values?: boolean | undefined;
19
19
  fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
20
20
  variables?: boolean | undefined;
21
21
  groups?: string[] | undefined;
@@ -384,12 +384,14 @@ ${_utilsjs.TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
384
384
  };
385
385
  }
386
386
  }, checkUnderscore = (isLeading) => (node) => {
387
+ if (node.parent.kind === "Field" && node.parent.alias !== node)
388
+ return;
387
389
  const suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
388
390
  report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
389
391
  suggestedName
390
392
  ]);
391
393
  }, listeners = {};
392
- 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));
394
+ allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
393
395
  const selectors = new Set(
394
396
  [types && _utilsjs.TYPES_KINDS, Object.keys(restOptions)].flat().filter(_utilsjs.truthy)
395
397
  );
@@ -1,5 +1,4 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../../chunk-UIAXBAMD.js');
2
- var _graphql = require('graphql');
3
2
  var _utilsjs = require('../../utils.js');
4
3
  const RULE_ID = "no-deprecated", rule = exports.rule = {
5
4
  meta: {
@@ -84,24 +83,24 @@ const RULE_ID = "no-deprecated", rule = exports.rule = {
84
83
  recommended: !0
85
84
  },
86
85
  messages: {
87
- [RULE_ID]: "This {{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
86
+ [RULE_ID]: "{{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
88
87
  },
89
88
  schema: []
90
89
  },
91
90
  create(context) {
92
91
  _utilsjs.requireGraphQLSchemaFromContext.call(void 0, RULE_ID, context);
93
92
  function report(node, reason) {
94
- const nodeName = node.kind === _graphql.Kind.ENUM ? node.value : node.name.value, nodeType = node.kind === _graphql.Kind.ENUM ? "enum value" : "field";
93
+ const nodeType = _utilsjs.displayNodeName.call(void 0, node);
95
94
  context.report({
96
95
  node,
97
96
  messageId: RULE_ID,
98
97
  data: {
99
- type: nodeType,
98
+ type: nodeType[0].toUpperCase() + nodeType.slice(1),
100
99
  reason
101
100
  },
102
101
  suggest: [
103
102
  {
104
- desc: `Remove \`${nodeName}\` ${nodeType}`,
103
+ desc: `Remove ${nodeType}`,
105
104
  fix: (fixer) => fixer.remove(node)
106
105
  }
107
106
  ]
@@ -115,6 +114,17 @@ const RULE_ID = "no-deprecated", rule = exports.rule = {
115
114
  Field(node) {
116
115
  const reason = _optionalChain([node, 'access', _5 => _5.typeInfo, 'call', _6 => _6(), 'access', _7 => _7.fieldDef, 'optionalAccess', _8 => _8.deprecationReason]);
117
116
  reason && report(node, reason);
117
+ },
118
+ Argument(node) {
119
+ const reason = _optionalChain([node, 'access', _9 => _9.typeInfo, 'call', _10 => _10(), 'access', _11 => _11.argument, 'optionalAccess', _12 => _12.deprecationReason]);
120
+ reason && report(node, reason);
121
+ },
122
+ ObjectValue(node) {
123
+ const fields = node.typeInfo().inputType.getFields();
124
+ for (const field of node.fields) {
125
+ const fieldName = field.name.value, reason = fields[fieldName].deprecationReason;
126
+ reason && report(field, reason);
127
+ }
118
128
  }
119
129
  };
120
130
  }
@@ -104,7 +104,7 @@ Include it in your selection set{{ addition }}.`
104
104
  schema
105
105
  },
106
106
  create(context) {
107
- const schema2 = _utilsjs.requireGraphQLSchemaFromContext.call(void 0, RULE_ID, context), siblings = _utilsjs.requireSiblingsOperations.call(void 0, RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = _utils.asArray.call(void 0, fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new (0, _graphql.TypeInfo)(schema2);
107
+ const schema2 = _utilsjs.requireGraphQLSchemaFromContext.call(void 0, RULE_ID, context), siblings = _utilsjs.requireSiblingsOperations.call(void 0, RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = _utils.asArray.call(void 0, fieldName), selector = "SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new (0, _graphql.TypeInfo)(schema2);
108
108
  function checkFragments(node) {
109
109
  for (const selection of node.selections) {
110
110
  if (selection.kind !== _graphql.Kind.FRAGMENT_SPREAD)
package/cjs/utils.d.cts CHANGED
@@ -39,7 +39,7 @@ declare const ARRAY_DEFAULT_OPTIONS: {
39
39
  declare const englishJoinWords: (words: string[]) => string;
40
40
  type Truthy<T> = T extends '' | 0 | false | null | undefined ? never : T;
41
41
  declare function truthy<T>(value: T): value is Truthy<T>;
42
- declare function displayNodeName(node: GraphQLESTreeNode<ASTNode>): string;
42
+ declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
43
43
  declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
44
44
 
45
45
  export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLSchemaFromContext, requireSiblingsOperations, slash, truthy };
package/cjs/utils.js CHANGED
@@ -123,7 +123,7 @@ const DisplayNodeNameMap = {
123
123
  [_graphql.Kind.VARIABLE]: "variable"
124
124
  };
125
125
  function displayNodeName(node) {
126
- return `${node.kind === _graphql.Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && _optionalChain([node, 'access', _ => _.alias, 'optionalAccess', _2 => _2.value]) || "name" in node && _optionalChain([node, 'access', _3 => _3.name, 'optionalAccess', _4 => _4.value])}"`;
126
+ return `${node.kind === _graphql.Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && _optionalChain([node, 'access', _ => _.alias, 'optionalAccess', _2 => _2.value]) || "name" in node && _optionalChain([node, 'access', _3 => _3.name, 'optionalAccess', _4 => _4.value]) || node.value}"`;
127
127
  }
128
128
  function getNodeName(node) {
129
129
  switch (node.kind) {
package/esm/meta.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./chunk-UIAXBAMD.js";
2
- const version = "4.0.0-alpha.11";
2
+ const version = "4.0.0-alpha.13";
3
3
  export {
4
4
  version
5
5
  };
@@ -384,12 +384,14 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
384
384
  };
385
385
  }
386
386
  }, checkUnderscore = (isLeading) => (node) => {
387
+ if (node.parent.kind === "Field" && node.parent.alias !== node)
388
+ return;
387
389
  const suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
388
390
  report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
389
391
  suggestedName
390
392
  ]);
391
393
  }, listeners = {};
392
- 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));
394
+ allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
393
395
  const selectors = new Set(
394
396
  [types && TYPES_KINDS, Object.keys(restOptions)].flat().filter(truthy)
395
397
  );
@@ -1,6 +1,5 @@
1
1
  import "../../chunk-UIAXBAMD.js";
2
- import { Kind } from "graphql";
3
- import { requireGraphQLSchemaFromContext } from "../../utils.js";
2
+ import { displayNodeName, requireGraphQLSchemaFromContext } from "../../utils.js";
4
3
  const RULE_ID = "no-deprecated", rule = {
5
4
  meta: {
6
5
  type: "suggestion",
@@ -84,24 +83,24 @@ const RULE_ID = "no-deprecated", rule = {
84
83
  recommended: !0
85
84
  },
86
85
  messages: {
87
- [RULE_ID]: "This {{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
86
+ [RULE_ID]: "{{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
88
87
  },
89
88
  schema: []
90
89
  },
91
90
  create(context) {
92
91
  requireGraphQLSchemaFromContext(RULE_ID, context);
93
92
  function report(node, reason) {
94
- const nodeName = node.kind === Kind.ENUM ? node.value : node.name.value, nodeType = node.kind === Kind.ENUM ? "enum value" : "field";
93
+ const nodeType = displayNodeName(node);
95
94
  context.report({
96
95
  node,
97
96
  messageId: RULE_ID,
98
97
  data: {
99
- type: nodeType,
98
+ type: nodeType[0].toUpperCase() + nodeType.slice(1),
100
99
  reason
101
100
  },
102
101
  suggest: [
103
102
  {
104
- desc: `Remove \`${nodeName}\` ${nodeType}`,
103
+ desc: `Remove ${nodeType}`,
105
104
  fix: (fixer) => fixer.remove(node)
106
105
  }
107
106
  ]
@@ -115,6 +114,17 @@ const RULE_ID = "no-deprecated", rule = {
115
114
  Field(node) {
116
115
  const reason = node.typeInfo().fieldDef?.deprecationReason;
117
116
  reason && report(node, reason);
117
+ },
118
+ Argument(node) {
119
+ const reason = node.typeInfo().argument?.deprecationReason;
120
+ reason && report(node, reason);
121
+ },
122
+ ObjectValue(node) {
123
+ const fields = node.typeInfo().inputType.getFields();
124
+ for (const field of node.fields) {
125
+ const fieldName = field.name.value, reason = fields[fieldName].deprecationReason;
126
+ reason && report(field, reason);
127
+ }
118
128
  }
119
129
  };
120
130
  }
@@ -104,7 +104,7 @@ Include it in your selection set{{ addition }}.`
104
104
  schema
105
105
  },
106
106
  create(context) {
107
- const schema2 = requireGraphQLSchemaFromContext(RULE_ID, context), siblings = requireSiblingsOperations(RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo(schema2);
107
+ const schema2 = requireGraphQLSchemaFromContext(RULE_ID, context), siblings = requireSiblingsOperations(RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo(schema2);
108
108
  function checkFragments(node) {
109
109
  for (const selection of node.selections) {
110
110
  if (selection.kind !== Kind.FRAGMENT_SPREAD)
package/esm/utils.d.ts CHANGED
@@ -39,7 +39,7 @@ declare const ARRAY_DEFAULT_OPTIONS: {
39
39
  declare const englishJoinWords: (words: string[]) => string;
40
40
  type Truthy<T> = T extends '' | 0 | false | null | undefined ? never : T;
41
41
  declare function truthy<T>(value: T): value is Truthy<T>;
42
- declare function displayNodeName(node: GraphQLESTreeNode<ASTNode>): string;
42
+ declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
43
43
  declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
44
44
 
45
45
  export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLSchemaFromContext, requireSiblingsOperations, slash, truthy };
package/esm/utils.js CHANGED
@@ -123,7 +123,7 @@ const DisplayNodeNameMap = {
123
123
  [Kind.VARIABLE]: "variable"
124
124
  };
125
125
  function displayNodeName(node) {
126
- return `${node.kind === Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
126
+ return `${node.kind === Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value || node.value}"`;
127
127
  }
128
128
  function getNodeName(node) {
129
129
  switch (node.kind) {
package/index.browser.js CHANGED
@@ -521,7 +521,7 @@ var DisplayNodeNameMap = {
521
521
  [Kind2.VARIABLE]: "variable"
522
522
  };
523
523
  function displayNodeName(node) {
524
- return `${node.kind === Kind2.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
524
+ return `${node.kind === Kind2.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value || node.value}"`;
525
525
  }
526
526
  function getNodeName(node) {
527
527
  switch (node.kind) {
@@ -2509,12 +2509,14 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
2509
2509
  };
2510
2510
  }
2511
2511
  }, checkUnderscore = (isLeading) => (node) => {
2512
+ if (node.parent.kind === "Field" && node.parent.alias !== node)
2513
+ return;
2512
2514
  let suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
2513
2515
  report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
2514
2516
  suggestedName
2515
2517
  ]);
2516
2518
  }, listeners = {};
2517
- 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));
2519
+ allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
2518
2520
  let selectors = new Set(
2519
2521
  [types && TYPES_KINDS, Object.keys(restOptions)].flat().filter(truthy)
2520
2522
  );
@@ -2594,7 +2596,6 @@ var RULE_ID3 = "no-anonymous-operations", rule7 = {
2594
2596
  };
2595
2597
 
2596
2598
  // src/rules/no-deprecated/index.ts
2597
- import { Kind as Kind10 } from "graphql";
2598
2599
  var RULE_ID4 = "no-deprecated", rule8 = {
2599
2600
  meta: {
2600
2601
  type: "suggestion",
@@ -2678,24 +2679,24 @@ var RULE_ID4 = "no-deprecated", rule8 = {
2678
2679
  recommended: !0
2679
2680
  },
2680
2681
  messages: {
2681
- [RULE_ID4]: "This {{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
2682
+ [RULE_ID4]: "{{ type }} is marked as deprecated in your GraphQL schema (reason: {{ reason }})"
2682
2683
  },
2683
2684
  schema: []
2684
2685
  },
2685
2686
  create(context) {
2686
2687
  requireGraphQLSchemaFromContext(RULE_ID4, context);
2687
2688
  function report(node, reason) {
2688
- let nodeName = node.kind === Kind10.ENUM ? node.value : node.name.value, nodeType = node.kind === Kind10.ENUM ? "enum value" : "field";
2689
+ let nodeType = displayNodeName(node);
2689
2690
  context.report({
2690
2691
  node,
2691
2692
  messageId: RULE_ID4,
2692
2693
  data: {
2693
- type: nodeType,
2694
+ type: nodeType[0].toUpperCase() + nodeType.slice(1),
2694
2695
  reason
2695
2696
  },
2696
2697
  suggest: [
2697
2698
  {
2698
- desc: `Remove \`${nodeName}\` ${nodeType}`,
2699
+ desc: `Remove ${nodeType}`,
2699
2700
  fix: (fixer) => fixer.remove(node)
2700
2701
  }
2701
2702
  ]
@@ -2709,13 +2710,24 @@ var RULE_ID4 = "no-deprecated", rule8 = {
2709
2710
  Field(node) {
2710
2711
  let reason = node.typeInfo().fieldDef?.deprecationReason;
2711
2712
  reason && report(node, reason);
2713
+ },
2714
+ Argument(node) {
2715
+ let reason = node.typeInfo().argument?.deprecationReason;
2716
+ reason && report(node, reason);
2717
+ },
2718
+ ObjectValue(node) {
2719
+ let fields = node.typeInfo().inputType.getFields();
2720
+ for (let field of node.fields) {
2721
+ let fieldName = field.name.value, reason = fields[fieldName].deprecationReason;
2722
+ reason && report(field, reason);
2723
+ }
2712
2724
  }
2713
2725
  };
2714
2726
  }
2715
2727
  };
2716
2728
 
2717
2729
  // src/rules/no-duplicate-fields/index.ts
2718
- import { Kind as Kind11 } from "graphql";
2730
+ import { Kind as Kind10 } from "graphql";
2719
2731
  var RULE_ID5 = "no-duplicate-fields", rule9 = {
2720
2732
  meta: {
2721
2733
  type: "suggestion",
@@ -2799,7 +2811,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
2799
2811
  desc: `Remove \`${fieldName}\` ${parent.type.toLowerCase()}`,
2800
2812
  fix(fixer) {
2801
2813
  return fixer.remove(
2802
- parent.type === Kind11.VARIABLE ? parent.parent : parent
2814
+ parent.type === Kind10.VARIABLE ? parent.parent : parent
2803
2815
  );
2804
2816
  }
2805
2817
  }
@@ -2822,7 +2834,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
2822
2834
  SelectionSet(node) {
2823
2835
  let set = /* @__PURE__ */ new Set();
2824
2836
  for (let selection of node.selections)
2825
- selection.kind === Kind11.FIELD && checkNode2(set, selection.alias || selection.name);
2837
+ selection.kind === Kind10.FIELD && checkNode2(set, selection.alias || selection.name);
2826
2838
  }
2827
2839
  };
2828
2840
  }
@@ -3092,7 +3104,7 @@ var schema7 = {
3092
3104
  };
3093
3105
 
3094
3106
  // src/rules/no-scalar-result-type-on-mutation/index.ts
3095
- import { isScalarType, Kind as Kind12 } from "graphql";
3107
+ import { isScalarType, Kind as Kind11 } from "graphql";
3096
3108
  var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3097
3109
  meta: {
3098
3110
  type: "suggestion",
@@ -3139,7 +3151,7 @@ var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
3139
3151
  let typeName = node.value, graphQLType = schema16.getType(typeName);
3140
3152
  if (isScalarType(graphQLType)) {
3141
3153
  let fieldDef = node.parent;
3142
- for (; fieldDef.kind !== Kind12.FIELD_DEFINITION; )
3154
+ for (; fieldDef.kind !== Kind11.FIELD_DEFINITION; )
3143
3155
  fieldDef = fieldDef.parent;
3144
3156
  context.report({
3145
3157
  node,
@@ -3230,24 +3242,24 @@ var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
3230
3242
  import {
3231
3243
  DirectiveLocation,
3232
3244
  isInterfaceType,
3233
- Kind as Kind13,
3245
+ Kind as Kind12,
3234
3246
  visit as visit5
3235
3247
  } from "graphql";
3236
3248
  import lowerCase3 from "lodash.lowercase";
3237
3249
  var RULE_ID9 = "no-unreachable-types", KINDS = [
3238
- Kind13.DIRECTIVE_DEFINITION,
3239
- Kind13.OBJECT_TYPE_DEFINITION,
3240
- Kind13.OBJECT_TYPE_EXTENSION,
3241
- Kind13.INTERFACE_TYPE_DEFINITION,
3242
- Kind13.INTERFACE_TYPE_EXTENSION,
3243
- Kind13.SCALAR_TYPE_DEFINITION,
3244
- Kind13.SCALAR_TYPE_EXTENSION,
3245
- Kind13.INPUT_OBJECT_TYPE_DEFINITION,
3246
- Kind13.INPUT_OBJECT_TYPE_EXTENSION,
3247
- Kind13.UNION_TYPE_DEFINITION,
3248
- Kind13.UNION_TYPE_EXTENSION,
3249
- Kind13.ENUM_TYPE_DEFINITION,
3250
- Kind13.ENUM_TYPE_EXTENSION
3250
+ Kind12.DIRECTIVE_DEFINITION,
3251
+ Kind12.OBJECT_TYPE_DEFINITION,
3252
+ Kind12.OBJECT_TYPE_EXTENSION,
3253
+ Kind12.INTERFACE_TYPE_DEFINITION,
3254
+ Kind12.INTERFACE_TYPE_EXTENSION,
3255
+ Kind12.SCALAR_TYPE_DEFINITION,
3256
+ Kind12.SCALAR_TYPE_EXTENSION,
3257
+ Kind12.INPUT_OBJECT_TYPE_DEFINITION,
3258
+ Kind12.INPUT_OBJECT_TYPE_EXTENSION,
3259
+ Kind12.UNION_TYPE_DEFINITION,
3260
+ Kind12.UNION_TYPE_EXTENSION,
3261
+ Kind12.ENUM_TYPE_DEFINITION,
3262
+ Kind12.ENUM_TYPE_EXTENSION
3251
3263
  ], reachableTypesCache = new ModuleCache(), RequestDirectiveLocations = /* @__PURE__ */ new Set([
3252
3264
  DirectiveLocation.QUERY,
3253
3265
  DirectiveLocation.MUTATION,
@@ -3598,7 +3610,7 @@ var rule16 = {
3598
3610
  };
3599
3611
 
3600
3612
  // src/rules/relay-arguments/index.ts
3601
- import { isScalarType as isScalarType2, Kind as Kind14 } from "graphql";
3613
+ import { isScalarType as isScalarType2, Kind as Kind13 } from "graphql";
3602
3614
  var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema9 = {
3603
3615
  type: "array",
3604
3616
  maxItems: 1,
@@ -3672,7 +3684,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3672
3684
  return {
3673
3685
  "FieldDefinition > .gqlType Name[value=/Connection$/]"(node) {
3674
3686
  let fieldNode = node.parent;
3675
- for (; fieldNode.kind !== Kind14.FIELD_DEFINITION; )
3687
+ for (; fieldNode.kind !== Kind13.FIELD_DEFINITION; )
3676
3688
  fieldNode = fieldNode.parent;
3677
3689
  let args = Object.fromEntries(
3678
3690
  fieldNode.arguments?.map((argument) => [argument.name.value, argument]) || []
@@ -3686,7 +3698,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3686
3698
  }
3687
3699
  function checkField(typeName, argumentName) {
3688
3700
  let argument = args[argumentName], hasArgument = !!argument, type = argument;
3689
- if (hasArgument && type.gqlType.kind === Kind14.NON_NULL_TYPE && (type = type.gqlType), !(hasArgument && type.gqlType.kind === Kind14.NAMED_TYPE && (type.gqlType.name.value === typeName || typeName === "String" && isScalarType2(schema16.getType(type.gqlType.name.value))))) {
3701
+ if (hasArgument && type.gqlType.kind === Kind13.NON_NULL_TYPE && (type = type.gqlType), !(hasArgument && type.gqlType.kind === Kind13.NAMED_TYPE && (type.gqlType.name.value === typeName || typeName === "String" && isScalarType2(schema16.getType(type.gqlType.name.value))))) {
3690
3702
  let returnType = typeName === "String" ? "String or Scalar" : typeName;
3691
3703
  context.report({
3692
3704
  node: (argument || fieldNode).name,
@@ -3701,17 +3713,17 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
3701
3713
  };
3702
3714
 
3703
3715
  // src/rules/relay-connection-types/index.ts
3704
- import { Kind as Kind15 } from "graphql";
3716
+ import { Kind as Kind14 } from "graphql";
3705
3717
  var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUST_CONTAIN_FIELD_EDGES", MUST_CONTAIN_FIELD_PAGE_INFO = "MUST_CONTAIN_FIELD_PAGE_INFO", MUST_HAVE_CONNECTION_SUFFIX = "MUST_HAVE_CONNECTION_SUFFIX", EDGES_FIELD_MUST_RETURN_LIST_TYPE = "EDGES_FIELD_MUST_RETURN_LIST_TYPE", PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE = "PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE", NON_OBJECT_TYPES = [
3706
- Kind15.SCALAR_TYPE_DEFINITION,
3707
- Kind15.UNION_TYPE_DEFINITION,
3708
- Kind15.UNION_TYPE_EXTENSION,
3709
- Kind15.INPUT_OBJECT_TYPE_DEFINITION,
3710
- Kind15.INPUT_OBJECT_TYPE_EXTENSION,
3711
- Kind15.ENUM_TYPE_DEFINITION,
3712
- Kind15.ENUM_TYPE_EXTENSION,
3713
- Kind15.INTERFACE_TYPE_DEFINITION,
3714
- Kind15.INTERFACE_TYPE_EXTENSION
3718
+ Kind14.SCALAR_TYPE_DEFINITION,
3719
+ Kind14.UNION_TYPE_DEFINITION,
3720
+ Kind14.UNION_TYPE_EXTENSION,
3721
+ Kind14.INPUT_OBJECT_TYPE_DEFINITION,
3722
+ Kind14.INPUT_OBJECT_TYPE_EXTENSION,
3723
+ Kind14.ENUM_TYPE_DEFINITION,
3724
+ Kind14.ENUM_TYPE_EXTENSION,
3725
+ Kind14.INTERFACE_TYPE_DEFINITION,
3726
+ Kind14.INTERFACE_TYPE_EXTENSION
3715
3727
  ], notConnectionTypesSelector = `:matches(${NON_OBJECT_TYPES})[name.value=/Connection$/] > .name`, hasEdgesField = (node) => node.fields?.some((field) => field.name.value === "edges"), hasPageInfoField = (node) => node.fields?.some((field) => field.name.value === "pageInfo"), rule18 = {
3716
3728
  meta: {
3717
3729
  type: "problem",
@@ -3778,10 +3790,10 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
3778
3790
  hasEdgesField(node) || context.report({ node: node.name, messageId: MUST_CONTAIN_FIELD_EDGES }), hasPageInfoField(node) || context.report({ node: node.name, messageId: MUST_CONTAIN_FIELD_PAGE_INFO });
3779
3791
  },
3780
3792
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/Connection$/] > FieldDefinition[name.value=edges] > .gqlType"(node) {
3781
- node.kind === Kind15.LIST_TYPE || node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.LIST_TYPE || context.report({ node, messageId: EDGES_FIELD_MUST_RETURN_LIST_TYPE });
3793
+ node.kind === Kind14.LIST_TYPE || node.kind === Kind14.NON_NULL_TYPE && node.gqlType.kind === Kind14.LIST_TYPE || context.report({ node, messageId: EDGES_FIELD_MUST_RETURN_LIST_TYPE });
3782
3794
  },
3783
3795
  ":matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=/Connection$/] > FieldDefinition[name.value=pageInfo] > .gqlType"(node) {
3784
- node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.NAMED_TYPE && node.gqlType.name.value === "PageInfo" || context.report({ node, messageId: PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE });
3796
+ node.kind === Kind14.NON_NULL_TYPE && node.gqlType.kind === Kind14.NAMED_TYPE && node.gqlType.name.value === "PageInfo" || context.report({ node, messageId: PAGE_INFO_FIELD_MUST_RETURN_NON_NULL_TYPE });
3785
3797
  }
3786
3798
  };
3787
3799
  }
@@ -3791,7 +3803,7 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
3791
3803
  import {
3792
3804
  isObjectType as isObjectType2,
3793
3805
  isScalarType as isScalarType3,
3794
- Kind as Kind16,
3806
+ Kind as Kind15,
3795
3807
  visit as visit7
3796
3808
  } from "graphql";
3797
3809
  import { getDocumentNodeFromSchema } from "@graphql-tools/utils";
@@ -3886,7 +3898,7 @@ var schema10 = {
3886
3898
  shouldImplementNode: !0,
3887
3899
  listTypeCanWrapOnlyEdgeType: !0,
3888
3900
  ...context.options[0]
3889
- }, isNamedOrNonNullNamed = (node) => node.kind === Kind16.NAMED_TYPE || node.kind === Kind16.NON_NULL_TYPE && node.gqlType.kind === Kind16.NAMED_TYPE, checkNodeField = (node) => {
3901
+ }, isNamedOrNonNullNamed = (node) => node.kind === Kind15.NAMED_TYPE || node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.NAMED_TYPE, checkNodeField = (node) => {
3890
3902
  let nodeField = node.fields?.find((field) => field.name.value === "node"), message = "return either a Scalar, Enum, Object, Interface, Union, or a non-null wrapper around one of those types.";
3891
3903
  if (!nodeField)
3892
3904
  context.report({
@@ -3923,7 +3935,7 @@ var schema10 = {
3923
3935
  }
3924
3936
  };
3925
3937
  return options.listTypeCanWrapOnlyEdgeType && (listeners["FieldDefinition > .gqlType"] = (node) => {
3926
- if (node.kind === Kind16.LIST_TYPE || node.kind === Kind16.NON_NULL_TYPE && node.gqlType.kind === Kind16.LIST_TYPE) {
3938
+ if (node.kind === Kind15.LIST_TYPE || node.kind === Kind15.NON_NULL_TYPE && node.gqlType.kind === Kind15.LIST_TYPE) {
3927
3939
  let typeName = getTypeName(node.rawNode());
3928
3940
  edgeTypes.has(typeName) || context.report({ node, messageId: MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE });
3929
3941
  }
@@ -3932,7 +3944,7 @@ var schema10 = {
3932
3944
  };
3933
3945
 
3934
3946
  // src/rules/relay-page-info/index.ts
3935
- import { isScalarType as isScalarType4, Kind as Kind17 } from "graphql";
3947
+ import { isScalarType as isScalarType4, Kind as Kind16 } from "graphql";
3936
3948
  var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", MESSAGE_MUST_BE_OBJECT_TYPE2 = "MESSAGE_MUST_BE_OBJECT_TYPE", notPageInfoTypesSelector = `:matches(${NON_OBJECT_TYPES})[name.value=PageInfo] > .name`, hasPageInfoChecked = !1, rule20 = {
3937
3949
  meta: {
3938
3950
  type: "problem",
@@ -3988,7 +4000,7 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
3988
4000
  let field = fieldMap[fieldName], isAllowedType = !1;
3989
4001
  if (field) {
3990
4002
  let type = field.gqlType;
3991
- typeName === "Boolean" ? isAllowedType = type.kind === Kind17.NON_NULL_TYPE && type.gqlType.kind === Kind17.NAMED_TYPE && type.gqlType.name.value === "Boolean" : type.kind === Kind17.NAMED_TYPE && (isAllowedType = type.name.value === "String" || isScalarType4(schema16.getType(type.name.value)));
4003
+ typeName === "Boolean" ? isAllowedType = type.kind === Kind16.NON_NULL_TYPE && type.gqlType.kind === Kind16.NAMED_TYPE && type.gqlType.name.value === "Boolean" : type.kind === Kind16.NAMED_TYPE && (isAllowedType = type.name.value === "String" || isScalarType4(schema16.getType(type.name.value)));
3992
4004
  }
3993
4005
  if (!isAllowedType) {
3994
4006
  let returnType = typeName === "Boolean" ? "non-null Boolean" : "either String or Scalar, which can be null if there are no results";
@@ -4192,15 +4204,15 @@ var rule22 = {
4192
4204
  };
4193
4205
 
4194
4206
  // src/rules/require-description/index.ts
4195
- import { Kind as Kind18, TokenKind as TokenKind3 } from "graphql";
4207
+ import { Kind as Kind17, TokenKind as TokenKind3 } from "graphql";
4196
4208
  import { getRootTypeNames } from "@graphql-tools/utils";
4197
4209
  var RULE_ID14 = "require-description", ALLOWED_KINDS2 = [
4198
4210
  ...TYPES_KINDS,
4199
- Kind18.DIRECTIVE_DEFINITION,
4200
- Kind18.FIELD_DEFINITION,
4201
- Kind18.INPUT_VALUE_DEFINITION,
4202
- Kind18.ENUM_VALUE_DEFINITION,
4203
- Kind18.OPERATION_DEFINITION
4211
+ Kind17.DIRECTIVE_DEFINITION,
4212
+ Kind17.FIELD_DEFINITION,
4213
+ Kind17.INPUT_VALUE_DEFINITION,
4214
+ Kind17.ENUM_VALUE_DEFINITION,
4215
+ Kind17.OPERATION_DEFINITION
4204
4216
  ], schema12 = {
4205
4217
  type: "array",
4206
4218
  minItems: 1,
@@ -4223,7 +4235,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4223
4235
  ...Object.fromEntries(
4224
4236
  [...ALLOWED_KINDS2].sort().map((kind) => {
4225
4237
  let description = `Read more about this kind on [spec.graphql.org](https://spec.graphql.org/October2021/#${kind}).`;
4226
- return kind === Kind18.OPERATION_DEFINITION && (description += '\n> You must use only comment syntax `#` and not description syntax `"""` or `"`.'), [kind, { type: "boolean", description }];
4238
+ return kind === Kind17.OPERATION_DEFINITION && (description += '\n> You must use only comment syntax `#` and not description syntax `"""` or `"`.'), [kind, { type: "boolean", description }];
4227
4239
  })
4228
4240
  )
4229
4241
  }
@@ -4299,7 +4311,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4299
4311
  configOptions: [
4300
4312
  {
4301
4313
  types: !0,
4302
- [Kind18.DIRECTIVE_DEFINITION]: !0,
4314
+ [Kind17.DIRECTIVE_DEFINITION]: !0,
4303
4315
  rootField: !0
4304
4316
  }
4305
4317
  ],
@@ -4325,7 +4337,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
4325
4337
  }
4326
4338
  return {
4327
4339
  [[...kinds].join(",")](node) {
4328
- let description = "", isOperation = node.kind === Kind18.OPERATION_DEFINITION;
4340
+ let description = "", isOperation = node.kind === Kind17.OPERATION_DEFINITION;
4329
4341
  if (isOperation) {
4330
4342
  let rawNode = node.rawNode(), { prev, line } = rawNode.loc.startToken;
4331
4343
  if (prev?.kind === TokenKind3.COMMENT) {
@@ -4531,7 +4543,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
4531
4543
  };
4532
4544
 
4533
4545
  // src/rules/require-nullable-fields-with-oneof/index.ts
4534
- import { Kind as Kind19 } from "graphql";
4546
+ import { Kind as Kind18 } from "graphql";
4535
4547
  var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4536
4548
  meta: {
4537
4549
  type: "suggestion",
@@ -4575,11 +4587,11 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4575
4587
  return {
4576
4588
  "Directive[name.value=oneOf]"({ parent }) {
4577
4589
  if ([
4578
- Kind19.OBJECT_TYPE_DEFINITION,
4579
- Kind19.INPUT_OBJECT_TYPE_DEFINITION
4590
+ Kind18.OBJECT_TYPE_DEFINITION,
4591
+ Kind18.INPUT_OBJECT_TYPE_DEFINITION
4580
4592
  ].includes(parent.kind))
4581
4593
  for (let field of parent.fields || [])
4582
- field.gqlType.kind === Kind19.NON_NULL_TYPE && context.report({
4594
+ field.gqlType.kind === Kind18.NON_NULL_TYPE && context.report({
4583
4595
  node: field.name,
4584
4596
  messageId: RULE_ID17,
4585
4597
  data: { nodeName: getNodeName(field) }
@@ -4590,7 +4602,7 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
4590
4602
  };
4591
4603
 
4592
4604
  // src/rules/require-nullable-result-in-root/index.ts
4593
- import { Kind as Kind20 } from "graphql";
4605
+ import { Kind as Kind19 } from "graphql";
4594
4606
  var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4595
4607
  meta: {
4596
4608
  type: "suggestion",
@@ -4640,7 +4652,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4640
4652
  "ObjectTypeDefinition,ObjectTypeExtension"(node) {
4641
4653
  if (rootTypeNames.has(node.name.value))
4642
4654
  for (let field of node.fields || []) {
4643
- if (field.gqlType.type !== Kind20.NON_NULL_TYPE || field.gqlType.gqlType.type !== Kind20.NAMED_TYPE)
4655
+ if (field.gqlType.type !== Kind19.NON_NULL_TYPE || field.gqlType.gqlType.type !== Kind19.NAMED_TYPE)
4644
4656
  continue;
4645
4657
  let name = field.gqlType.gqlType.name.value, type = schema16.getType(name), resultType = type?.astNode ? getNodeName(type.astNode) : type?.name;
4646
4658
  context.report({
@@ -4671,7 +4683,7 @@ import {
4671
4683
  GraphQLInterfaceType,
4672
4684
  GraphQLObjectType,
4673
4685
  GraphQLUnionType,
4674
- Kind as Kind21,
4686
+ Kind as Kind20,
4675
4687
  TypeInfo as TypeInfo3,
4676
4688
  visit as visit8,
4677
4689
  visitWithTypeInfo as visitWithTypeInfo3
@@ -4765,10 +4777,10 @@ Include it in your selection set{{ addition }}.`
4765
4777
  schema: schema13
4766
4778
  },
4767
4779
  create(context) {
4768
- let schema16 = requireGraphQLSchemaFromContext(RULE_ID19, context), siblings = requireSiblingsOperations(RULE_ID19, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo3(schema16);
4780
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID19, context), siblings = requireSiblingsOperations(RULE_ID19, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo3(schema16);
4769
4781
  function checkFragments(node) {
4770
4782
  for (let selection of node.selections) {
4771
- if (selection.kind !== Kind21.FRAGMENT_SPREAD)
4783
+ if (selection.kind !== Kind20.FRAGMENT_SPREAD)
4772
4784
  continue;
4773
4785
  let [foundSpread] = siblings.getFragment(selection.name.value);
4774
4786
  if (!foundSpread)
@@ -4776,7 +4788,7 @@ Include it in your selection set{{ addition }}.`
4776
4788
  let checkedFragmentSpreads = /* @__PURE__ */ new Set(), visitor = visitWithTypeInfo3(typeInfo, {
4777
4789
  SelectionSet(node2, key, _parent) {
4778
4790
  let parent = _parent;
4779
- parent.kind === Kind21.FRAGMENT_DEFINITION ? checkedFragmentSpreads.add(parent.name.value) : parent.kind !== Kind21.INLINE_FRAGMENT && checkSelections(
4791
+ parent.kind === Kind20.FRAGMENT_DEFINITION ? checkedFragmentSpreads.add(parent.name.value) : parent.kind !== Kind20.INLINE_FRAGMENT && checkSelections(
4780
4792
  node2,
4781
4793
  typeInfo.getType(),
4782
4794
  selection.loc.start,
@@ -4795,10 +4807,10 @@ Include it in your selection set{{ addition }}.`
4795
4807
  else if (rawType instanceof GraphQLUnionType)
4796
4808
  for (let selection of node.selections) {
4797
4809
  let types = rawType.getTypes();
4798
- if (selection.kind === Kind21.INLINE_FRAGMENT) {
4810
+ if (selection.kind === Kind20.INLINE_FRAGMENT) {
4799
4811
  let t = types.find((t2) => t2.name === selection.typeCondition.name.value);
4800
4812
  t && checkFields(t);
4801
- } else if (selection.kind === Kind21.FRAGMENT_SPREAD) {
4813
+ } else if (selection.kind === Kind20.FRAGMENT_SPREAD) {
4802
4814
  let [foundSpread] = siblings.getFragment(selection.name.value);
4803
4815
  if (!foundSpread) return;
4804
4816
  let fragmentSpread = foundSpread.document, t = fragmentSpread.typeCondition.name.value === rawType.name ? rawType : types.find((t2) => t2.name === fragmentSpread.typeCondition.name.value);
@@ -4811,11 +4823,11 @@ Include it in your selection set{{ addition }}.`
4811
4823
  return;
4812
4824
  function hasIdField({ selections }) {
4813
4825
  return selections.some((selection) => {
4814
- if (selection.kind === Kind21.FIELD)
4826
+ if (selection.kind === Kind20.FIELD)
4815
4827
  return selection.alias && idNames.includes(selection.alias.value) ? !0 : idNames.includes(selection.name.value);
4816
- if (selection.kind === Kind21.INLINE_FRAGMENT)
4828
+ if (selection.kind === Kind20.INLINE_FRAGMENT)
4817
4829
  return hasIdField(selection.selectionSet);
4818
- if (selection.kind === Kind21.FRAGMENT_SPREAD) {
4830
+ if (selection.kind === Kind20.FRAGMENT_SPREAD) {
4819
4831
  let [foundSpread] = siblings.getFragment(selection.name.value);
4820
4832
  if (foundSpread) {
4821
4833
  let fragmentSpread = foundSpread.document;
@@ -4843,7 +4855,7 @@ Include it in your selection set{{ addition }}.`
4843
4855
  desc: `Add \`${idName}\` selection`,
4844
4856
  fix: (fixer) => {
4845
4857
  let insertNode = node.selections[0];
4846
- return insertNode = insertNode.kind === Kind21.INLINE_FRAGMENT ? insertNode.selectionSet.selections[0] : insertNode, fixer.insertTextBefore(insertNode, `${idName} `);
4858
+ return insertNode = insertNode.kind === Kind20.INLINE_FRAGMENT ? insertNode.selectionSet.selections[0] : insertNode, fixer.insertTextBefore(insertNode, `${idName} `);
4847
4859
  }
4848
4860
  }))), context.report(problem);
4849
4861
  }
@@ -4918,7 +4930,7 @@ var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
4918
4930
  };
4919
4931
 
4920
4932
  // src/rules/selection-set-depth/index.ts
4921
- import { Kind as Kind22 } from "graphql";
4933
+ import { Kind as Kind21 } from "graphql";
4922
4934
  import depthLimit from "graphql-depth-limit";
4923
4935
  var RULE_ID21 = "selection-set-depth", schema14 = {
4924
4936
  type: "array",
@@ -5004,7 +5016,7 @@ var RULE_ID21 = "selection-set-depth", schema14 = {
5004
5016
  "OperationDefinition, FragmentDefinition"(node) {
5005
5017
  try {
5006
5018
  let rawNode = node.rawNode(), fragmentsInUse = siblings ? siblings.getFragmentsInUse(rawNode) : [], document = {
5007
- kind: Kind22.DOCUMENT,
5019
+ kind: Kind21.DOCUMENT,
5008
5020
  definitions: [rawNode, ...fragmentsInUse]
5009
5021
  };
5010
5022
  checkFn({
@@ -5048,7 +5060,7 @@ var RULE_ID21 = "selection-set-depth", schema14 = {
5048
5060
  };
5049
5061
 
5050
5062
  // src/rules/strict-id-in-types/index.ts
5051
- import { Kind as Kind23 } from "graphql";
5063
+ import { Kind as Kind22 } from "graphql";
5052
5064
  var RULE_ID22 = "strict-id-in-types", schema15 = {
5053
5065
  type: "array",
5054
5066
  maxItems: 1,
@@ -5177,7 +5189,7 @@ var RULE_ID22 = "strict-id-in-types", schema15 = {
5177
5189
  return;
5178
5190
  if (node.fields?.filter((field) => {
5179
5191
  let fieldNode = field.rawNode(), isValidIdName = options.acceptedIdNames.includes(fieldNode.name.value), isValidIdType = !1;
5180
- return fieldNode.type.kind === Kind23.NON_NULL_TYPE && fieldNode.type.type.kind === Kind23.NAMED_TYPE && (isValidIdType = options.acceptedIdTypes.includes(fieldNode.type.type.name.value)), isValidIdName && isValidIdType;
5192
+ return fieldNode.type.kind === Kind22.NON_NULL_TYPE && fieldNode.type.type.kind === Kind22.NAMED_TYPE && (isValidIdType = options.acceptedIdTypes.includes(fieldNode.type.type.name.value)), isValidIdName && isValidIdType;
5181
5193
  })?.length !== 1) {
5182
5194
  let pluralNamesSuffix = options.acceptedIdNames.length > 1 ? "s" : "", pluralTypesSuffix = options.acceptedIdTypes.length > 1 ? "s" : "";
5183
5195
  context.report({
@@ -5193,7 +5205,7 @@ Accepted type${pluralTypesSuffix}: ${englishJoinWords(options.acceptedIdTypes)}.
5193
5205
  };
5194
5206
 
5195
5207
  // src/rules/unique-enum-value-names/index.ts
5196
- import { Kind as Kind24 } from "graphql";
5208
+ import { Kind as Kind23 } from "graphql";
5197
5209
  var rule32 = {
5198
5210
  meta: {
5199
5211
  type: "suggestion",
@@ -5237,7 +5249,7 @@ var rule32 = {
5237
5249
  },
5238
5250
  create(context) {
5239
5251
  return {
5240
- [[Kind24.ENUM_TYPE_DEFINITION, Kind24.ENUM_TYPE_EXTENSION].join(",")](node) {
5252
+ [[Kind23.ENUM_TYPE_DEFINITION, Kind23.ENUM_TYPE_EXTENSION].join(",")](node) {
5241
5253
  let duplicates = node.values?.filter(
5242
5254
  (item, index, array) => array.findIndex((v) => v.name.value.toLowerCase() === item.name.value.toLowerCase()) !== index
5243
5255
  );
@@ -5263,9 +5275,9 @@ var rule32 = {
5263
5275
 
5264
5276
  // src/rules/unique-fragment-name/index.ts
5265
5277
  import { relative as relative2 } from "node:path";
5266
- import { Kind as Kind25 } from "graphql";
5278
+ import { Kind as Kind24 } from "graphql";
5267
5279
  var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
5268
- let documentName = node.name.value, siblings = requireSiblingsOperations(ruleId, context), siblingDocuments = node.kind === Kind25.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName), filepath = context.filename, conflictingDocuments = siblingDocuments.filter((f) => {
5280
+ let documentName = node.name.value, siblings = requireSiblingsOperations(ruleId, context), siblingDocuments = node.kind === Kind24.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName), filepath = context.filename, conflictingDocuments = siblingDocuments.filter((f) => {
5269
5281
  let isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
5270
5282
  return isSameName && !isSamePath;
5271
5283
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "4.0.0-alpha.11",
3
+ "version": "4.0.0-alpha.13",
4
4
  "type": "module",
5
5
  "description": "GraphQL plugin for ESLint",
6
6
  "repository": "https://github.com/B2o5T/graphql-eslint",