@graphql-eslint/eslint-plugin 4.0.0-alpha.14 → 4.0.0-alpha.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/cjs/cache.js +1 -2
  2. package/cjs/configs/index.d.cts +427 -10
  3. package/cjs/configs/index.js +1 -2
  4. package/cjs/configs/operations-all.d.cts +8 -8
  5. package/cjs/configs/operations-all.js +30 -33
  6. package/cjs/configs/operations-recommended.d.cts +35 -35
  7. package/cjs/configs/operations-recommended.js +56 -59
  8. package/cjs/configs/schema-all.d.cts +12 -12
  9. package/cjs/configs/schema-all.js +26 -29
  10. package/cjs/configs/schema-recommended.d.cts +23 -23
  11. package/cjs/configs/schema-recommended.js +70 -73
  12. package/cjs/configs/schema-relay.d.cts +5 -5
  13. package/cjs/configs/schema-relay.js +14 -17
  14. package/cjs/documents.js +1 -2
  15. package/cjs/estree-converter/converter.js +1 -2
  16. package/cjs/estree-converter/utils.js +1 -2
  17. package/cjs/graphql-config.d.cts +6 -1
  18. package/cjs/graphql-config.js +9 -3
  19. package/cjs/index.d.cts +433 -15
  20. package/cjs/index.js +1 -2
  21. package/cjs/meta.js +1 -2
  22. package/cjs/parser.js +2 -6
  23. package/cjs/processor.js +5 -2
  24. package/cjs/rules/alphabetize/index.js +1 -2
  25. package/cjs/rules/description-style/index.js +1 -2
  26. package/cjs/rules/graphql-js-validation.js +1 -2
  27. package/cjs/rules/index.d.cts +4 -4
  28. package/cjs/rules/index.js +1 -2
  29. package/cjs/rules/input-name/index.js +1 -2
  30. package/cjs/rules/lone-executable-definition/index.js +1 -2
  31. package/cjs/rules/match-document-filename/index.js +1 -2
  32. package/cjs/rules/naming-convention/index.js +1 -2
  33. package/cjs/rules/no-anonymous-operations/index.js +1 -2
  34. package/cjs/rules/no-deprecated/index.js +8 -6
  35. package/cjs/rules/no-duplicate-fields/index.js +1 -2
  36. package/cjs/rules/no-hashtag-description/index.js +1 -2
  37. package/cjs/rules/no-one-place-fragments/index.js +1 -2
  38. package/cjs/rules/no-root-type/index.js +1 -2
  39. package/cjs/rules/no-scalar-result-type-on-mutation/index.js +1 -2
  40. package/cjs/rules/no-typename-prefix/index.js +1 -2
  41. package/cjs/rules/no-unreachable-types/index.js +1 -2
  42. package/cjs/rules/no-unused-fields/index.js +1 -2
  43. package/cjs/rules/relay-arguments/index.js +1 -2
  44. package/cjs/rules/relay-connection-types/index.js +1 -2
  45. package/cjs/rules/relay-edge-types/index.js +1 -2
  46. package/cjs/rules/relay-page-info/index.js +1 -2
  47. package/cjs/rules/require-deprecation-date/index.js +1 -2
  48. package/cjs/rules/require-deprecation-reason/index.js +1 -2
  49. package/cjs/rules/require-description/index.js +1 -2
  50. package/cjs/rules/require-field-of-type-query-in-mutation-result/index.js +1 -2
  51. package/cjs/rules/require-import-fragment/index.js +1 -2
  52. package/cjs/rules/require-nullable-fields-with-oneof/index.js +1 -2
  53. package/cjs/rules/require-nullable-result-in-root/index.js +1 -2
  54. package/cjs/rules/require-selections/index.js +1 -2
  55. package/cjs/rules/require-type-pattern-with-oneof/index.js +1 -2
  56. package/cjs/rules/selection-set-depth/index.js +1 -2
  57. package/cjs/rules/strict-id-in-types/index.js +1 -2
  58. package/cjs/rules/unique-enum-value-names/index.js +1 -2
  59. package/cjs/rules/unique-fragment-name/index.js +1 -2
  60. package/cjs/rules/unique-operation-name/index.js +1 -2
  61. package/cjs/schema.js +1 -2
  62. package/cjs/siblings.js +1 -2
  63. package/cjs/utils.js +1 -2
  64. package/esm/cache.js +0 -1
  65. package/esm/configs/index.d.ts +427 -10
  66. package/esm/configs/index.js +0 -1
  67. package/esm/configs/operations-all.d.ts +7 -7
  68. package/esm/configs/operations-all.js +28 -33
  69. package/esm/configs/operations-recommended.d.ts +34 -34
  70. package/esm/configs/operations-recommended.js +54 -59
  71. package/esm/configs/schema-all.d.ts +11 -11
  72. package/esm/configs/schema-all.js +24 -29
  73. package/esm/configs/schema-recommended.d.ts +22 -22
  74. package/esm/configs/schema-recommended.js +68 -73
  75. package/esm/configs/schema-relay.d.ts +4 -4
  76. package/esm/configs/schema-relay.js +12 -17
  77. package/esm/documents.js +0 -1
  78. package/esm/estree-converter/converter.js +0 -1
  79. package/esm/estree-converter/utils.js +0 -1
  80. package/esm/graphql-config.d.ts +6 -1
  81. package/esm/graphql-config.js +8 -2
  82. package/esm/index.d.ts +433 -15
  83. package/esm/index.js +0 -1
  84. package/esm/meta.js +1 -2
  85. package/esm/parser.js +3 -7
  86. package/esm/processor.js +4 -1
  87. package/esm/rules/alphabetize/index.js +0 -1
  88. package/esm/rules/description-style/index.js +0 -1
  89. package/esm/rules/graphql-js-validation.js +0 -1
  90. package/esm/rules/index.d.ts +4 -4
  91. package/esm/rules/index.js +0 -1
  92. package/esm/rules/input-name/index.js +0 -1
  93. package/esm/rules/lone-executable-definition/index.js +0 -1
  94. package/esm/rules/match-document-filename/index.js +0 -1
  95. package/esm/rules/naming-convention/index.js +0 -1
  96. package/esm/rules/no-anonymous-operations/index.js +0 -1
  97. package/esm/rules/no-deprecated/index.js +7 -5
  98. package/esm/rules/no-duplicate-fields/index.js +0 -1
  99. package/esm/rules/no-hashtag-description/index.js +0 -1
  100. package/esm/rules/no-one-place-fragments/index.js +0 -1
  101. package/esm/rules/no-root-type/index.js +0 -1
  102. package/esm/rules/no-scalar-result-type-on-mutation/index.js +0 -1
  103. package/esm/rules/no-typename-prefix/index.js +0 -1
  104. package/esm/rules/no-unreachable-types/index.js +0 -1
  105. package/esm/rules/no-unused-fields/index.js +0 -1
  106. package/esm/rules/relay-arguments/index.js +0 -1
  107. package/esm/rules/relay-connection-types/index.js +0 -1
  108. package/esm/rules/relay-edge-types/index.js +0 -1
  109. package/esm/rules/relay-page-info/index.js +0 -1
  110. package/esm/rules/require-deprecation-date/index.js +0 -1
  111. package/esm/rules/require-deprecation-reason/index.js +0 -1
  112. package/esm/rules/require-description/index.js +0 -1
  113. package/esm/rules/require-field-of-type-query-in-mutation-result/index.js +0 -1
  114. package/esm/rules/require-import-fragment/index.js +0 -1
  115. package/esm/rules/require-nullable-fields-with-oneof/index.js +0 -1
  116. package/esm/rules/require-nullable-result-in-root/index.js +0 -1
  117. package/esm/rules/require-selections/index.js +0 -1
  118. package/esm/rules/require-type-pattern-with-oneof/index.js +0 -1
  119. package/esm/rules/selection-set-depth/index.js +0 -1
  120. package/esm/rules/strict-id-in-types/index.js +0 -1
  121. package/esm/rules/unique-enum-value-names/index.js +0 -1
  122. package/esm/rules/unique-fragment-name/index.js +0 -1
  123. package/esm/rules/unique-operation-name/index.js +0 -1
  124. package/esm/schema.js +0 -1
  125. package/esm/siblings.js +0 -1
  126. package/esm/utils.js +0 -1
  127. package/index.browser.js +210 -255
  128. package/package.json +1 -1
  129. package/cjs/chunk-UIAXBAMD.js +0 -8
  130. package/esm/chunk-UIAXBAMD.js +0 -8
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { displayNodeName, requireGraphQLSchemaFromContext } from "../../utils.js";
3
2
  const RULE_ID = "no-deprecated", rule = {
4
3
  meta: {
@@ -120,10 +119,13 @@ const RULE_ID = "no-deprecated", rule = {
120
119
  reason && report(node, reason);
121
120
  },
122
121
  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);
122
+ const { inputType } = node.typeInfo();
123
+ if (inputType && "getFields" in inputType) {
124
+ const fields = inputType.getFields();
125
+ for (const field of node.fields) {
126
+ const fieldName = field.name.value, reason = fields[fieldName].deprecationReason;
127
+ reason && report(field, reason);
128
+ }
127
129
  }
128
130
  }
129
131
  };
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  const RULE_ID = "no-duplicate-fields", rule = {
4
3
  meta: {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { TokenKind } from "graphql";
3
2
  import { getNodeName } from "../../utils.js";
4
3
  const RULE_ID = "HASHTAG_COMMENT", rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { relative } from "node:path";
3
2
  import { visit } from "graphql";
4
3
  import { CWD, requireSiblingsOperations } from "../../utils.js";
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { ARRAY_DEFAULT_OPTIONS, requireGraphQLSchemaFromContext, truthy } from "../../utils.js";
3
2
  const schema = {
4
3
  type: "array",
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { isScalarType, Kind } from "graphql";
3
2
  import { getNodeName, requireGraphQLSchemaFromContext } from "../../utils.js";
4
3
  const RULE_ID = "no-scalar-result-type-on-mutation", rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  const NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule = {
3
2
  meta: {
4
3
  type: "suggestion",
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import {
3
2
  DirectiveLocation,
4
3
  getNamedType,
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { TypeInfo, visit, visitWithTypeInfo } from "graphql";
3
2
  import { ModuleCache } from "../../cache.js";
4
3
  import { requireGraphQLSchemaFromContext, requireSiblingsOperations } from "../../utils.js";
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { isScalarType, Kind } from "graphql";
3
2
  import { requireGraphQLSchemaFromContext } from "../../utils.js";
4
3
  const RULE_ID = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  const 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 = [
4
3
  Kind.SCALAR_TYPE_DEFINITION,
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import {
3
2
  isObjectType,
4
3
  isScalarType,
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { isScalarType, Kind } from "graphql";
3
2
  import { REPORT_ON_FIRST_CHARACTER, requireGraphQLSchemaFromContext } from "../../utils.js";
4
3
  import { NON_OBJECT_TYPES } from "../relay-connection-types/index.js";
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { valueFromNode } from "../../estree-converter/index.js";
3
2
  import { getNodeName } from "../../utils.js";
4
3
  const DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIRE_DATE", MESSAGE_INVALID_FORMAT = "MESSAGE_INVALID_FORMAT", MESSAGE_INVALID_DATE = "MESSAGE_INVALID_DATE", MESSAGE_CAN_BE_REMOVED = "MESSAGE_CAN_BE_REMOVED", schema = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { valueFromNode } from "../../estree-converter/index.js";
3
2
  import { getNodeName } from "../../utils.js";
4
3
  const rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind, TokenKind } from "graphql";
3
2
  import { getRootTypeNames } from "@graphql-tools/utils";
4
3
  import {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { isObjectType } from "graphql";
3
2
  import { getTypeName, requireGraphQLSchemaFromContext } from "../../utils.js";
4
3
  const RULE_ID = "require-field-of-type-query-in-mutation-result", rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import path from "node:path";
3
2
  import { requireSiblingsOperations, slash } from "../../utils.js";
4
3
  const RULE_ID = "require-import-fragment", SUGGESTION_ID = "add-import-expression", rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  import { getNodeName } from "../../utils.js";
4
3
  const RULE_ID = "require-nullable-fields-with-oneof", rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  import { getNodeName, requireGraphQLSchemaFromContext, truthy } from "../../utils.js";
4
3
  const RULE_ID = "require-nullable-result-in-root", rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import {
3
2
  GraphQLInterfaceType,
4
3
  GraphQLObjectType,
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { displayNodeName } from "../../utils.js";
3
2
  const RULE_ID = "require-type-pattern-with-oneof", rule = {
4
3
  meta: {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  import depthLimit from "graphql-depth-limit";
4
3
  import { ARRAY_DEFAULT_OPTIONS, logger, requireSiblingsOperations } from "../../utils.js";
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  import {
4
3
  ARRAY_DEFAULT_OPTIONS,
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  import { getNodeName } from "../../utils.js";
4
3
  const rule = {
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { relative } from "node:path";
3
2
  import { Kind } from "graphql";
4
3
  import { CWD, requireSiblingsOperations, slash, VIRTUAL_DOCUMENT_REGEX } from "../../utils.js";
@@ -1,4 +1,3 @@
1
- import "../../chunk-UIAXBAMD.js";
2
1
  import { checkNode } from "../unique-fragment-name/index.js";
3
2
  const RULE_ID = "unique-operation-name", rule = {
4
3
  meta: {
package/esm/schema.js CHANGED
@@ -1,4 +1,3 @@
1
- import "./chunk-UIAXBAMD.js";
2
1
  import debugFactory from "debug";
3
2
  import fg from "fast-glob";
4
3
  import { GraphQLSchema } from "graphql";
package/esm/siblings.js CHANGED
@@ -1,4 +1,3 @@
1
- import "./chunk-UIAXBAMD.js";
2
1
  import {
3
2
  Kind,
4
3
  visit
package/esm/utils.js CHANGED
@@ -1,4 +1,3 @@
1
- import "./chunk-UIAXBAMD.js";
2
1
  import { Kind } from "graphql";
3
2
  import lowerCase from "lodash.lowercase";
4
3
  function requireSiblingsOperations(ruleId, context) {