@graphql-eslint/eslint-plugin 4.0.0-alpha.5 → 4.0.0-alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/cache.js +8 -36
- package/cjs/chunk-UIAXBAMD.js +8 -0
- package/cjs/configs/index.d.cts +15 -5
- package/cjs/configs/index.js +31 -45
- package/cjs/configs/operations-all.js +33 -26
- package/cjs/configs/operations-recommended.js +59 -52
- package/cjs/configs/schema-all.js +29 -22
- package/cjs/configs/schema-recommended.js +73 -66
- package/cjs/configs/schema-relay.js +17 -10
- package/cjs/documents.js +12 -37
- package/cjs/estree-converter/converter.js +16 -30
- package/cjs/estree-converter/index.js +3 -23
- package/cjs/estree-converter/types.js +1 -14
- package/cjs/estree-converter/utils.js +22 -40
- package/cjs/graphql-config.js +15 -41
- package/cjs/index.d.cts +165 -10
- package/cjs/index.js +24 -41
- package/cjs/meta.d.cts +1 -1
- package/cjs/meta.js +5 -34
- package/cjs/parser.d.cts +1 -1
- package/cjs/parser.js +29 -49
- package/cjs/processor.d.cts +1 -1
- package/cjs/processor.js +22 -35
- package/{esm/rules/alphabetize.d.ts → cjs/rules/alphabetize/index.d.cts} +3 -3
- package/cjs/rules/{alphabetize.js → alphabetize/index.js} +47 -71
- package/{esm/rules/description-style.d.ts → cjs/rules/description-style/index.d.cts} +3 -3
- package/cjs/rules/{description-style.js → description-style/index.js} +7 -27
- package/cjs/rules/graphql-js-validation.js +93 -70
- package/cjs/rules/index.d.cts +5 -5
- package/cjs/rules/index.js +74 -60
- package/{esm/rules/input-name.d.ts → cjs/rules/input-name/index.d.cts} +3 -3
- package/cjs/rules/{input-name.js → input-name/index.js} +10 -28
- package/{esm/rules/lone-executable-definition.d.ts → cjs/rules/lone-executable-definition/index.d.cts} +3 -3
- package/cjs/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +13 -32
- package/cjs/rules/{match-document-filename.d.cts → match-document-filename/index.d.cts} +4 -4
- package/cjs/rules/{match-document-filename.js → match-document-filename/index.js} +20 -34
- package/{esm/rules/naming-convention.d.ts → cjs/rules/naming-convention/index.d.cts} +3 -3
- package/cjs/rules/{naming-convention.js → naming-convention/index.js} +41 -54
- package/cjs/rules/no-anonymous-operations/index.d.cts +13 -0
- package/cjs/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +9 -28
- package/cjs/rules/{no-deprecated.d.cts → no-deprecated/index.d.cts} +3 -3
- package/cjs/rules/{no-deprecated.js → no-deprecated/index.js} +11 -30
- package/cjs/rules/no-duplicate-fields/index.d.cts +13 -0
- package/cjs/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +8 -28
- package/cjs/rules/{no-hashtag-description.d.cts → no-hashtag-description/index.d.cts} +3 -3
- package/cjs/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +11 -31
- package/cjs/rules/no-one-place-fragments/index.d.cts +13 -0
- package/cjs/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +11 -29
- package/cjs/rules/{no-root-type.d.cts → no-root-type/index.d.cts} +3 -3
- package/cjs/rules/{no-root-type.js → no-root-type/index.js} +9 -29
- package/cjs/rules/no-scalar-result-type-on-mutation/index.d.cts +13 -0
- package/cjs/rules/no-scalar-result-type-on-mutation/index.js +69 -0
- package/cjs/rules/no-typename-prefix/index.d.cts +13 -0
- package/cjs/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +5 -25
- package/cjs/rules/no-unreachable-types/index.d.cts +13 -0
- package/cjs/rules/no-unreachable-types/index.js +155 -0
- package/cjs/rules/no-unused-fields/index.d.cts +13 -0
- package/cjs/rules/{no-unused-fields.js → no-unused-fields/index.js} +12 -30
- package/{esm/rules/relay-arguments.d.ts → cjs/rules/relay-arguments/index.d.cts} +3 -3
- package/cjs/rules/{relay-arguments.js → relay-arguments/index.js} +11 -30
- package/{esm/rules/relay-connection-types.d.ts → cjs/rules/relay-connection-types/index.d.cts} +3 -3
- package/cjs/rules/{relay-connection-types.js → relay-connection-types/index.js} +19 -40
- package/{esm/rules/relay-edge-types.d.ts → cjs/rules/relay-edge-types/index.d.cts} +3 -3
- package/cjs/rules/{relay-edge-types.js → relay-edge-types/index.js} +30 -43
- package/cjs/rules/relay-page-info/index.d.cts +13 -0
- package/cjs/rules/{relay-page-info.js → relay-page-info/index.js} +12 -30
- package/{esm/rules/require-deprecation-date.d.ts → cjs/rules/require-deprecation-date/index.d.cts} +3 -3
- package/cjs/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +13 -32
- package/cjs/rules/require-deprecation-reason/index.d.cts +13 -0
- package/cjs/rules/require-deprecation-reason/index.js +66 -0
- package/cjs/rules/{require-description.d.cts → require-description/index.d.cts} +3 -3
- package/cjs/rules/{require-description.js → require-description/index.js} +30 -44
- package/cjs/rules/require-field-of-type-query-in-mutation-result/index.d.cts +13 -0
- package/cjs/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +10 -29
- package/cjs/rules/require-import-fragment/index.d.cts +13 -0
- package/cjs/rules/{require-import-fragment.js → require-import-fragment/index.js} +11 -38
- package/cjs/rules/require-nullable-fields-with-oneof/index.d.cts +13 -0
- package/cjs/rules/require-nullable-fields-with-oneof/index.js +62 -0
- package/cjs/rules/require-nullable-result-in-root/index.d.cts +13 -0
- package/cjs/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +12 -31
- package/cjs/rules/{require-selections.d.cts → require-selections/index.d.cts} +3 -3
- package/cjs/rules/{require-selections.js → require-selections/index.js} +38 -43
- package/cjs/rules/require-type-pattern-with-oneof/index.d.cts +13 -0
- package/cjs/rules/require-type-pattern-with-oneof/index.js +63 -0
- package/{esm/rules/selection-set-depth.d.ts → cjs/rules/selection-set-depth/index.d.cts} +3 -3
- package/cjs/rules/{selection-set-depth.js → selection-set-depth/index.js} +15 -41
- package/cjs/rules/{strict-id-in-types.d.cts → strict-id-in-types/index.d.cts} +3 -3
- package/cjs/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +26 -39
- package/cjs/rules/unique-enum-value-names/index.d.cts +13 -0
- package/cjs/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +10 -29
- package/{esm/rules/unique-fragment-name.d.ts → cjs/rules/unique-fragment-name/index.d.cts} +3 -3
- package/cjs/rules/unique-fragment-name/index.js +87 -0
- package/cjs/rules/unique-operation-name/index.d.cts +13 -0
- package/cjs/rules/{unique-operation-name.js → unique-operation-name/index.js} +7 -27
- package/cjs/schema.js +11 -36
- package/cjs/siblings.js +17 -33
- package/cjs/types.js +1 -14
- package/cjs/utils.d.cts +2 -2
- package/cjs/utils.js +71 -115
- package/esm/configs/index.d.ts +15 -5
- package/esm/configs/index.js +17 -7
- package/esm/index.d.ts +165 -10
- package/esm/index.js +9 -2
- package/esm/meta.d.ts +1 -1
- package/esm/meta.js +1 -2
- package/esm/parser.d.ts +1 -1
- package/esm/processor.d.ts +1 -1
- package/{cjs/rules/alphabetize.d.cts → esm/rules/alphabetize/index.d.ts} +3 -3
- package/esm/rules/{alphabetize.js → alphabetize/index.js} +2 -2
- package/{cjs/rules/description-style.d.cts → esm/rules/description-style/index.d.ts} +3 -3
- package/esm/rules/{description-style.js → description-style/index.js} +2 -2
- package/esm/rules/index.d.ts +5 -5
- package/esm/rules/index.js +34 -34
- package/{cjs/rules/input-name.d.cts → esm/rules/input-name/index.d.ts} +3 -3
- package/esm/rules/{input-name.js → input-name/index.js} +1 -1
- package/{cjs/rules/lone-executable-definition.d.cts → esm/rules/lone-executable-definition/index.d.ts} +3 -3
- package/esm/rules/{lone-executable-definition.js → lone-executable-definition/index.js} +2 -2
- package/esm/rules/{match-document-filename.d.ts → match-document-filename/index.d.ts} +4 -4
- package/esm/rules/{match-document-filename.js → match-document-filename/index.js} +2 -2
- package/{cjs/rules/naming-convention.d.cts → esm/rules/naming-convention/index.d.ts} +3 -3
- package/esm/rules/{naming-convention.js → naming-convention/index.js} +2 -2
- package/{cjs/rules/no-anonymous-operations.d.cts → esm/rules/no-anonymous-operations/index.d.ts} +3 -3
- package/esm/rules/{no-anonymous-operations.js → no-anonymous-operations/index.js} +2 -2
- package/esm/rules/{no-deprecated.d.ts → no-deprecated/index.d.ts} +3 -3
- package/esm/rules/{no-deprecated.js → no-deprecated/index.js} +2 -2
- package/{cjs/rules/no-one-place-fragments.d.cts → esm/rules/no-duplicate-fields/index.d.ts} +3 -3
- package/esm/rules/{no-duplicate-fields.js → no-duplicate-fields/index.js} +1 -1
- package/esm/rules/{no-hashtag-description.d.ts → no-hashtag-description/index.d.ts} +3 -3
- package/esm/rules/{no-hashtag-description.js → no-hashtag-description/index.js} +2 -2
- package/{cjs/rules/no-duplicate-fields.d.cts → esm/rules/no-one-place-fragments/index.d.ts} +3 -3
- package/esm/rules/{no-one-place-fragments.js → no-one-place-fragments/index.js} +2 -2
- package/esm/rules/{no-root-type.d.ts → no-root-type/index.d.ts} +3 -3
- package/esm/rules/{no-root-type.js → no-root-type/index.js} +2 -2
- package/{cjs/rules/no-scalar-result-type-on-mutation.d.cts → esm/rules/no-scalar-result-type-on-mutation/index.d.ts} +3 -3
- package/esm/rules/{no-scalar-result-type-on-mutation.js → no-scalar-result-type-on-mutation/index.js} +2 -2
- package/esm/rules/no-typename-prefix/index.d.ts +13 -0
- package/esm/rules/{no-typename-prefix.js → no-typename-prefix/index.js} +1 -1
- package/esm/rules/no-unreachable-types/index.d.ts +13 -0
- package/esm/rules/{no-unreachable-types.js → no-unreachable-types/index.js} +3 -3
- package/esm/rules/no-unused-fields/index.d.ts +13 -0
- package/esm/rules/{no-unused-fields.js → no-unused-fields/index.js} +3 -3
- package/{cjs/rules/relay-arguments.d.cts → esm/rules/relay-arguments/index.d.ts} +3 -3
- package/esm/rules/{relay-arguments.js → relay-arguments/index.js} +2 -2
- package/{cjs/rules/relay-connection-types.d.cts → esm/rules/relay-connection-types/index.d.ts} +3 -3
- package/esm/rules/{relay-connection-types.js → relay-connection-types/index.js} +1 -1
- package/{cjs/rules/relay-edge-types.d.cts → esm/rules/relay-edge-types/index.d.ts} +3 -3
- package/esm/rules/{relay-edge-types.js → relay-edge-types/index.js} +2 -2
- package/esm/rules/relay-page-info/index.d.ts +13 -0
- package/esm/rules/{relay-page-info.js → relay-page-info/index.js} +3 -3
- package/{cjs/rules/require-deprecation-date.d.cts → esm/rules/require-deprecation-date/index.d.ts} +3 -3
- package/esm/rules/{require-deprecation-date.js → require-deprecation-date/index.js} +3 -3
- package/esm/rules/require-deprecation-reason/index.d.ts +13 -0
- package/esm/rules/{require-deprecation-reason.js → require-deprecation-reason/index.js} +3 -3
- package/esm/rules/{require-description.d.ts → require-description/index.d.ts} +3 -3
- package/esm/rules/{require-description.js → require-description/index.js} +2 -2
- package/esm/rules/require-field-of-type-query-in-mutation-result/index.d.ts +13 -0
- package/esm/rules/{require-field-of-type-query-in-mutation-result.js → require-field-of-type-query-in-mutation-result/index.js} +2 -2
- package/esm/rules/require-import-fragment/index.d.ts +13 -0
- package/esm/rules/{require-import-fragment.js → require-import-fragment/index.js} +2 -2
- package/esm/rules/require-nullable-fields-with-oneof/index.d.ts +13 -0
- package/esm/rules/{require-nullable-fields-with-oneof.js → require-nullable-fields-with-oneof/index.js} +2 -2
- package/esm/rules/require-nullable-result-in-root/index.d.ts +13 -0
- package/esm/rules/{require-nullable-result-in-root.js → require-nullable-result-in-root/index.js} +2 -2
- package/esm/rules/{require-selections.d.ts → require-selections/index.d.ts} +3 -3
- package/esm/rules/{require-selections.js → require-selections/index.js} +3 -4
- package/esm/rules/require-type-pattern-with-oneof/index.d.ts +13 -0
- package/esm/rules/{require-type-pattern-with-oneof.js → require-type-pattern-with-oneof/index.js} +2 -2
- package/{cjs/rules/selection-set-depth.d.cts → esm/rules/selection-set-depth/index.d.ts} +3 -3
- package/esm/rules/{selection-set-depth.js → selection-set-depth/index.js} +2 -2
- package/esm/rules/{strict-id-in-types.d.ts → strict-id-in-types/index.d.ts} +3 -3
- package/esm/rules/{strict-id-in-types.js → strict-id-in-types/index.js} +2 -2
- package/esm/rules/unique-enum-value-names/index.d.ts +13 -0
- package/esm/rules/{unique-enum-value-names.js → unique-enum-value-names/index.js} +2 -2
- package/{cjs/rules/unique-fragment-name.d.cts → esm/rules/unique-fragment-name/index.d.ts} +3 -3
- package/esm/rules/{unique-fragment-name.js → unique-fragment-name/index.js} +3 -3
- package/esm/rules/unique-operation-name/index.d.ts +13 -0
- package/esm/rules/{unique-operation-name.js → unique-operation-name/index.js} +2 -2
- package/esm/utils.d.ts +2 -2
- package/esm/utils.js +2 -2
- package/index.browser.js +54 -115
- package/package.json +2 -2
- package/cjs/rules/no-scalar-result-type-on-mutation.js +0 -88
- package/cjs/rules/no-typename-prefix.d.cts +0 -13
- package/cjs/rules/no-unreachable-types.d.cts +0 -13
- package/cjs/rules/no-unreachable-types.js +0 -175
- package/cjs/rules/no-unused-fields.d.cts +0 -13
- package/cjs/rules/relay-page-info.d.cts +0 -13
- package/cjs/rules/require-deprecation-reason.d.cts +0 -13
- package/cjs/rules/require-deprecation-reason.js +0 -85
- package/cjs/rules/require-field-of-type-query-in-mutation-result.d.cts +0 -13
- package/cjs/rules/require-import-fragment.d.cts +0 -13
- package/cjs/rules/require-nullable-fields-with-oneof.d.cts +0 -13
- package/cjs/rules/require-nullable-fields-with-oneof.js +0 -81
- package/cjs/rules/require-nullable-result-in-root.d.cts +0 -13
- package/cjs/rules/require-type-pattern-with-oneof.d.cts +0 -13
- package/cjs/rules/require-type-pattern-with-oneof.js +0 -83
- package/cjs/rules/unique-enum-value-names.d.cts +0 -13
- package/cjs/rules/unique-fragment-name.js +0 -106
- package/cjs/rules/unique-operation-name.d.cts +0 -13
- package/esm/rules/no-anonymous-operations.d.ts +0 -13
- package/esm/rules/no-duplicate-fields.d.ts +0 -13
- package/esm/rules/no-one-place-fragments.d.ts +0 -13
- package/esm/rules/no-scalar-result-type-on-mutation.d.ts +0 -13
- package/esm/rules/no-typename-prefix.d.ts +0 -13
- package/esm/rules/no-unreachable-types.d.ts +0 -13
- package/esm/rules/no-unused-fields.d.ts +0 -13
- package/esm/rules/relay-page-info.d.ts +0 -13
- package/esm/rules/require-deprecation-reason.d.ts +0 -13
- package/esm/rules/require-field-of-type-query-in-mutation-result.d.ts +0 -13
- package/esm/rules/require-import-fragment.d.ts +0 -13
- package/esm/rules/require-nullable-fields-with-oneof.d.ts +0 -13
- package/esm/rules/require-nullable-result-in-root.d.ts +0 -13
- package/esm/rules/require-type-pattern-with-oneof.d.ts +0 -13
- package/esm/rules/unique-enum-value-names.d.ts +0 -13
- package/esm/rules/unique-operation-name.d.ts +0 -13
@@ -1,10 +1,10 @@
|
|
1
|
-
import "
|
1
|
+
import "../../chunk-UIAXBAMD.js";
|
2
2
|
import { relative } from "node:path";
|
3
3
|
import { Kind } from "graphql";
|
4
|
-
import { CWD,
|
4
|
+
import { CWD, requireSiblingsOperations, slash, VIRTUAL_DOCUMENT_REGEX } from "../../utils.js";
|
5
5
|
const RULE_ID = "unique-fragment-name", checkNode = (context, node, ruleId) => {
|
6
6
|
const documentName = node.name.value, siblings = requireSiblingsOperations(ruleId, context), siblingDocuments = node.kind === Kind.FRAGMENT_DEFINITION ? siblings.getFragment(documentName) : siblings.getOperation(documentName), filepath = context.filename, conflictingDocuments = siblingDocuments.filter((f) => {
|
7
|
-
const isSameName = f.document.name?.value === documentName, isSamePath =
|
7
|
+
const isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
|
8
8
|
return isSameName && !isSamePath;
|
9
9
|
});
|
10
10
|
conflictingDocuments.length > 0 && context.report({
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { GraphQLESLintRule } from '../../types.js';
|
2
|
+
import 'eslint';
|
3
|
+
import 'estree';
|
4
|
+
import 'graphql';
|
5
|
+
import 'graphql-config';
|
6
|
+
import 'json-schema-to-ts';
|
7
|
+
import '../../estree-converter/types.js';
|
8
|
+
import '../../siblings.js';
|
9
|
+
import '@graphql-tools/utils';
|
10
|
+
|
11
|
+
declare const rule: GraphQLESLintRule;
|
12
|
+
|
13
|
+
export { rule };
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import "
|
2
|
-
import { checkNode } from "
|
1
|
+
import "../../chunk-UIAXBAMD.js";
|
2
|
+
import { checkNode } from "../unique-fragment-name/index.js";
|
3
3
|
const RULE_ID = "unique-operation-name", rule = {
|
4
4
|
meta: {
|
5
5
|
type: "suggestion",
|
package/esm/utils.d.ts
CHANGED
@@ -14,7 +14,7 @@ declare const logger: {
|
|
14
14
|
error: (...args: unknown[]) => void;
|
15
15
|
warn: (...args: unknown[]) => void;
|
16
16
|
};
|
17
|
-
declare const
|
17
|
+
declare const slash: (path: string) => string;
|
18
18
|
declare const VIRTUAL_DOCUMENT_REGEX: RegExp;
|
19
19
|
declare const CWD: string;
|
20
20
|
declare const getTypeName: (node: ASTNode) => string;
|
@@ -42,4 +42,4 @@ declare function truthy<T>(value: T): value is Truthy<T>;
|
|
42
42
|
declare function displayNodeName(node: GraphQLESTreeNode<ASTNode>): string;
|
43
43
|
declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
|
44
44
|
|
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,
|
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
@@ -29,7 +29,7 @@ const chalk = {
|
|
29
29
|
// eslint-disable-next-line no-console
|
30
30
|
console.warn(chalk.yellow("warning"), "[graphql-eslint]", ...args)
|
31
31
|
)
|
32
|
-
},
|
32
|
+
}, slash = (path) => path.replaceAll("\\", "/"), VIRTUAL_DOCUMENT_REGEX = /[\/\\]\d+_document.graphql$/, CWD = process.cwd(), getTypeName = (node) => "type" in node ? getTypeName(node.type) : "name" in node && node.name ? node.name.value : "", TYPES_KINDS = [
|
33
33
|
Kind.OBJECT_TYPE_DEFINITION,
|
34
34
|
Kind.INTERFACE_TYPE_DEFINITION,
|
35
35
|
Kind.ENUM_TYPE_DEFINITION,
|
@@ -136,9 +136,9 @@ export {
|
|
136
136
|
getNodeName,
|
137
137
|
getTypeName,
|
138
138
|
logger,
|
139
|
-
normalizePath,
|
140
139
|
pascalCase,
|
141
140
|
requireGraphQLSchemaFromContext,
|
142
141
|
requireSiblingsOperations,
|
142
|
+
slash,
|
143
143
|
truthy
|
144
144
|
};
|
package/index.browser.js
CHANGED
@@ -387,78 +387,8 @@ function convertToESTree(node, schema15) {
|
|
387
387
|
);
|
388
388
|
}
|
389
389
|
|
390
|
-
// package.json
|
391
|
-
var package_default = {
|
392
|
-
name: "@graphql-eslint/eslint-plugin",
|
393
|
-
version: "4.0.0-alpha.5",
|
394
|
-
type: "module",
|
395
|
-
description: "GraphQL plugin for ESLint",
|
396
|
-
repository: "https://github.com/B2o5T/graphql-eslint",
|
397
|
-
author: "Dotan Simha <dotansimha@gmail.com>",
|
398
|
-
license: "MIT",
|
399
|
-
engines: {
|
400
|
-
node: ">=18"
|
401
|
-
},
|
402
|
-
exports: {
|
403
|
-
"./package.json": "./package.json",
|
404
|
-
".": {
|
405
|
-
require: {
|
406
|
-
types: "./dist/cjs/index.d.cts",
|
407
|
-
default: "./dist/cjs/index.js"
|
408
|
-
},
|
409
|
-
import: {
|
410
|
-
types: "./dist/esm/index.d.ts",
|
411
|
-
default: "./dist/esm/index.js"
|
412
|
-
}
|
413
|
-
}
|
414
|
-
},
|
415
|
-
types: "dist/esm/index.d.ts",
|
416
|
-
keywords: [
|
417
|
-
"eslint",
|
418
|
-
"eslintplugin",
|
419
|
-
"eslint-plugin",
|
420
|
-
"graphql"
|
421
|
-
],
|
422
|
-
scripts: {
|
423
|
-
build: "tsup",
|
424
|
-
test: "vitest",
|
425
|
-
typecheck: "tsc --noEmit"
|
426
|
-
},
|
427
|
-
peerDependencies: {
|
428
|
-
eslint: ">=8.44.0",
|
429
|
-
graphql: "^16"
|
430
|
-
},
|
431
|
-
dependencies: {
|
432
|
-
"@graphql-tools/code-file-loader": "^8.0.0",
|
433
|
-
"@graphql-tools/graphql-tag-pluck": "8.3.2",
|
434
|
-
"@graphql-tools/utils": "^10.0.0",
|
435
|
-
debug: "^4.3.4",
|
436
|
-
"fast-glob": "^3.2.12",
|
437
|
-
"graphql-config": "^5.1.0",
|
438
|
-
"graphql-depth-limit": "^1.1.0",
|
439
|
-
"lodash.lowercase": "^4.3.0"
|
440
|
-
},
|
441
|
-
devDependencies: {
|
442
|
-
"@theguild/eslint-rule-tester": "workspace:*",
|
443
|
-
"@types/debug": "4.1.12",
|
444
|
-
"@types/eslint": "9.6.1",
|
445
|
-
"@types/estree": "1.0.6",
|
446
|
-
"@types/graphql-depth-limit": "1.1.6",
|
447
|
-
"@types/json-schema": "7.0.15",
|
448
|
-
"@types/lodash.lowercase": "4.3.9",
|
449
|
-
graphql: "16.9.0",
|
450
|
-
"json-schema-to-ts": "3.1.1",
|
451
|
-
"vite-tsconfig-paths": "^5.0.0"
|
452
|
-
},
|
453
|
-
publishConfig: {
|
454
|
-
directory: "dist",
|
455
|
-
access: "public"
|
456
|
-
},
|
457
|
-
sideEffects: !1
|
458
|
-
};
|
459
|
-
|
460
390
|
// src/meta.ts
|
461
|
-
var
|
391
|
+
var version = process.env.VERSION;
|
462
392
|
|
463
393
|
// src/siblings.ts
|
464
394
|
import {
|
@@ -497,7 +427,7 @@ var chalk = {
|
|
497
427
|
// eslint-disable-next-line no-console
|
498
428
|
console.warn(chalk.yellow("warning"), "[graphql-eslint]", ...args)
|
499
429
|
)
|
500
|
-
},
|
430
|
+
}, slash = (path2) => path2.replaceAll("\\", "/"), VIRTUAL_DOCUMENT_REGEX = /[\/\\]\d+_document.graphql$/, CWD = process.cwd(), getTypeName = (node) => "type" in node ? getTypeName(node.type) : "name" in node && node.name ? node.name.value : "", TYPES_KINDS = [
|
501
431
|
Kind2.OBJECT_TYPE_DEFINITION,
|
502
432
|
Kind2.INTERFACE_TYPE_DEFINITION,
|
503
433
|
Kind2.ENUM_TYPE_DEFINITION,
|
@@ -734,7 +664,7 @@ var parser = {
|
|
734
664
|
}
|
735
665
|
};
|
736
666
|
|
737
|
-
// src/rules/alphabetize.ts
|
667
|
+
// src/rules/alphabetize/index.ts
|
738
668
|
import {
|
739
669
|
Kind as Kind4
|
740
670
|
} from "graphql";
|
@@ -1029,7 +959,7 @@ var RULE_ID = "alphabetize", fieldsEnum = [
|
|
1029
959
|
}
|
1030
960
|
};
|
1031
961
|
|
1032
|
-
// src/rules/description-style.ts
|
962
|
+
// src/rules/description-style/index.ts
|
1033
963
|
var schema2 = {
|
1034
964
|
type: "array",
|
1035
965
|
maxItems: 1,
|
@@ -1717,7 +1647,7 @@ var getFragmentDefsAndFragmentSpreads = (node) => {
|
|
1717
1647
|
)
|
1718
1648
|
);
|
1719
1649
|
|
1720
|
-
// src/rules/input-name.ts
|
1650
|
+
// src/rules/input-name/index.ts
|
1721
1651
|
import {
|
1722
1652
|
Kind as Kind6
|
1723
1653
|
} from "graphql";
|
@@ -1851,7 +1781,7 @@ Using the same name for all input parameters will make your schemas easier to co
|
|
1851
1781
|
}
|
1852
1782
|
};
|
1853
1783
|
|
1854
|
-
// src/rules/lone-executable-definition.ts
|
1784
|
+
// src/rules/lone-executable-definition/index.ts
|
1855
1785
|
import { OperationTypeNode as OperationTypeNode2 } from "graphql";
|
1856
1786
|
var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...Object.values(OperationTypeNode2)], schema4 = {
|
1857
1787
|
type: "array",
|
@@ -1933,7 +1863,7 @@ var RULE_ID2 = "lone-executable-definition", definitionTypes = ["fragment", ...O
|
|
1933
1863
|
}
|
1934
1864
|
};
|
1935
1865
|
|
1936
|
-
// src/rules/match-document-filename.ts
|
1866
|
+
// src/rules/match-document-filename/index.ts
|
1937
1867
|
import { basename, extname } from "node:path";
|
1938
1868
|
import { Kind as Kind7 } from "graphql";
|
1939
1869
|
var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLES = [
|
@@ -2161,7 +2091,7 @@ var MATCH_EXTENSION = "MATCH_EXTENSION", MATCH_STYLE = "MATCH_STYLE", CASE_STYLE
|
|
2161
2091
|
}
|
2162
2092
|
};
|
2163
2093
|
|
2164
|
-
// src/rules/naming-convention.ts
|
2094
|
+
// src/rules/naming-convention/index.ts
|
2165
2095
|
import { Kind as Kind8 } from "graphql";
|
2166
2096
|
var KindToDisplayName = {
|
2167
2097
|
// types
|
@@ -2555,7 +2485,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
2555
2485
|
}
|
2556
2486
|
};
|
2557
2487
|
|
2558
|
-
// src/rules/no-anonymous-operations.ts
|
2488
|
+
// src/rules/no-anonymous-operations/index.ts
|
2559
2489
|
import { Kind as Kind9 } from "graphql";
|
2560
2490
|
var RULE_ID3 = "no-anonymous-operations", rule7 = {
|
2561
2491
|
meta: {
|
@@ -2624,7 +2554,7 @@ var RULE_ID3 = "no-anonymous-operations", rule7 = {
|
|
2624
2554
|
}
|
2625
2555
|
};
|
2626
2556
|
|
2627
|
-
// src/rules/no-deprecated.ts
|
2557
|
+
// src/rules/no-deprecated/index.ts
|
2628
2558
|
import { Kind as Kind10 } from "graphql";
|
2629
2559
|
var RULE_ID4 = "no-deprecated", rule8 = {
|
2630
2560
|
meta: {
|
@@ -2745,7 +2675,7 @@ var RULE_ID4 = "no-deprecated", rule8 = {
|
|
2745
2675
|
}
|
2746
2676
|
};
|
2747
2677
|
|
2748
|
-
// src/rules/no-duplicate-fields.ts
|
2678
|
+
// src/rules/no-duplicate-fields/index.ts
|
2749
2679
|
import { Kind as Kind11 } from "graphql";
|
2750
2680
|
var RULE_ID5 = "no-duplicate-fields", rule9 = {
|
2751
2681
|
meta: {
|
@@ -2859,7 +2789,7 @@ var RULE_ID5 = "no-duplicate-fields", rule9 = {
|
|
2859
2789
|
}
|
2860
2790
|
};
|
2861
2791
|
|
2862
|
-
// src/rules/no-hashtag-description.ts
|
2792
|
+
// src/rules/no-hashtag-description/index.ts
|
2863
2793
|
import { TokenKind as TokenKind2 } from "graphql";
|
2864
2794
|
var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
|
2865
2795
|
meta: {
|
@@ -2962,7 +2892,7 @@ var RULE_ID6 = "HASHTAG_COMMENT", rule10 = {
|
|
2962
2892
|
}
|
2963
2893
|
};
|
2964
2894
|
|
2965
|
-
// src/rules/no-one-place-fragments.ts
|
2895
|
+
// src/rules/no-one-place-fragments/index.ts
|
2966
2896
|
import { relative } from "node:path";
|
2967
2897
|
import { visit as visit4 } from "graphql";
|
2968
2898
|
var RULE_ID7 = "no-one-place-fragments", rule11 = {
|
@@ -3042,7 +2972,7 @@ var RULE_ID7 = "no-one-place-fragments", rule11 = {
|
|
3042
2972
|
}
|
3043
2973
|
};
|
3044
2974
|
|
3045
|
-
// src/rules/no-root-type.ts
|
2975
|
+
// src/rules/no-root-type/index.ts
|
3046
2976
|
var schema7 = {
|
3047
2977
|
type: "array",
|
3048
2978
|
minItems: 1,
|
@@ -3122,7 +3052,7 @@ var schema7 = {
|
|
3122
3052
|
}
|
3123
3053
|
};
|
3124
3054
|
|
3125
|
-
// src/rules/no-scalar-result-type-on-mutation.ts
|
3055
|
+
// src/rules/no-scalar-result-type-on-mutation/index.ts
|
3126
3056
|
import { isScalarType, Kind as Kind12 } from "graphql";
|
3127
3057
|
var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
|
3128
3058
|
meta: {
|
@@ -3188,7 +3118,7 @@ var RULE_ID8 = "no-scalar-result-type-on-mutation", rule13 = {
|
|
3188
3118
|
}
|
3189
3119
|
};
|
3190
3120
|
|
3191
|
-
// src/rules/no-typename-prefix.ts
|
3121
|
+
// src/rules/no-typename-prefix/index.ts
|
3192
3122
|
var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
|
3193
3123
|
meta: {
|
3194
3124
|
type: "suggestion",
|
@@ -3257,7 +3187,7 @@ var NO_TYPENAME_PREFIX = "NO_TYPENAME_PREFIX", rule14 = {
|
|
3257
3187
|
}
|
3258
3188
|
};
|
3259
3189
|
|
3260
|
-
// src/rules/no-unreachable-types.ts
|
3190
|
+
// src/rules/no-unreachable-types/index.ts
|
3261
3191
|
import {
|
3262
3192
|
DirectiveLocation,
|
3263
3193
|
isInterfaceType,
|
@@ -3408,7 +3338,7 @@ var rule15 = {
|
|
3408
3338
|
}
|
3409
3339
|
};
|
3410
3340
|
|
3411
|
-
// src/rules/no-unused-fields.ts
|
3341
|
+
// src/rules/no-unused-fields/index.ts
|
3412
3342
|
import { TypeInfo as TypeInfo2, visit as visit6, visitWithTypeInfo as visitWithTypeInfo2 } from "graphql";
|
3413
3343
|
var RULE_ID10 = "no-unused-fields", usedFieldsCache = new ModuleCache();
|
3414
3344
|
function getUsedFields(schema15, operations) {
|
@@ -3518,7 +3448,7 @@ var rule16 = {
|
|
3518
3448
|
}
|
3519
3449
|
};
|
3520
3450
|
|
3521
|
-
// src/rules/relay-arguments.ts
|
3451
|
+
// src/rules/relay-arguments/index.ts
|
3522
3452
|
import { isScalarType as isScalarType2, Kind as Kind14 } from "graphql";
|
3523
3453
|
var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", schema8 = {
|
3524
3454
|
type: "array",
|
@@ -3621,7 +3551,7 @@ var RULE_ID11 = "relay-arguments", MISSING_ARGUMENTS = "MISSING_ARGUMENTS", sche
|
|
3621
3551
|
}
|
3622
3552
|
};
|
3623
3553
|
|
3624
|
-
// src/rules/relay-connection-types.ts
|
3554
|
+
// src/rules/relay-connection-types/index.ts
|
3625
3555
|
import { Kind as Kind15 } from "graphql";
|
3626
3556
|
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 = [
|
3627
3557
|
Kind15.SCALAR_TYPE_DEFINITION,
|
@@ -3708,7 +3638,7 @@ var MUST_BE_OBJECT_TYPE = "MUST_BE_OBJECT_TYPE", MUST_CONTAIN_FIELD_EDGES = "MUS
|
|
3708
3638
|
}
|
3709
3639
|
};
|
3710
3640
|
|
3711
|
-
// src/rules/relay-edge-types.ts
|
3641
|
+
// src/rules/relay-edge-types/index.ts
|
3712
3642
|
import {
|
3713
3643
|
isObjectType as isObjectType2,
|
3714
3644
|
isScalarType as isScalarType3,
|
@@ -3852,7 +3782,7 @@ var schema9 = {
|
|
3852
3782
|
}
|
3853
3783
|
};
|
3854
3784
|
|
3855
|
-
// src/rules/relay-page-info.ts
|
3785
|
+
// src/rules/relay-page-info/index.ts
|
3856
3786
|
import { isScalarType as isScalarType4, Kind as Kind17 } from "graphql";
|
3857
3787
|
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 = {
|
3858
3788
|
meta: {
|
@@ -3925,7 +3855,7 @@ var RULE_ID13 = "relay-page-info", MESSAGE_MUST_EXIST = "MESSAGE_MUST_EXIST", ME
|
|
3925
3855
|
}
|
3926
3856
|
};
|
3927
3857
|
|
3928
|
-
// src/rules/require-deprecation-date.ts
|
3858
|
+
// src/rules/require-deprecation-date/index.ts
|
3929
3859
|
var 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", schema10 = {
|
3930
3860
|
type: "array",
|
3931
3861
|
maxItems: 1,
|
@@ -4050,7 +3980,7 @@ var DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/, MESSAGE_REQUIRE_DATE = "MESSAGE_REQUIR
|
|
4050
3980
|
}
|
4051
3981
|
};
|
4052
3982
|
|
4053
|
-
// src/rules/require-deprecation-reason.ts
|
3983
|
+
// src/rules/require-deprecation-reason/index.ts
|
4054
3984
|
var rule22 = {
|
4055
3985
|
meta: {
|
4056
3986
|
docs: {
|
@@ -4112,7 +4042,7 @@ var rule22 = {
|
|
4112
4042
|
}
|
4113
4043
|
};
|
4114
4044
|
|
4115
|
-
// src/rules/require-description.ts
|
4045
|
+
// src/rules/require-description/index.ts
|
4116
4046
|
import { Kind as Kind18, TokenKind as TokenKind3 } from "graphql";
|
4117
4047
|
import { getRootTypeNames } from "@graphql-tools/utils";
|
4118
4048
|
var RULE_ID14 = "require-description", ALLOWED_KINDS2 = [
|
@@ -4267,7 +4197,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
4267
4197
|
}
|
4268
4198
|
};
|
4269
4199
|
|
4270
|
-
// src/rules/require-field-of-type-query-in-mutation-result.ts
|
4200
|
+
// src/rules/require-field-of-type-query-in-mutation-result/index.ts
|
4271
4201
|
import { isObjectType as isObjectType3 } from "graphql";
|
4272
4202
|
var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
|
4273
4203
|
meta: {
|
@@ -4332,7 +4262,7 @@ var RULE_ID15 = "require-field-of-type-query-in-mutation-result", rule24 = {
|
|
4332
4262
|
}
|
4333
4263
|
};
|
4334
4264
|
|
4335
|
-
// src/rules/require-import-fragment.ts
|
4265
|
+
// src/rules/require-import-fragment/index.ts
|
4336
4266
|
import path from "node:path";
|
4337
4267
|
var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expression", rule25 = {
|
4338
4268
|
meta: {
|
@@ -4446,7 +4376,7 @@ var RULE_ID16 = "require-import-fragment", SUGGESTION_ID = "add-import-expressio
|
|
4446
4376
|
}
|
4447
4377
|
};
|
4448
4378
|
|
4449
|
-
// src/rules/require-nullable-fields-with-oneof.ts
|
4379
|
+
// src/rules/require-nullable-fields-with-oneof/index.ts
|
4450
4380
|
import { Kind as Kind19 } from "graphql";
|
4451
4381
|
var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
|
4452
4382
|
meta: {
|
@@ -4505,7 +4435,7 @@ var RULE_ID17 = "require-nullable-fields-with-oneof", rule26 = {
|
|
4505
4435
|
}
|
4506
4436
|
};
|
4507
4437
|
|
4508
|
-
// src/rules/require-nullable-result-in-root.ts
|
4438
|
+
// src/rules/require-nullable-result-in-root/index.ts
|
4509
4439
|
import { Kind as Kind20 } from "graphql";
|
4510
4440
|
var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
|
4511
4441
|
meta: {
|
@@ -4582,7 +4512,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
|
|
4582
4512
|
}
|
4583
4513
|
};
|
4584
4514
|
|
4585
|
-
// src/rules/require-selections.ts
|
4515
|
+
// src/rules/require-selections/index.ts
|
4586
4516
|
import {
|
4587
4517
|
GraphQLInterfaceType,
|
4588
4518
|
GraphQLObjectType,
|
@@ -4615,7 +4545,6 @@ var RULE_ID19 = "require-selections", DEFAULT_ID_FIELD_NAME = "id", schema12 = {
|
|
4615
4545
|
}, rule28 = {
|
4616
4546
|
meta: {
|
4617
4547
|
type: "suggestion",
|
4618
|
-
// eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- false positive since we assign `problem.suggest` conditionally
|
4619
4548
|
hasSuggestions: !0,
|
4620
4549
|
docs: {
|
4621
4550
|
category: "Operations",
|
@@ -4768,7 +4697,7 @@ Include it in your selection set{{ addition }}.`
|
|
4768
4697
|
}
|
4769
4698
|
};
|
4770
4699
|
|
4771
|
-
// src/rules/require-type-pattern-with-oneof.ts
|
4700
|
+
// src/rules/require-type-pattern-with-oneof/index.ts
|
4772
4701
|
var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
|
4773
4702
|
meta: {
|
4774
4703
|
type: "suggestion",
|
@@ -4828,7 +4757,7 @@ var RULE_ID20 = "require-type-pattern-with-oneof", rule29 = {
|
|
4828
4757
|
}
|
4829
4758
|
};
|
4830
4759
|
|
4831
|
-
// src/rules/selection-set-depth.ts
|
4760
|
+
// src/rules/selection-set-depth/index.ts
|
4832
4761
|
import { Kind as Kind22 } from "graphql";
|
4833
4762
|
import depthLimit from "graphql-depth-limit";
|
4834
4763
|
var RULE_ID21 = "selection-set-depth", schema13 = {
|
@@ -4958,7 +4887,7 @@ var RULE_ID21 = "selection-set-depth", schema13 = {
|
|
4958
4887
|
}
|
4959
4888
|
};
|
4960
4889
|
|
4961
|
-
// src/rules/strict-id-in-types.ts
|
4890
|
+
// src/rules/strict-id-in-types/index.ts
|
4962
4891
|
import { Kind as Kind23 } from "graphql";
|
4963
4892
|
var RULE_ID22 = "strict-id-in-types", schema14 = {
|
4964
4893
|
type: "array",
|
@@ -5103,7 +5032,7 @@ Accepted type${pluralTypesSuffix}: ${englishJoinWords(options.acceptedIdTypes)}.
|
|
5103
5032
|
}
|
5104
5033
|
};
|
5105
5034
|
|
5106
|
-
// src/rules/unique-enum-value-names.ts
|
5035
|
+
// src/rules/unique-enum-value-names/index.ts
|
5107
5036
|
import { Kind as Kind24 } from "graphql";
|
5108
5037
|
var rule32 = {
|
5109
5038
|
meta: {
|
@@ -5172,12 +5101,12 @@ var rule32 = {
|
|
5172
5101
|
}
|
5173
5102
|
};
|
5174
5103
|
|
5175
|
-
// src/rules/unique-fragment-name.ts
|
5104
|
+
// src/rules/unique-fragment-name/index.ts
|
5176
5105
|
import { relative as relative2 } from "node:path";
|
5177
5106
|
import { Kind as Kind25 } from "graphql";
|
5178
5107
|
var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
|
5179
5108
|
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) => {
|
5180
|
-
let isSameName = f.document.name?.value === documentName, isSamePath =
|
5109
|
+
let isSameName = f.document.name?.value === documentName, isSamePath = slash(f.filePath) === slash(filepath);
|
5181
5110
|
return isSameName && !isSamePath;
|
5182
5111
|
});
|
5183
5112
|
conflictingDocuments.length > 0 && context.report({
|
@@ -5255,7 +5184,7 @@ var RULE_ID23 = "unique-fragment-name", checkNode = (context, node, ruleId) => {
|
|
5255
5184
|
}
|
5256
5185
|
};
|
5257
5186
|
|
5258
|
-
// src/rules/unique-operation-name.ts
|
5187
|
+
// src/rules/unique-operation-name/index.ts
|
5259
5188
|
var RULE_ID24 = "unique-operation-name", rule34 = {
|
5260
5189
|
meta: {
|
5261
5190
|
type: "suggestion",
|
@@ -5371,16 +5300,26 @@ var import_operations_all = __toESM(require_operations_all(), 1), import_operati
|
|
5371
5300
|
"schema-relay": import_schema_relay.default,
|
5372
5301
|
"operations-recommended": import_operations_recommended.default,
|
5373
5302
|
"operations-all": import_operations_all.default,
|
5374
|
-
"flat/schema-recommended":
|
5303
|
+
"flat/schema-recommended": {
|
5304
|
+
rules: import_schema_recommended.default.rules
|
5305
|
+
},
|
5375
5306
|
"flat/schema-all": {
|
5376
|
-
|
5377
|
-
|
5307
|
+
rules: {
|
5308
|
+
...import_schema_recommended.default.rules,
|
5309
|
+
...import_schema_all.default.rules
|
5310
|
+
}
|
5311
|
+
},
|
5312
|
+
"flat/schema-relay": {
|
5313
|
+
rules: import_schema_relay.default.rules
|
5314
|
+
},
|
5315
|
+
"flat/operations-recommended": {
|
5316
|
+
rules: import_operations_recommended.default.rules
|
5378
5317
|
},
|
5379
|
-
"flat/schema-relay": import_schema_relay.default.rules,
|
5380
|
-
"flat/operations-recommended": import_operations_recommended.default.rules,
|
5381
5318
|
"flat/operations-all": {
|
5382
|
-
|
5383
|
-
|
5319
|
+
rules: {
|
5320
|
+
...import_operations_recommended.default.rules,
|
5321
|
+
...import_operations_all.default.rules
|
5322
|
+
}
|
5384
5323
|
}
|
5385
5324
|
};
|
5386
5325
|
export {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "4.0.0-alpha.
|
3
|
+
"version": "4.0.0-alpha.7",
|
4
4
|
"type": "module",
|
5
5
|
"description": "GraphQL plugin for ESLint",
|
6
6
|
"repository": "https://github.com/B2o5T/graphql-eslint",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
37
|
"@graphql-tools/code-file-loader": "^8.0.0",
|
38
|
-
"@graphql-tools/graphql-tag-pluck": "8.3.
|
38
|
+
"@graphql-tools/graphql-tag-pluck": "8.3.4",
|
39
39
|
"@graphql-tools/utils": "^10.0.0",
|
40
40
|
"debug": "^4.3.4",
|
41
41
|
"fast-glob": "^3.2.12",
|
@@ -1,88 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
-
return to;
|
14
|
-
};
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
16
|
-
var no_scalar_result_type_on_mutation_exports = {};
|
17
|
-
__export(no_scalar_result_type_on_mutation_exports, {
|
18
|
-
rule: () => rule
|
19
|
-
});
|
20
|
-
module.exports = __toCommonJS(no_scalar_result_type_on_mutation_exports);
|
21
|
-
var import_graphql = require("graphql"), import_utils = require("../utils.js");
|
22
|
-
const RULE_ID = "no-scalar-result-type-on-mutation", rule = {
|
23
|
-
meta: {
|
24
|
-
type: "suggestion",
|
25
|
-
hasSuggestions: !0,
|
26
|
-
docs: {
|
27
|
-
category: "Schema",
|
28
|
-
description: "Avoid scalar result type on mutation type to make sure to return a valid state.",
|
29
|
-
url: `https://the-guild.dev/graphql/eslint/rules/${RULE_ID}`,
|
30
|
-
requiresSchema: !0,
|
31
|
-
examples: [
|
32
|
-
{
|
33
|
-
title: "Incorrect",
|
34
|
-
code: (
|
35
|
-
/* GraphQL */
|
36
|
-
`
|
37
|
-
type Mutation {
|
38
|
-
createUser: Boolean
|
39
|
-
}
|
40
|
-
`
|
41
|
-
)
|
42
|
-
},
|
43
|
-
{
|
44
|
-
title: "Correct",
|
45
|
-
code: (
|
46
|
-
/* GraphQL */
|
47
|
-
`
|
48
|
-
type Mutation {
|
49
|
-
createUser: User!
|
50
|
-
}
|
51
|
-
`
|
52
|
-
)
|
53
|
-
}
|
54
|
-
]
|
55
|
-
},
|
56
|
-
schema: []
|
57
|
-
},
|
58
|
-
create(context) {
|
59
|
-
const schema = (0, import_utils.requireGraphQLSchemaFromContext)(RULE_ID, context), mutationType = schema.getMutationType();
|
60
|
-
return mutationType ? {
|
61
|
-
[[
|
62
|
-
`:matches(ObjectTypeDefinition, ObjectTypeExtension)[name.value=${mutationType.name}]`,
|
63
|
-
"> FieldDefinition > .gqlType Name"
|
64
|
-
].join(" ")](node) {
|
65
|
-
const typeName = node.value, graphQLType = schema.getType(typeName);
|
66
|
-
if ((0, import_graphql.isScalarType)(graphQLType)) {
|
67
|
-
let fieldDef = node.parent;
|
68
|
-
for (; fieldDef.kind !== import_graphql.Kind.FIELD_DEFINITION; )
|
69
|
-
fieldDef = fieldDef.parent;
|
70
|
-
context.report({
|
71
|
-
node,
|
72
|
-
message: `Unexpected scalar result type \`${typeName}\` for ${(0, import_utils.getNodeName)(fieldDef)}`,
|
73
|
-
suggest: [
|
74
|
-
{
|
75
|
-
desc: `Remove \`${typeName}\``,
|
76
|
-
fix: (fixer) => fixer.remove(node)
|
77
|
-
}
|
78
|
-
]
|
79
|
-
});
|
80
|
-
}
|
81
|
-
}
|
82
|
-
} : {};
|
83
|
-
}
|
84
|
-
};
|
85
|
-
// Annotate the CommonJS export names for ESM import in node:
|
86
|
-
0 && (module.exports = {
|
87
|
-
rule
|
88
|
-
});
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { GraphQLESLintRule } from '../types.cjs';
|
2
|
-
import 'eslint';
|
3
|
-
import 'estree';
|
4
|
-
import 'graphql';
|
5
|
-
import 'graphql-config';
|
6
|
-
import 'json-schema-to-ts';
|
7
|
-
import '../estree-converter/types.cjs';
|
8
|
-
import '../siblings.cjs';
|
9
|
-
import '@graphql-tools/utils';
|
10
|
-
|
11
|
-
declare const rule: GraphQLESLintRule;
|
12
|
-
|
13
|
-
export { rule };
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { GraphQLESLintRule } from '../types.cjs';
|
2
|
-
import 'eslint';
|
3
|
-
import 'estree';
|
4
|
-
import 'graphql';
|
5
|
-
import 'graphql-config';
|
6
|
-
import 'json-schema-to-ts';
|
7
|
-
import '../estree-converter/types.cjs';
|
8
|
-
import '../siblings.cjs';
|
9
|
-
import '@graphql-tools/utils';
|
10
|
-
|
11
|
-
declare const rule: GraphQLESLintRule;
|
12
|
-
|
13
|
-
export { rule };
|