@graphql-eslint/eslint-plugin 3.20.0-alpha-20230704095135-8d287d5 → 3.20.1-alpha-20230713065115-b9bc635

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/cjs/configs/operations-all.js +1 -23
  2. package/cjs/configs/operations-recommended.js +1 -23
  3. package/cjs/configs/relay.js +1 -23
  4. package/cjs/configs/schema-all.js +1 -23
  5. package/cjs/configs/schema-recommended.js +1 -23
  6. package/cjs/documents.js +2 -1
  7. package/cjs/estree-converter/utils.js +1 -1
  8. package/cjs/parser.js +4 -3
  9. package/cjs/processor.js +1 -1
  10. package/cjs/rules/alphabetize.js +12 -9
  11. package/cjs/rules/graphql-js-validation.js +13 -8
  12. package/cjs/rules/lone-executable-definition.js +5 -3
  13. package/cjs/rules/match-document-filename.js +2 -1
  14. package/cjs/rules/naming-convention.js +2 -2
  15. package/cjs/rules/no-case-insensitive-enum-values-duplicates.js +2 -1
  16. package/cjs/rules/no-deprecated.js +4 -2
  17. package/cjs/rules/no-one-place-fragments.js +1 -1
  18. package/cjs/rules/no-unreachable-types.js +2 -2
  19. package/cjs/rules/no-unused-fields.js +4 -2
  20. package/cjs/rules/relay-arguments.js +2 -1
  21. package/cjs/rules/relay-connection-types.js +8 -2
  22. package/cjs/rules/relay-edge-types.js +7 -4
  23. package/cjs/rules/relay-page-info.js +2 -1
  24. package/cjs/rules/require-deprecation-date.js +3 -2
  25. package/cjs/rules/require-deprecation-reason.js +2 -1
  26. package/cjs/rules/require-description.js +3 -2
  27. package/cjs/rules/require-field-of-type-query-in-mutation-result.js +1 -1
  28. package/cjs/rules/require-import-fragment.js +2 -1
  29. package/cjs/rules/require-nullable-result-in-root.js +1 -1
  30. package/cjs/rules/require-type-pattern-with-oneof.js +2 -1
  31. package/cjs/rules/strict-id-in-types.js +4 -3
  32. package/cjs/rules/unique-fragment-name.js +2 -1
  33. package/cjs/siblings.js +8 -3
  34. package/cjs/utils.js +2 -1
  35. package/esm/cache.js +1 -0
  36. package/esm/chunk-BMTV3EA2.js +8 -0
  37. package/esm/configs/index.js +1 -0
  38. package/esm/configs/operations-all.js +32 -27
  39. package/esm/configs/operations-recommended.js +57 -52
  40. package/esm/configs/relay.js +17 -12
  41. package/esm/configs/schema-all.js +26 -21
  42. package/esm/configs/schema-recommended.js +53 -48
  43. package/esm/documents.js +3 -1
  44. package/esm/estree-converter/converter.js +1 -0
  45. package/esm/estree-converter/utils.js +2 -1
  46. package/esm/flat-configs.js +1 -0
  47. package/esm/graphql-config.js +1 -0
  48. package/esm/index.js +1 -0
  49. package/esm/parser.js +5 -3
  50. package/esm/processor.js +2 -1
  51. package/esm/rules/alphabetize.js +13 -9
  52. package/esm/rules/description-style.js +1 -0
  53. package/esm/rules/graphql-js-validation.js +14 -8
  54. package/esm/rules/index.js +1 -0
  55. package/esm/rules/input-name.js +1 -0
  56. package/esm/rules/lone-executable-definition.js +6 -3
  57. package/esm/rules/match-document-filename.js +3 -1
  58. package/esm/rules/naming-convention.js +3 -2
  59. package/esm/rules/no-anonymous-operations.js +1 -0
  60. package/esm/rules/no-case-insensitive-enum-values-duplicates.js +3 -1
  61. package/esm/rules/no-deprecated.js +5 -2
  62. package/esm/rules/no-duplicate-fields.js +1 -0
  63. package/esm/rules/no-hashtag-description.js +1 -0
  64. package/esm/rules/no-one-place-fragments.js +2 -1
  65. package/esm/rules/no-root-type.js +1 -0
  66. package/esm/rules/no-scalar-result-type-on-mutation.js +1 -0
  67. package/esm/rules/no-typename-prefix.js +1 -0
  68. package/esm/rules/no-unreachable-types.js +3 -2
  69. package/esm/rules/no-unused-fields.js +5 -2
  70. package/esm/rules/relay-arguments.js +3 -1
  71. package/esm/rules/relay-connection-types.js +9 -2
  72. package/esm/rules/relay-edge-types.js +8 -4
  73. package/esm/rules/relay-page-info.js +3 -1
  74. package/esm/rules/require-deprecation-date.js +4 -2
  75. package/esm/rules/require-deprecation-reason.js +3 -1
  76. package/esm/rules/require-description.js +4 -2
  77. package/esm/rules/require-field-of-type-query-in-mutation-result.js +2 -1
  78. package/esm/rules/require-id-when-available.js +1 -0
  79. package/esm/rules/require-import-fragment.js +3 -1
  80. package/esm/rules/require-nullable-fields-with-oneof.js +1 -0
  81. package/esm/rules/require-nullable-result-in-root.js +2 -1
  82. package/esm/rules/require-type-pattern-with-oneof.js +3 -1
  83. package/esm/rules/selection-set-depth.js +1 -0
  84. package/esm/rules/strict-id-in-types.js +5 -3
  85. package/esm/rules/unique-fragment-name.js +3 -1
  86. package/esm/rules/unique-operation-name.js +1 -0
  87. package/esm/schema.js +1 -0
  88. package/esm/siblings.js +9 -3
  89. package/esm/testkit.js +1 -0
  90. package/esm/utils.js +3 -1
  91. package/package.json +1 -4
@@ -1,3 +1,4 @@
1
+ import "../chunk-BMTV3EA2.js";
1
2
  import { Kind } from "graphql";
2
3
  import {
3
4
  ARRAY_DEFAULT_OPTIONS,
@@ -134,12 +135,13 @@ const rule = {
134
135
  const selector = `ObjectTypeDefinition[name.value!=/^(${rootTypeNames.join("|")})$/]`;
135
136
  return {
136
137
  [selector](node) {
138
+ var _a, _b, _c;
137
139
  const typeName = node.name.value;
138
- const shouldIgnoreNode = options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix));
140
+ const shouldIgnoreNode = ((_a = options.exceptions.types) == null ? void 0 : _a.includes(typeName)) || ((_b = options.exceptions.suffixes) == null ? void 0 : _b.some((suffix) => typeName.endsWith(suffix)));
139
141
  if (shouldIgnoreNode) {
140
142
  return;
141
143
  }
142
- const validIds = node.fields?.filter((field) => {
144
+ const validIds = (_c = node.fields) == null ? void 0 : _c.filter((field) => {
143
145
  const fieldNode = field.rawNode();
144
146
  const isValidIdName = options.acceptedIdNames.includes(fieldNode.name.value);
145
147
  let isValidIdType = false;
@@ -148,7 +150,7 @@ const rule = {
148
150
  }
149
151
  return isValidIdName && isValidIdType;
150
152
  });
151
- if (validIds?.length !== 1) {
153
+ if ((validIds == null ? void 0 : validIds.length) !== 1) {
152
154
  const pluralNamesSuffix = options.acceptedIdNames.length > 1 ? "s" : "";
153
155
  const pluralTypesSuffix = options.acceptedIdTypes.length > 1 ? "s" : "";
154
156
  context.report({
@@ -1,3 +1,4 @@
1
+ import "../chunk-BMTV3EA2.js";
1
2
  import { relative } from "path";
2
3
  import { Kind } from "graphql";
3
4
  import { CWD, normalizePath, requireSiblingsOperations, VIRTUAL_DOCUMENT_REGEX } from "../utils.js";
@@ -8,7 +9,8 @@ const checkNode = (context, node, ruleId) => {
8
9
  const siblingDocuments = node.kind === Kind.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName);
9
10
  const filepath = context.getFilename();
10
11
  const conflictingDocuments = siblingDocuments.filter((f) => {
11
- const isSameName = f.document.name?.value === documentName;
12
+ var _a;
13
+ const isSameName = ((_a = f.document.name) == null ? void 0 : _a.value) === documentName;
12
14
  const isSamePath = normalizePath(f.filePath) === normalizePath(filepath);
13
15
  return isSameName && !isSamePath;
14
16
  });
@@ -1,3 +1,4 @@
1
+ import "../chunk-BMTV3EA2.js";
1
2
  import { checkNode } from "./unique-fragment-name.js";
2
3
  const RULE_ID = "unique-operation-name";
3
4
  const rule = {
package/esm/schema.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import debugFactory from "debug";
2
3
  import fg from "fast-glob";
3
4
  import { GraphQLSchema } from "graphql";
package/esm/siblings.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import { parseGraphQLSDL } from "@graphql-tools/utils";
2
3
  import {
3
4
  Kind,
@@ -36,10 +37,11 @@ function getSiblings(project, documents) {
36
37
  }
37
38
  let fragmentsCache = null;
38
39
  const getFragments = () => {
40
+ var _a;
39
41
  if (fragmentsCache === null) {
40
42
  const result = [];
41
43
  for (const source of siblings) {
42
- for (const definition of source.document?.definitions || []) {
44
+ for (const definition of ((_a = source.document) == null ? void 0 : _a.definitions) || []) {
43
45
  if (definition.kind === Kind.FRAGMENT_DEFINITION) {
44
46
  result.push({
45
47
  filePath: source.location,
@@ -54,10 +56,11 @@ function getSiblings(project, documents) {
54
56
  };
55
57
  let cachedOperations = null;
56
58
  const getOperations = () => {
59
+ var _a;
57
60
  if (cachedOperations === null) {
58
61
  const result = [];
59
62
  for (const source of siblings) {
60
- for (const definition of source.document?.definitions || []) {
63
+ for (const definition of ((_a = source.document) == null ? void 0 : _a.definitions) || []) {
61
64
  if (definition.kind === Kind.OPERATION_DEFINITION) {
62
65
  result.push({
63
66
  filePath: source.location,
@@ -98,7 +101,10 @@ function getSiblings(project, documents) {
98
101
  getFragments,
99
102
  getFragmentByType: (typeName) => getFragments().filter((f) => f.document.typeCondition.name.value === typeName),
100
103
  getFragmentsInUse: (selectable, recursive = true) => Array.from(collectFragments(selectable, recursive).values()),
101
- getOperation: (name) => getOperations().filter((o) => o.document.name?.value === name),
104
+ getOperation: (name) => getOperations().filter((o) => {
105
+ var _a;
106
+ return ((_a = o.document.name) == null ? void 0 : _a.value) === name;
107
+ }),
102
108
  getOperations,
103
109
  getOperationByType: (type) => getOperations().filter((o) => o.document.operation === type)
104
110
  };
package/esm/testkit.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createRequire } from 'module';
2
2
  const require = createRequire(import.meta.url);
3
+ import "./chunk-BMTV3EA2.js";
3
4
  import { readFileSync } from "fs";
4
5
  import { resolve } from "path";
5
6
  import { codeFrameColumns } from "@babel/code-frame";
package/esm/utils.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import chalk from "chalk";
2
3
  import { Kind } from "graphql";
3
4
  import lowerCase from "lodash.lowercase";
@@ -109,7 +110,8 @@ const DisplayNodeNameMap = {
109
110
  [Kind.FIELD]: "field"
110
111
  };
111
112
  function displayNodeName(node) {
112
- return `${node.kind === Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
113
+ var _a, _b;
114
+ return `${node.kind === Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && ((_a = node.alias) == null ? void 0 : _a.value) || "name" in node && ((_b = node.name) == null ? void 0 : _b.value)}"`;
113
115
  }
114
116
  function getNodeName(node) {
115
117
  switch (node.kind) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.20.0-alpha-20230704095135-8d287d5",
3
+ "version": "3.20.1-alpha-20230713065115-b9bc635",
4
4
  "description": "GraphQL plugin for ESLint",
5
5
  "repository": "https://github.com/B2o5T/graphql-eslint",
6
6
  "author": "Dotan Simha <dotansimha@gmail.com>",
@@ -57,8 +57,5 @@
57
57
  "sideEffects": false,
58
58
  "typescript": {
59
59
  "definition": "cjs/index.d.ts"
60
- },
61
- "scripts": {
62
- "build": "tsup"
63
60
  }
64
61
  }