@graphql-eslint/eslint-plugin 4.0.0-alpha.3 → 4.0.0-alpha.5

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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![GraphQLConf 2024 Banner: September 10-12, San Francisco. Hosted by the GraphQL Foundation](https://github.com/user-attachments/assets/bdb8cd5d-5186-4ece-b06b-b00a499b7868)](https://graphql.org/conf/2024/?utm_source=github&utm_medium=graphql_eslint&utm_campaign=readme)
2
+
1
3
  # GraphQL-ESLint
2
4
 
3
5
  [![npm version](https://badge.fury.io/js/%40graphql-eslint%2Feslint-plugin.svg)](https://badge.fury.io/js/%40graphql-eslint%2Feslint-plugin)
package/cjs/meta.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- declare const name: string;
2
1
  declare const version: string;
3
2
 
4
- export { name, version };
3
+ export { version };
package/cjs/meta.js CHANGED
@@ -5,8 +5,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name2 in all)
9
- __defProp(target, name2, { get: all[name2], enumerable: !0 });
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: !0 });
10
10
  }, __copyProps = (to, from, except, desc) => {
11
11
  if (from && typeof from == "object" || typeof from == "function")
12
12
  for (let key of __getOwnPropNames(from))
@@ -23,14 +23,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
24
  var meta_exports = {};
25
25
  __export(meta_exports, {
26
- name: () => name,
27
26
  version: () => version
28
27
  });
29
28
  module.exports = __toCommonJS(meta_exports);
30
29
  var import_package = __toESM(require("../package.json"), 1);
31
- const { name, version } = import_package.default;
30
+ const { version } = import_package.default;
32
31
  // Annotate the CommonJS export names for ESM import in node:
33
32
  0 && (module.exports = {
34
- name,
35
33
  version
36
34
  });
@@ -21,7 +21,7 @@ declare const rules: {
21
21
  groups?: string[] | undefined;
22
22
  }[]>;
23
23
  'description-style': GraphQLESLintRule<{
24
- style?: "block" | "inline" | undefined;
24
+ style: "block" | "inline";
25
25
  }[]>;
26
26
  'input-name': GraphQLESLintRule<{
27
27
  checkInputType?: boolean | undefined;
@@ -83,7 +83,7 @@ declare const rules: {
83
83
  'no-unreachable-types': GraphQLESLintRule;
84
84
  'no-unused-fields': GraphQLESLintRule;
85
85
  'relay-arguments': GraphQLESLintRule<{
86
- includeBoth?: boolean | undefined;
86
+ includeBoth: boolean;
87
87
  }[], true>;
88
88
  'relay-connection-types': GraphQLESLintRule;
89
89
  'relay-edge-types': GraphQLESLintRule<{
@@ -102,7 +102,7 @@ declare const rules: {
102
102
  'require-nullable-fields-with-oneof': GraphQLESLintRule;
103
103
  'require-nullable-result-in-root': GraphQLESLintRule;
104
104
  'require-selections': GraphQLESLintRule<{
105
- fieldName?: string | string[] | undefined;
105
+ fieldName: string | string[];
106
106
  }[], true>;
107
107
  'require-type-pattern-with-oneof': GraphQLESLintRule;
108
108
  'selection-set-depth': GraphQLESLintRule<{
@@ -38,7 +38,9 @@ declare const schema: {
38
38
  };
39
39
  };
40
40
  };
41
- type RuleOptions = FromSchema<typeof schema>;
41
+ type RuleOptions = FromSchema<typeof schema, {
42
+ keepDefaultedPropertiesOptional: true;
43
+ }>;
42
44
  declare const rule: GraphQLESLintRule<RuleOptions>;
43
45
 
44
46
  export { type RuleOptions, rule };
@@ -102,7 +102,9 @@ declare const schema: {
102
102
  readonly description: string;
103
103
  };
104
104
  };
105
- type RuleOptions = FromSchema<typeof schema>;
105
+ type RuleOptions = FromSchema<typeof schema, {
106
+ keepDefaultedPropertiesOptional: true;
107
+ }>;
106
108
  declare const rule: GraphQLESLintRule<RuleOptions>;
107
109
 
108
110
  export { type RuleOptions, rule };
@@ -34,7 +34,9 @@ declare const schema: {
34
34
  };
35
35
  };
36
36
  };
37
- type RuleOptions = FromSchema<typeof schema>;
37
+ type RuleOptions = FromSchema<typeof schema, {
38
+ keepDefaultedPropertiesOptional: true;
39
+ }>;
38
40
  declare const rule: GraphQLESLintRule<RuleOptions, true>;
39
41
 
40
42
  export { type RuleOptions, rule };
@@ -60,7 +60,9 @@ declare const schema: {
60
60
  };
61
61
  };
62
62
  };
63
- type RuleOptions = FromSchema<typeof schema>;
63
+ type RuleOptions = FromSchema<typeof schema, {
64
+ keepDefaultedPropertiesOptional: true;
65
+ }>;
64
66
  declare const rule: GraphQLESLintRule<RuleOptions>;
65
67
 
66
68
  export { type RuleOptions, rule };
package/esm/meta.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- declare const name: string;
2
1
  declare const version: string;
3
2
 
4
- export { name, version };
3
+ export { version };
package/esm/meta.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import "./chunk-UIAXBAMD.js";
2
- import packageJson from "../package.json" assert { type: "json" };
3
- const { name, version } = packageJson;
2
+ import packageJson from "../package.json" with { type: "json" };
3
+ const { version } = packageJson;
4
4
  export {
5
- name,
6
5
  version
7
6
  };
@@ -21,7 +21,7 @@ declare const rules: {
21
21
  groups?: string[] | undefined;
22
22
  }[]>;
23
23
  'description-style': GraphQLESLintRule<{
24
- style?: "block" | "inline" | undefined;
24
+ style: "block" | "inline";
25
25
  }[]>;
26
26
  'input-name': GraphQLESLintRule<{
27
27
  checkInputType?: boolean | undefined;
@@ -83,7 +83,7 @@ declare const rules: {
83
83
  'no-unreachable-types': GraphQLESLintRule;
84
84
  'no-unused-fields': GraphQLESLintRule;
85
85
  'relay-arguments': GraphQLESLintRule<{
86
- includeBoth?: boolean | undefined;
86
+ includeBoth: boolean;
87
87
  }[], true>;
88
88
  'relay-connection-types': GraphQLESLintRule;
89
89
  'relay-edge-types': GraphQLESLintRule<{
@@ -102,7 +102,7 @@ declare const rules: {
102
102
  'require-nullable-fields-with-oneof': GraphQLESLintRule;
103
103
  'require-nullable-result-in-root': GraphQLESLintRule;
104
104
  'require-selections': GraphQLESLintRule<{
105
- fieldName?: string | string[] | undefined;
105
+ fieldName: string | string[];
106
106
  }[], true>;
107
107
  'require-type-pattern-with-oneof': GraphQLESLintRule;
108
108
  'selection-set-depth': GraphQLESLintRule<{
@@ -38,7 +38,9 @@ declare const schema: {
38
38
  };
39
39
  };
40
40
  };
41
- type RuleOptions = FromSchema<typeof schema>;
41
+ type RuleOptions = FromSchema<typeof schema, {
42
+ keepDefaultedPropertiesOptional: true;
43
+ }>;
42
44
  declare const rule: GraphQLESLintRule<RuleOptions>;
43
45
 
44
46
  export { type RuleOptions, rule };
@@ -102,7 +102,9 @@ declare const schema: {
102
102
  readonly description: string;
103
103
  };
104
104
  };
105
- type RuleOptions = FromSchema<typeof schema>;
105
+ type RuleOptions = FromSchema<typeof schema, {
106
+ keepDefaultedPropertiesOptional: true;
107
+ }>;
106
108
  declare const rule: GraphQLESLintRule<RuleOptions>;
107
109
 
108
110
  export { type RuleOptions, rule };
@@ -34,7 +34,9 @@ declare const schema: {
34
34
  };
35
35
  };
36
36
  };
37
- type RuleOptions = FromSchema<typeof schema>;
37
+ type RuleOptions = FromSchema<typeof schema, {
38
+ keepDefaultedPropertiesOptional: true;
39
+ }>;
38
40
  declare const rule: GraphQLESLintRule<RuleOptions, true>;
39
41
 
40
42
  export { type RuleOptions, rule };
@@ -60,7 +60,9 @@ declare const schema: {
60
60
  };
61
61
  };
62
62
  };
63
- type RuleOptions = FromSchema<typeof schema>;
63
+ type RuleOptions = FromSchema<typeof schema, {
64
+ keepDefaultedPropertiesOptional: true;
65
+ }>;
64
66
  declare const rule: GraphQLESLintRule<RuleOptions>;
65
67
 
66
68
  export { type RuleOptions, rule };
package/index.browser.js CHANGED
@@ -390,7 +390,7 @@ function convertToESTree(node, schema15) {
390
390
  // package.json
391
391
  var package_default = {
392
392
  name: "@graphql-eslint/eslint-plugin",
393
- version: "4.0.0-alpha.3",
393
+ version: "4.0.0-alpha.5",
394
394
  type: "module",
395
395
  description: "GraphQL plugin for ESLint",
396
396
  repository: "https://github.com/B2o5T/graphql-eslint",
@@ -399,21 +399,16 @@ var package_default = {
399
399
  engines: {
400
400
  node: ">=18"
401
401
  },
402
- main: "dist/cjs/index.js",
403
402
  exports: {
404
403
  "./package.json": "./package.json",
405
404
  ".": {
406
405
  require: {
407
- types: "./dist/cjs/index.d.ts",
406
+ types: "./dist/cjs/index.d.cts",
408
407
  default: "./dist/cjs/index.js"
409
408
  },
410
409
  import: {
411
410
  types: "./dist/esm/index.d.ts",
412
411
  default: "./dist/esm/index.js"
413
- },
414
- default: {
415
- types: "./dist/esm/index.d.ts",
416
- default: "./dist/esm/index.js"
417
412
  }
418
413
  }
419
414
  },
@@ -435,7 +430,7 @@ var package_default = {
435
430
  },
436
431
  dependencies: {
437
432
  "@graphql-tools/code-file-loader": "^8.0.0",
438
- "@graphql-tools/graphql-tag-pluck": "8.3.2-alpha-20240803110708-298aeb8bb2ca4ef649bf09fc42f82fc88c6d5e13",
433
+ "@graphql-tools/graphql-tag-pluck": "8.3.2",
439
434
  "@graphql-tools/utils": "^10.0.0",
440
435
  debug: "^4.3.4",
441
436
  "fast-glob": "^3.2.12",
@@ -446,14 +441,14 @@ var package_default = {
446
441
  devDependencies: {
447
442
  "@theguild/eslint-rule-tester": "workspace:*",
448
443
  "@types/debug": "4.1.12",
449
- "@types/eslint": "9.6.0",
450
- "@types/estree": "1.0.5",
444
+ "@types/eslint": "9.6.1",
445
+ "@types/estree": "1.0.6",
451
446
  "@types/graphql-depth-limit": "1.1.6",
452
447
  "@types/json-schema": "7.0.15",
453
448
  "@types/lodash.lowercase": "4.3.9",
454
449
  graphql: "16.9.0",
455
- "json-schema-to-ts": "2.12.0",
456
- "vite-tsconfig-paths": "^4.3.2"
450
+ "json-schema-to-ts": "3.1.1",
451
+ "vite-tsconfig-paths": "^5.0.0"
457
452
  },
458
453
  publishConfig: {
459
454
  directory: "dist",
@@ -463,7 +458,7 @@ var package_default = {
463
458
  };
464
459
 
465
460
  // src/meta.ts
466
- var { name, version } = package_default;
461
+ var { version } = package_default;
467
462
 
468
463
  // src/siblings.ts
469
464
  import {
@@ -641,7 +636,7 @@ function getSiblings(documents) {
641
636
  cachedOperations = result;
642
637
  }
643
638
  return cachedOperations;
644
- }, getFragment = (name2) => getFragments().filter((f) => f.document.name.value === name2), collectFragments = (selectable, recursive, collected = /* @__PURE__ */ new Map()) => (visit2(selectable, {
639
+ }, getFragment = (name) => getFragments().filter((f) => f.document.name.value === name), collectFragments = (selectable, recursive, collected = /* @__PURE__ */ new Map()) => (visit2(selectable, {
645
640
  FragmentSpread(spread) {
646
641
  let fragmentName = spread.name.value, [fragment] = getFragment(fragmentName);
647
642
  if (!fragment) {
@@ -658,7 +653,7 @@ function getSiblings(documents) {
658
653
  getFragments,
659
654
  getFragmentByType: (typeName) => getFragments().filter((f) => f.document.typeCondition.name.value === typeName),
660
655
  getFragmentsInUse: (selectable, recursive = !0) => Array.from(collectFragments(selectable, recursive).values()),
661
- getOperation: (name2) => getOperations().filter((o) => o.document.name?.value === name2),
656
+ getOperation: (name) => getOperations().filter((o) => o.document.name?.value === name),
662
657
  getOperations,
663
658
  getOperationByType: (type) => getOperations().filter((o) => o.document.operation === type)
664
659
  };
@@ -1176,10 +1171,10 @@ function validateDocument({
1176
1171
  loc,
1177
1172
  message: error.message,
1178
1173
  suggest: hasDidYouMeanSuggestions ? matches.map((match) => {
1179
- let { name: name2 } = match.groups;
1174
+ let { name } = match.groups;
1180
1175
  return {
1181
- desc: `Rename to \`${name2}\``,
1182
- fix: (fixer) => fixer.replaceText(token, name2)
1176
+ desc: `Rename to \`${name}\``,
1177
+ fix: (fixer) => fixer.replaceText(token, name)
1183
1178
  };
1184
1179
  }) : []
1185
1180
  });
@@ -1203,7 +1198,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
1203
1198
  }), { fragmentDefs, fragmentSpreads };
1204
1199
  }, getMissingFragments = (node) => {
1205
1200
  let { fragmentDefs, fragmentSpreads } = getFragmentDefsAndFragmentSpreads(node);
1206
- return [...fragmentSpreads].filter((name2) => !fragmentDefs.has(name2));
1201
+ return [...fragmentSpreads].filter((name) => !fragmentDefs.has(name));
1207
1202
  }, handleMissingFragments = ({ ruleId, context, node }) => {
1208
1203
  let missingFragments = getMissingFragments(node);
1209
1204
  if (missingFragments.length > 0) {
@@ -1840,10 +1835,10 @@ Using the same name for all input parameters will make your schemas easier to co
1840
1835
  return currentNode;
1841
1836
  })(node);
1842
1837
  if (shouldCheckType(inputValueNode.parent.parent)) {
1843
- let mutationName = `${inputValueNode.parent.name.value}Input`, name2 = node.name.value;
1844
- (options.caseSensitiveInputType && node.name.value !== mutationName || name2.toLowerCase() !== mutationName.toLowerCase()) && context.report({
1838
+ let mutationName = `${inputValueNode.parent.name.value}Input`, name = node.name.value;
1839
+ (options.caseSensitiveInputType && node.name.value !== mutationName || name.toLowerCase() !== mutationName.toLowerCase()) && context.report({
1845
1840
  node: node.name,
1846
- message: `Input type \`${name2}\` name should be \`${mutationName}\`.`,
1841
+ message: `Input type \`${name}\` name should be \`${mutationName}\`.`,
1847
1842
  suggest: [
1848
1843
  {
1849
1844
  desc: `Rename to \`${mutationName}\``,
@@ -1926,11 +1921,11 @@ var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...O
1926
1921
  },
1927
1922
  "Document:exit"() {
1928
1923
  for (let { node, type } of definitions.slice(1)) {
1929
- let name2 = pascalCase(type), definitionName = node.name?.value;
1930
- definitionName && (name2 += ` "${definitionName}"`), context.report({
1924
+ let name = pascalCase(type), definitionName = node.name?.value;
1925
+ definitionName && (name += ` "${definitionName}"`), context.report({
1931
1926
  loc: node.name?.loc || getLocation(node.loc.start, type),
1932
1927
  messageId: RULE_ID2,
1933
- data: { name: name2 }
1928
+ data: { name }
1934
1929
  });
1935
1930
  }
1936
1931
  }
@@ -1939,7 +1934,7 @@ var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...O
1939
1934
  };
1940
1935
 
1941
1936
  // src/rules/match-document-filename.ts
1942
- import { basename, extname } from "path";
1937
+ import { basename, extname } from "node:path";
1943
1938
  import { Kind as Kind7 } from "graphql";
1944
1939
  var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLES = [
1945
1940
  "camelCase",
@@ -2497,51 +2492,51 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
2497
2492
  report(node, `${nodeType} "${nodeName}" should ${errorMessage}`, suggestedNames);
2498
2493
  }
2499
2494
  function getError() {
2500
- let name2 = nodeName.replace(/(^_+)|(_+$)/g, "");
2501
- if (ignorePattern && new RegExp(ignorePattern, "u").test(name2))
2495
+ let name = nodeName.replace(/(^_+)|(_+$)/g, "");
2496
+ if (ignorePattern && new RegExp(ignorePattern, "u").test(name))
2502
2497
  return;
2503
- if (prefix && !name2.startsWith(prefix))
2498
+ if (prefix && !name.startsWith(prefix))
2504
2499
  return {
2505
2500
  errorMessage: `have "${prefix}" prefix`,
2506
- renameToNames: [prefix + name2]
2501
+ renameToNames: [prefix + name]
2507
2502
  };
2508
- if (suffix && !name2.endsWith(suffix))
2503
+ if (suffix && !name.endsWith(suffix))
2509
2504
  return {
2510
2505
  errorMessage: `have "${suffix}" suffix`,
2511
- renameToNames: [name2 + suffix]
2506
+ renameToNames: [name + suffix]
2512
2507
  };
2513
- let forbiddenPrefix = forbiddenPrefixes?.find((prefix2) => name2.startsWith(prefix2));
2508
+ let forbiddenPrefix = forbiddenPrefixes?.find((prefix2) => name.startsWith(prefix2));
2514
2509
  if (forbiddenPrefix)
2515
2510
  return {
2516
2511
  errorMessage: `not have "${forbiddenPrefix}" prefix`,
2517
- renameToNames: [name2.replace(new RegExp(`^${forbiddenPrefix}`), "")]
2512
+ renameToNames: [name.replace(new RegExp(`^${forbiddenPrefix}`), "")]
2518
2513
  };
2519
- let forbiddenSuffix = forbiddenSuffixes?.find((suffix2) => name2.endsWith(suffix2));
2514
+ let forbiddenSuffix = forbiddenSuffixes?.find((suffix2) => name.endsWith(suffix2));
2520
2515
  if (forbiddenSuffix)
2521
2516
  return {
2522
2517
  errorMessage: `not have "${forbiddenSuffix}" suffix`,
2523
- renameToNames: [name2.replace(new RegExp(`${forbiddenSuffix}$`), "")]
2518
+ renameToNames: [name.replace(new RegExp(`${forbiddenSuffix}$`), "")]
2524
2519
  };
2525
- if (requiredPrefixes && !requiredPrefixes.some((requiredPrefix) => name2.startsWith(requiredPrefix)))
2520
+ if (requiredPrefixes && !requiredPrefixes.some((requiredPrefix) => name.startsWith(requiredPrefix)))
2526
2521
  return {
2527
2522
  errorMessage: `have one of the following prefixes: ${englishJoinWords(
2528
2523
  requiredPrefixes
2529
2524
  )}`,
2530
- renameToNames: style ? requiredPrefixes.map((prefix2) => convertCase(style, `${prefix2} ${name2}`)) : requiredPrefixes.map((prefix2) => `${prefix2}${name2}`)
2525
+ renameToNames: style ? requiredPrefixes.map((prefix2) => convertCase(style, `${prefix2} ${name}`)) : requiredPrefixes.map((prefix2) => `${prefix2}${name}`)
2531
2526
  };
2532
- if (requiredSuffixes && !requiredSuffixes.some((requiredSuffix) => name2.endsWith(requiredSuffix)))
2527
+ if (requiredSuffixes && !requiredSuffixes.some((requiredSuffix) => name.endsWith(requiredSuffix)))
2533
2528
  return {
2534
2529
  errorMessage: `have one of the following suffixes: ${englishJoinWords(
2535
2530
  requiredSuffixes
2536
2531
  )}`,
2537
- renameToNames: style ? requiredSuffixes.map((suffix2) => convertCase(style, `${name2} ${suffix2}`)) : requiredSuffixes.map((suffix2) => `${name2}${suffix2}`)
2532
+ renameToNames: style ? requiredSuffixes.map((suffix2) => convertCase(style, `${name} ${suffix2}`)) : requiredSuffixes.map((suffix2) => `${name}${suffix2}`)
2538
2533
  };
2539
2534
  if (!style)
2540
2535
  return;
2541
- if (!StyleToRegex[style].test(name2))
2536
+ if (!StyleToRegex[style].test(name))
2542
2537
  return {
2543
2538
  errorMessage: `be in ${style} format`,
2544
- renameToNames: [convertCase(style, name2)]
2539
+ renameToNames: [convertCase(style, name)]
2545
2540
  };
2546
2541
  }
2547
2542
  }, checkUnderscore = (isLeading) => (node) => {
@@ -2968,7 +2963,7 @@ var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
2968
2963
  };
2969
2964
 
2970
2965
  // src/rules/no-one-place-fragments.ts
2971
- import { relative } from "path";
2966
+ import { relative } from "node:path";
2972
2967
  import { visit as visit4 } from "graphql";
2973
2968
  var RULE_ID7 = "no-one-place-fragments", rule11 = {
2974
2969
  meta: {
@@ -3028,8 +3023,8 @@ var RULE_ID7 = "no-one-place-fragments", rule11 = {
3028
3023
  for (let { document, filePath } of allDocuments) {
3029
3024
  let relativeFilePath = relative(CWD, filePath);
3030
3025
  visit4(document, {
3031
- FragmentSpread({ name: name2 }) {
3032
- let spreadName = name2.value;
3026
+ FragmentSpread({ name }) {
3027
+ let spreadName = name.value;
3033
3028
  usedFragmentsMap[spreadName] ||= [], usedFragmentsMap[spreadName].push(relativeFilePath);
3034
3029
  }
3035
3030
  });
@@ -4338,7 +4333,7 @@ var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
4338
4333
  };
4339
4334
 
4340
4335
  // src/rules/require-import-fragment.ts
4341
- import path from "path";
4336
+ import path from "node:path";
4342
4337
  var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expression", rule25 = {
4343
4338
  meta: {
4344
4339
  type: "suggestion",
@@ -4563,7 +4558,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
4563
4558
  for (let field of node.fields || []) {
4564
4559
  if (field.gqlType.type !== Kind20.NON_NULL_TYPE || field.gqlType.gqlType.type !== Kind20.NAMED_TYPE)
4565
4560
  continue;
4566
- let name2 = field.gqlType.gqlType.name.value, type = schema15.getType(name2), resultType = type?.astNode ? getNodeName(type.astNode) : type?.name;
4561
+ let name = field.gqlType.gqlType.name.value, type = schema15.getType(name), resultType = type?.astNode ? getNodeName(type.astNode) : type?.name;
4567
4562
  context.report({
4568
4563
  node: field.gqlType,
4569
4564
  messageId: RULE_ID18,
@@ -4723,7 +4718,7 @@ Include it in your selection set{{ addition }}.`
4723
4718
  }
4724
4719
  function checkFields(rawType2) {
4725
4720
  let fields = rawType2.getFields();
4726
- if (!idNames.some((name2) => fields[name2]))
4721
+ if (!idNames.some((name) => fields[name]))
4727
4722
  return;
4728
4723
  function hasIdField({ selections }) {
4729
4724
  return selections.some((selection) => {
@@ -4745,8 +4740,8 @@ Include it in your selection set{{ addition }}.`
4745
4740
  if (checkFragments(node), hasId)
4746
4741
  return;
4747
4742
  let pluralSuffix = idNames.length > 1 ? "s" : "", fieldName2 = englishJoinWords(
4748
- idNames.map((name2) => `\`${(parent.alias || parent.name).value}.${name2}\``)
4749
- ), addition = checkedFragmentSpreads.size === 0 ? "" : ` or add to used fragment${checkedFragmentSpreads.size > 1 ? "s" : ""} ${englishJoinWords([...checkedFragmentSpreads].map((name2) => `\`${name2}\``))}`, problem = {
4743
+ idNames.map((name) => `\`${(parent.alias || parent.name).value}.${name}\``)
4744
+ ), addition = checkedFragmentSpreads.size === 0 ? "" : ` or add to used fragment${checkedFragmentSpreads.size > 1 ? "s" : ""} ${englishJoinWords([...checkedFragmentSpreads].map((name) => `\`${name}\``))}`, problem = {
4750
4745
  loc,
4751
4746
  messageId: RULE_ID19,
4752
4747
  data: {
@@ -5178,7 +5173,7 @@ var rule32 = {
5178
5173
  };
5179
5174
 
5180
5175
  // src/rules/unique-fragment-name.ts
5181
- import { relative as relative2 } from "path";
5176
+ import { relative as relative2 } from "node:path";
5182
5177
  import { Kind as Kind25 } from "graphql";
5183
5178
  var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
5184
5179
  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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "4.0.0-alpha.3",
3
+ "version": "4.0.0-alpha.5",
4
4
  "type": "module",
5
5
  "description": "GraphQL plugin for ESLint",
6
6
  "repository": "https://github.com/B2o5T/graphql-eslint",
@@ -9,21 +9,16 @@
9
9
  "engines": {
10
10
  "node": ">=18"
11
11
  },
12
- "main": "cjs/index.js",
13
12
  "exports": {
14
13
  "./package.json": "./package.json",
15
14
  ".": {
16
15
  "require": {
17
- "types": "./cjs/index.d.ts",
16
+ "types": "./cjs/index.d.cts",
18
17
  "default": "./cjs/index.js"
19
18
  },
20
19
  "import": {
21
20
  "types": "./esm/index.d.ts",
22
21
  "default": "./esm/index.js"
23
- },
24
- "default": {
25
- "types": "./esm/index.d.ts",
26
- "default": "./esm/index.js"
27
22
  }
28
23
  }
29
24
  },
@@ -40,7 +35,7 @@
40
35
  },
41
36
  "dependencies": {
42
37
  "@graphql-tools/code-file-loader": "^8.0.0",
43
- "@graphql-tools/graphql-tag-pluck": "8.3.2-alpha-20240803110708-298aeb8bb2ca4ef649bf09fc42f82fc88c6d5e13",
38
+ "@graphql-tools/graphql-tag-pluck": "8.3.2",
44
39
  "@graphql-tools/utils": "^10.0.0",
45
40
  "debug": "^4.3.4",
46
41
  "fast-glob": "^3.2.12",