@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
@@ -80,7 +80,7 @@ const rule = {
80
80
  continue;
81
81
  const name = field.gqlType.gqlType.name.value;
82
82
  const type = schema.getType(name);
83
- const resultType = type?.astNode ? (0, import_utils.getNodeName)(type.astNode) : type?.name;
83
+ const resultType = (type == null ? void 0 : type.astNode) ? (0, import_utils.getNodeName)(type.astNode) : type == null ? void 0 : type.name;
84
84
  context.report({
85
85
  node: field.gqlType,
86
86
  messageId: RULE_ID,
@@ -67,9 +67,10 @@ const rule = {
67
67
  "Directive[name.value=oneOf][parent.kind=ObjectTypeDefinition]"({
68
68
  parent
69
69
  }) {
70
+ var _a;
70
71
  const requiredFields = ["error", "ok"];
71
72
  for (const fieldName of requiredFields) {
72
- if (!parent.fields?.some((field) => field.name.value === fieldName)) {
73
+ if (!((_a = parent.fields) == null ? void 0 : _a.some((field) => field.name.value === fieldName))) {
73
74
  context.report({
74
75
  node: parent.name,
75
76
  messageId: RULE_ID,
@@ -151,12 +151,13 @@ const rule = {
151
151
  const selector = `ObjectTypeDefinition[name.value!=/^(${rootTypeNames.join("|")})$/]`;
152
152
  return {
153
153
  [selector](node) {
154
+ var _a, _b, _c;
154
155
  const typeName = node.name.value;
155
- const shouldIgnoreNode = options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix));
156
+ 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)));
156
157
  if (shouldIgnoreNode) {
157
158
  return;
158
159
  }
159
- const validIds = node.fields?.filter((field) => {
160
+ const validIds = (_c = node.fields) == null ? void 0 : _c.filter((field) => {
160
161
  const fieldNode = field.rawNode();
161
162
  const isValidIdName = options.acceptedIdNames.includes(fieldNode.name.value);
162
163
  let isValidIdType = false;
@@ -165,7 +166,7 @@ const rule = {
165
166
  }
166
167
  return isValidIdName && isValidIdType;
167
168
  });
168
- if (validIds?.length !== 1) {
169
+ if ((validIds == null ? void 0 : validIds.length) !== 1) {
169
170
  const pluralNamesSuffix = options.acceptedIdNames.length > 1 ? "s" : "";
170
171
  const pluralTypesSuffix = options.acceptedIdTypes.length > 1 ? "s" : "";
171
172
  context.report({
@@ -32,7 +32,8 @@ const checkNode = (context, node, ruleId) => {
32
32
  const siblingDocuments = node.kind === import_graphql.Kind.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName);
33
33
  const filepath = context.getFilename();
34
34
  const conflictingDocuments = siblingDocuments.filter((f) => {
35
- const isSameName = f.document.name?.value === documentName;
35
+ var _a;
36
+ const isSameName = ((_a = f.document.name) == null ? void 0 : _a.value) === documentName;
36
37
  const isSamePath = (0, import_utils.normalizePath)(f.filePath) === (0, import_utils.normalizePath)(filepath);
37
38
  return isSameName && !isSamePath;
38
39
  });
package/cjs/siblings.js CHANGED
@@ -56,10 +56,11 @@ function getSiblings(project, documents) {
56
56
  }
57
57
  let fragmentsCache = null;
58
58
  const getFragments = () => {
59
+ var _a;
59
60
  if (fragmentsCache === null) {
60
61
  const result = [];
61
62
  for (const source of siblings) {
62
- for (const definition of source.document?.definitions || []) {
63
+ for (const definition of ((_a = source.document) == null ? void 0 : _a.definitions) || []) {
63
64
  if (definition.kind === import_graphql.Kind.FRAGMENT_DEFINITION) {
64
65
  result.push({
65
66
  filePath: source.location,
@@ -74,10 +75,11 @@ function getSiblings(project, documents) {
74
75
  };
75
76
  let cachedOperations = null;
76
77
  const getOperations = () => {
78
+ var _a;
77
79
  if (cachedOperations === null) {
78
80
  const result = [];
79
81
  for (const source of siblings) {
80
- for (const definition of source.document?.definitions || []) {
82
+ for (const definition of ((_a = source.document) == null ? void 0 : _a.definitions) || []) {
81
83
  if (definition.kind === import_graphql.Kind.OPERATION_DEFINITION) {
82
84
  result.push({
83
85
  filePath: source.location,
@@ -118,7 +120,10 @@ function getSiblings(project, documents) {
118
120
  getFragments,
119
121
  getFragmentByType: (typeName) => getFragments().filter((f) => f.document.typeCondition.name.value === typeName),
120
122
  getFragmentsInUse: (selectable, recursive = true) => Array.from(collectFragments(selectable, recursive).values()),
121
- getOperation: (name) => getOperations().filter((o) => o.document.name?.value === name),
123
+ getOperation: (name) => getOperations().filter((o) => {
124
+ var _a;
125
+ return ((_a = o.document.name) == null ? void 0 : _a.value) === name;
126
+ }),
122
127
  getOperations,
123
128
  getOperationByType: (type) => getOperations().filter((o) => o.document.operation === type)
124
129
  };
package/cjs/utils.js CHANGED
@@ -159,7 +159,8 @@ const DisplayNodeNameMap = {
159
159
  [import_graphql.Kind.FIELD]: "field"
160
160
  };
161
161
  function displayNodeName(node) {
162
- return `${node.kind === import_graphql.Kind.OPERATION_DEFINITION ? node.operation : DisplayNodeNameMap[node.kind]} "${"alias" in node && node.alias?.value || "name" in node && node.name?.value}"`;
162
+ var _a, _b;
163
+ return `${node.kind === import_graphql.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)}"`;
163
164
  }
164
165
  function getNodeName(node) {
165
166
  switch (node.kind) {
package/esm/cache.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import debugFactory from "debug";
2
3
  const log = debugFactory("graphql-eslint:ModuleCache");
3
4
  class ModuleCache {
@@ -0,0 +1,8 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __commonJS = (cb, mod) => function __require() {
3
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
+ };
5
+
6
+ export {
7
+ __commonJS
8
+ };
@@ -1,3 +1,4 @@
1
+ import "../chunk-BMTV3EA2.js";
1
2
  import operationsAllConfig from "./operations-all.js";
2
3
  import operationsRecommendedConfig from "./operations-recommended.js";
3
4
  import relayConfig from "./relay.js";
@@ -1,29 +1,34 @@
1
- var operations_all_default = {
2
- extends: "./configs/operations-recommended",
3
- rules: {
4
- "@graphql-eslint/alphabetize": [
5
- "error",
6
- {
7
- selections: ["OperationDefinition", "FragmentDefinition"],
8
- variables: ["OperationDefinition"],
9
- arguments: ["Field", "Directive"]
1
+ import {
2
+ __commonJS
3
+ } from "../chunk-BMTV3EA2.js";
4
+ var require_operations_all = __commonJS({
5
+ "src/configs/operations-all.ts"(exports, module) {
6
+ module.exports = {
7
+ extends: "./configs/operations-recommended",
8
+ rules: {
9
+ "@graphql-eslint/alphabetize": [
10
+ "error",
11
+ {
12
+ selections: ["OperationDefinition", "FragmentDefinition"],
13
+ variables: ["OperationDefinition"],
14
+ arguments: ["Field", "Directive"]
15
+ }
16
+ ],
17
+ "@graphql-eslint/lone-executable-definition": "error",
18
+ "@graphql-eslint/match-document-filename": [
19
+ "error",
20
+ {
21
+ query: "kebab-case",
22
+ mutation: "kebab-case",
23
+ subscription: "kebab-case",
24
+ fragment: "kebab-case"
25
+ }
26
+ ],
27
+ "@graphql-eslint/no-one-place-fragments": "error",
28
+ "@graphql-eslint/unique-fragment-name": "error",
29
+ "@graphql-eslint/unique-operation-name": "error"
10
30
  }
11
- ],
12
- "@graphql-eslint/lone-executable-definition": "error",
13
- "@graphql-eslint/match-document-filename": [
14
- "error",
15
- {
16
- query: "kebab-case",
17
- mutation: "kebab-case",
18
- subscription: "kebab-case",
19
- fragment: "kebab-case"
20
- }
21
- ],
22
- "@graphql-eslint/no-one-place-fragments": "error",
23
- "@graphql-eslint/unique-fragment-name": "error",
24
- "@graphql-eslint/unique-operation-name": "error"
31
+ };
25
32
  }
26
- };
27
- export {
28
- operations_all_default as default
29
- };
33
+ });
34
+ export default require_operations_all();
@@ -1,54 +1,59 @@
1
- var operations_recommended_default = {
2
- parser: "@graphql-eslint/eslint-plugin",
3
- plugins: ["@graphql-eslint"],
4
- rules: {
5
- "@graphql-eslint/executable-definitions": "error",
6
- "@graphql-eslint/fields-on-correct-type": "error",
7
- "@graphql-eslint/fragments-on-composite-type": "error",
8
- "@graphql-eslint/known-argument-names": "error",
9
- "@graphql-eslint/known-directives": "error",
10
- "@graphql-eslint/known-fragment-names": "error",
11
- "@graphql-eslint/known-type-names": "error",
12
- "@graphql-eslint/lone-anonymous-operation": "error",
13
- "@graphql-eslint/naming-convention": [
14
- "error",
15
- {
16
- VariableDefinition: "camelCase",
17
- OperationDefinition: {
18
- style: "PascalCase",
19
- forbiddenPrefixes: ["Query", "Mutation", "Subscription", "Get"],
20
- forbiddenSuffixes: ["Query", "Mutation", "Subscription"]
21
- },
22
- FragmentDefinition: {
23
- style: "PascalCase",
24
- forbiddenPrefixes: ["Fragment"],
25
- forbiddenSuffixes: ["Fragment"]
26
- }
1
+ import {
2
+ __commonJS
3
+ } from "../chunk-BMTV3EA2.js";
4
+ var require_operations_recommended = __commonJS({
5
+ "src/configs/operations-recommended.ts"(exports, module) {
6
+ module.exports = {
7
+ parser: "@graphql-eslint/eslint-plugin",
8
+ plugins: ["@graphql-eslint"],
9
+ rules: {
10
+ "@graphql-eslint/executable-definitions": "error",
11
+ "@graphql-eslint/fields-on-correct-type": "error",
12
+ "@graphql-eslint/fragments-on-composite-type": "error",
13
+ "@graphql-eslint/known-argument-names": "error",
14
+ "@graphql-eslint/known-directives": "error",
15
+ "@graphql-eslint/known-fragment-names": "error",
16
+ "@graphql-eslint/known-type-names": "error",
17
+ "@graphql-eslint/lone-anonymous-operation": "error",
18
+ "@graphql-eslint/naming-convention": [
19
+ "error",
20
+ {
21
+ VariableDefinition: "camelCase",
22
+ OperationDefinition: {
23
+ style: "PascalCase",
24
+ forbiddenPrefixes: ["Query", "Mutation", "Subscription", "Get"],
25
+ forbiddenSuffixes: ["Query", "Mutation", "Subscription"]
26
+ },
27
+ FragmentDefinition: {
28
+ style: "PascalCase",
29
+ forbiddenPrefixes: ["Fragment"],
30
+ forbiddenSuffixes: ["Fragment"]
31
+ }
32
+ }
33
+ ],
34
+ "@graphql-eslint/no-anonymous-operations": "error",
35
+ "@graphql-eslint/no-deprecated": "error",
36
+ "@graphql-eslint/no-duplicate-fields": "error",
37
+ "@graphql-eslint/no-fragment-cycles": "error",
38
+ "@graphql-eslint/no-undefined-variables": "error",
39
+ "@graphql-eslint/no-unused-fragments": "error",
40
+ "@graphql-eslint/no-unused-variables": "error",
41
+ "@graphql-eslint/one-field-subscriptions": "error",
42
+ "@graphql-eslint/overlapping-fields-can-be-merged": "error",
43
+ "@graphql-eslint/possible-fragment-spread": "error",
44
+ "@graphql-eslint/provided-required-arguments": "error",
45
+ "@graphql-eslint/require-id-when-available": "error",
46
+ "@graphql-eslint/scalar-leafs": "error",
47
+ "@graphql-eslint/selection-set-depth": ["error", { maxDepth: 7 }],
48
+ "@graphql-eslint/unique-argument-names": "error",
49
+ "@graphql-eslint/unique-directive-names-per-location": "error",
50
+ "@graphql-eslint/unique-input-field-names": "error",
51
+ "@graphql-eslint/unique-variable-names": "error",
52
+ "@graphql-eslint/value-literals-of-correct-type": "error",
53
+ "@graphql-eslint/variables-are-input-types": "error",
54
+ "@graphql-eslint/variables-in-allowed-position": "error"
27
55
  }
28
- ],
29
- "@graphql-eslint/no-anonymous-operations": "error",
30
- "@graphql-eslint/no-deprecated": "error",
31
- "@graphql-eslint/no-duplicate-fields": "error",
32
- "@graphql-eslint/no-fragment-cycles": "error",
33
- "@graphql-eslint/no-undefined-variables": "error",
34
- "@graphql-eslint/no-unused-fragments": "error",
35
- "@graphql-eslint/no-unused-variables": "error",
36
- "@graphql-eslint/one-field-subscriptions": "error",
37
- "@graphql-eslint/overlapping-fields-can-be-merged": "error",
38
- "@graphql-eslint/possible-fragment-spread": "error",
39
- "@graphql-eslint/provided-required-arguments": "error",
40
- "@graphql-eslint/require-id-when-available": "error",
41
- "@graphql-eslint/scalar-leafs": "error",
42
- "@graphql-eslint/selection-set-depth": ["error", { maxDepth: 7 }],
43
- "@graphql-eslint/unique-argument-names": "error",
44
- "@graphql-eslint/unique-directive-names-per-location": "error",
45
- "@graphql-eslint/unique-input-field-names": "error",
46
- "@graphql-eslint/unique-variable-names": "error",
47
- "@graphql-eslint/value-literals-of-correct-type": "error",
48
- "@graphql-eslint/variables-are-input-types": "error",
49
- "@graphql-eslint/variables-in-allowed-position": "error"
56
+ };
50
57
  }
51
- };
52
- export {
53
- operations_recommended_default as default
54
- };
58
+ });
59
+ export default require_operations_recommended();
@@ -1,13 +1,18 @@
1
- var relay_default = {
2
- parser: "@graphql-eslint/eslint-plugin",
3
- plugins: ["@graphql-eslint"],
4
- rules: {
5
- "@graphql-eslint/relay-arguments": "error",
6
- "@graphql-eslint/relay-connection-types": "error",
7
- "@graphql-eslint/relay-edge-types": "error",
8
- "@graphql-eslint/relay-page-info": "error"
1
+ import {
2
+ __commonJS
3
+ } from "../chunk-BMTV3EA2.js";
4
+ var require_relay = __commonJS({
5
+ "src/configs/relay.ts"(exports, module) {
6
+ module.exports = {
7
+ parser: "@graphql-eslint/eslint-plugin",
8
+ plugins: ["@graphql-eslint"],
9
+ rules: {
10
+ "@graphql-eslint/relay-arguments": "error",
11
+ "@graphql-eslint/relay-connection-types": "error",
12
+ "@graphql-eslint/relay-edge-types": "error",
13
+ "@graphql-eslint/relay-page-info": "error"
14
+ }
15
+ };
9
16
  }
10
- };
11
- export {
12
- relay_default as default
13
- };
17
+ });
18
+ export default require_relay();
@@ -1,23 +1,28 @@
1
- var schema_all_default = {
2
- extends: "./configs/schema-recommended",
3
- rules: {
4
- "@graphql-eslint/alphabetize": [
5
- "error",
6
- {
7
- fields: ["ObjectTypeDefinition", "InterfaceTypeDefinition", "InputObjectTypeDefinition"],
8
- values: ["EnumTypeDefinition"],
9
- arguments: ["FieldDefinition", "Field", "DirectiveDefinition", "Directive"]
1
+ import {
2
+ __commonJS
3
+ } from "../chunk-BMTV3EA2.js";
4
+ var require_schema_all = __commonJS({
5
+ "src/configs/schema-all.ts"(exports, module) {
6
+ module.exports = {
7
+ extends: "./configs/schema-recommended",
8
+ rules: {
9
+ "@graphql-eslint/alphabetize": [
10
+ "error",
11
+ {
12
+ fields: ["ObjectTypeDefinition", "InterfaceTypeDefinition", "InputObjectTypeDefinition"],
13
+ values: ["EnumTypeDefinition"],
14
+ arguments: ["FieldDefinition", "Field", "DirectiveDefinition", "Directive"]
15
+ }
16
+ ],
17
+ "@graphql-eslint/input-name": "error",
18
+ "@graphql-eslint/no-scalar-result-type-on-mutation": "error",
19
+ "@graphql-eslint/require-deprecation-date": "error",
20
+ "@graphql-eslint/require-field-of-type-query-in-mutation-result": "error",
21
+ "@graphql-eslint/require-nullable-fields-with-oneof": "error",
22
+ "@graphql-eslint/require-nullable-result-in-root": "error",
23
+ "@graphql-eslint/require-type-pattern-with-oneof": "error"
10
24
  }
11
- ],
12
- "@graphql-eslint/input-name": "error",
13
- "@graphql-eslint/no-scalar-result-type-on-mutation": "error",
14
- "@graphql-eslint/require-deprecation-date": "error",
15
- "@graphql-eslint/require-field-of-type-query-in-mutation-result": "error",
16
- "@graphql-eslint/require-nullable-fields-with-oneof": "error",
17
- "@graphql-eslint/require-nullable-result-in-root": "error",
18
- "@graphql-eslint/require-type-pattern-with-oneof": "error"
25
+ };
19
26
  }
20
- };
21
- export {
22
- schema_all_default as default
23
- };
27
+ });
28
+ export default require_schema_all();
@@ -1,50 +1,55 @@
1
- var schema_recommended_default = {
2
- parser: "@graphql-eslint/eslint-plugin",
3
- plugins: ["@graphql-eslint"],
4
- rules: {
5
- "@graphql-eslint/description-style": "error",
6
- "@graphql-eslint/known-argument-names": "error",
7
- "@graphql-eslint/known-directives": "error",
8
- "@graphql-eslint/known-type-names": "error",
9
- "@graphql-eslint/lone-schema-definition": "error",
10
- "@graphql-eslint/naming-convention": [
11
- "error",
12
- {
13
- types: "PascalCase",
14
- FieldDefinition: "camelCase",
15
- InputValueDefinition: "camelCase",
16
- Argument: "camelCase",
17
- DirectiveDefinition: "camelCase",
18
- EnumValueDefinition: "UPPER_CASE",
19
- "FieldDefinition[parent.name.value=Query]": {
20
- forbiddenPrefixes: ["query", "get"],
21
- forbiddenSuffixes: ["Query"]
22
- },
23
- "FieldDefinition[parent.name.value=Mutation]": {
24
- forbiddenPrefixes: ["mutation"],
25
- forbiddenSuffixes: ["Mutation"]
26
- },
27
- "FieldDefinition[parent.name.value=Subscription]": {
28
- forbiddenPrefixes: ["subscription"],
29
- forbiddenSuffixes: ["Subscription"]
30
- }
1
+ import {
2
+ __commonJS
3
+ } from "../chunk-BMTV3EA2.js";
4
+ var require_schema_recommended = __commonJS({
5
+ "src/configs/schema-recommended.ts"(exports, module) {
6
+ module.exports = {
7
+ parser: "@graphql-eslint/eslint-plugin",
8
+ plugins: ["@graphql-eslint"],
9
+ rules: {
10
+ "@graphql-eslint/description-style": "error",
11
+ "@graphql-eslint/known-argument-names": "error",
12
+ "@graphql-eslint/known-directives": "error",
13
+ "@graphql-eslint/known-type-names": "error",
14
+ "@graphql-eslint/lone-schema-definition": "error",
15
+ "@graphql-eslint/naming-convention": [
16
+ "error",
17
+ {
18
+ types: "PascalCase",
19
+ FieldDefinition: "camelCase",
20
+ InputValueDefinition: "camelCase",
21
+ Argument: "camelCase",
22
+ DirectiveDefinition: "camelCase",
23
+ EnumValueDefinition: "UPPER_CASE",
24
+ "FieldDefinition[parent.name.value=Query]": {
25
+ forbiddenPrefixes: ["query", "get"],
26
+ forbiddenSuffixes: ["Query"]
27
+ },
28
+ "FieldDefinition[parent.name.value=Mutation]": {
29
+ forbiddenPrefixes: ["mutation"],
30
+ forbiddenSuffixes: ["Mutation"]
31
+ },
32
+ "FieldDefinition[parent.name.value=Subscription]": {
33
+ forbiddenPrefixes: ["subscription"],
34
+ forbiddenSuffixes: ["Subscription"]
35
+ }
36
+ }
37
+ ],
38
+ "@graphql-eslint/no-case-insensitive-enum-values-duplicates": "error",
39
+ "@graphql-eslint/no-hashtag-description": "error",
40
+ "@graphql-eslint/no-typename-prefix": "error",
41
+ "@graphql-eslint/no-unreachable-types": "error",
42
+ "@graphql-eslint/provided-required-arguments": "error",
43
+ "@graphql-eslint/require-deprecation-reason": "error",
44
+ "@graphql-eslint/require-description": ["error", { types: true, DirectiveDefinition: true }],
45
+ "@graphql-eslint/strict-id-in-types": "error",
46
+ "@graphql-eslint/unique-directive-names": "error",
47
+ "@graphql-eslint/unique-directive-names-per-location": "error",
48
+ "@graphql-eslint/unique-field-definition-names": "error",
49
+ "@graphql-eslint/unique-operation-types": "error",
50
+ "@graphql-eslint/unique-type-names": "error"
31
51
  }
32
- ],
33
- "@graphql-eslint/no-case-insensitive-enum-values-duplicates": "error",
34
- "@graphql-eslint/no-hashtag-description": "error",
35
- "@graphql-eslint/no-typename-prefix": "error",
36
- "@graphql-eslint/no-unreachable-types": "error",
37
- "@graphql-eslint/provided-required-arguments": "error",
38
- "@graphql-eslint/require-deprecation-reason": "error",
39
- "@graphql-eslint/require-description": ["error", { types: true, DirectiveDefinition: true }],
40
- "@graphql-eslint/strict-id-in-types": "error",
41
- "@graphql-eslint/unique-directive-names": "error",
42
- "@graphql-eslint/unique-directive-names-per-location": "error",
43
- "@graphql-eslint/unique-field-definition-names": "error",
44
- "@graphql-eslint/unique-operation-types": "error",
45
- "@graphql-eslint/unique-type-names": "error"
52
+ };
46
53
  }
47
- };
48
- export {
49
- schema_recommended_default as default
50
- };
54
+ });
55
+ export default require_schema_recommended();
package/esm/documents.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import { resolve } from "path";
2
3
  import debugFactory from "debug";
3
4
  import fg from "fast-glob";
@@ -7,11 +8,12 @@ const operationsCache = new ModuleCache();
7
8
  const handleVirtualPath = (documents) => {
8
9
  const filepathMap = /* @__PURE__ */ Object.create(null);
9
10
  return documents.map((source) => {
11
+ var _a;
10
12
  const location = source.location;
11
13
  if ([".gql", ".graphql"].some((extension) => location.endsWith(extension))) {
12
14
  return source;
13
15
  }
14
- filepathMap[location] ??= -1;
16
+ (_a = filepathMap[location]) != null ? _a : filepathMap[location] = -1;
15
17
  const index = filepathMap[location] += 1;
16
18
  return {
17
19
  ...source,
@@ -1,3 +1,4 @@
1
+ import "../chunk-BMTV3EA2.js";
1
2
  import {
2
3
  Kind,
3
4
  TypeInfo,
@@ -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 {
4
5
  isListType,
5
6
  isNonNullType,
@@ -41,7 +42,7 @@ function convertToken(token, type) {
41
42
  }
42
43
  function getLexer(source) {
43
44
  const gqlLanguage = require("graphql/language");
44
- if (gqlLanguage?.createLexer) {
45
+ if (gqlLanguage == null ? void 0 : gqlLanguage.createLexer) {
45
46
  return gqlLanguage.createLexer(source, {});
46
47
  }
47
48
  const { Lexer: LexerCls } = require("graphql");
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import { configs } from "./configs/index.js";
2
3
  import { parseForESLint } from "./parser.js";
3
4
  const languageOptions = {
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import { dirname } from "path";
2
3
  import { CodeFileLoader } from "@graphql-tools/code-file-loader";
3
4
  import debugFactory from "debug";
package/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import { processor } from "./processor.js";
2
3
  import { parseForESLint } from "./parser.js";
3
4
  import { rules } from "./rules/index.js";
package/esm/parser.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import { parseGraphQLSDL } from "@graphql-tools/utils";
2
3
  import debugFactory from "debug";
3
4
  import { buildSchema, GraphQLError } from "graphql";
@@ -9,9 +10,10 @@ import { CWD, VIRTUAL_DOCUMENT_REGEX } from "./utils.js";
9
10
  const debug = debugFactory("graphql-eslint:parser");
10
11
  debug("cwd %o", CWD);
11
12
  function parseForESLint(code, options) {
13
+ var _a, _b;
12
14
  try {
13
15
  const { filePath } = options;
14
- options.documents ||= options.operations;
16
+ options.documents || (options.documents = options.operations);
15
17
  const { document } = parseGraphQLSDL(filePath, code, {
16
18
  ...options.graphQLParserOptions,
17
19
  noLocation: false
@@ -49,9 +51,9 @@ function parseForESLint(code, options) {
49
51
  error.message = `[graphql-eslint] ${error.message}`;
50
52
  }
51
53
  if (error instanceof GraphQLError) {
52
- const location = error.locations?.[0];
54
+ const location = (_a = error.locations) == null ? void 0 : _a[0];
53
55
  const eslintError = {
54
- index: error.positions?.[0],
56
+ index: (_b = error.positions) == null ? void 0 : _b[0],
55
57
  ...location && {
56
58
  lineNumber: location.line,
57
59
  column: location.column - 1
package/esm/processor.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-BMTV3EA2.js";
1
2
  import { relative } from "path";
2
3
  import {
3
4
  gqlPluckFromCodeStringSync
@@ -17,7 +18,7 @@ const processor = {
17
18
  onDiskConfigLoaded = true;
18
19
  }
19
20
  let keywords = RELEVANT_KEYWORDS;
20
- const pluckConfig = onDiskConfig?.getProjectForFile(filePath).extensions.pluckConfig;
21
+ const pluckConfig = onDiskConfig == null ? void 0 : onDiskConfig.getProjectForFile(filePath).extensions.pluckConfig;
21
22
  if (pluckConfig) {
22
23
  const {
23
24
  modules = [],