@graphql-eslint/eslint-plugin 3.20.0 → 3.20.1-alpha-20230713065115-b9bc635
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/configs/operations-all.js +1 -23
- package/cjs/configs/operations-recommended.js +1 -23
- package/cjs/configs/relay.js +1 -23
- package/cjs/configs/schema-all.js +1 -23
- package/cjs/configs/schema-recommended.js +1 -23
- package/cjs/documents.js +2 -1
- package/cjs/estree-converter/utils.js +1 -1
- package/cjs/parser.js +4 -3
- package/cjs/processor.js +1 -1
- package/cjs/rules/alphabetize.js +12 -9
- package/cjs/rules/graphql-js-validation.js +13 -8
- package/cjs/rules/lone-executable-definition.js +5 -3
- package/cjs/rules/match-document-filename.js +2 -1
- package/cjs/rules/naming-convention.js +2 -2
- package/cjs/rules/no-case-insensitive-enum-values-duplicates.js +2 -1
- package/cjs/rules/no-deprecated.js +4 -2
- package/cjs/rules/no-one-place-fragments.js +1 -1
- package/cjs/rules/no-unreachable-types.js +2 -2
- package/cjs/rules/no-unused-fields.js +4 -2
- package/cjs/rules/relay-arguments.js +2 -1
- package/cjs/rules/relay-connection-types.js +8 -2
- package/cjs/rules/relay-edge-types.js +7 -4
- package/cjs/rules/relay-page-info.js +2 -1
- package/cjs/rules/require-deprecation-date.js +3 -2
- package/cjs/rules/require-deprecation-reason.js +2 -1
- package/cjs/rules/require-description.js +3 -2
- package/cjs/rules/require-field-of-type-query-in-mutation-result.js +1 -1
- package/cjs/rules/require-import-fragment.js +2 -1
- package/cjs/rules/require-nullable-result-in-root.js +1 -1
- package/cjs/rules/require-type-pattern-with-oneof.js +2 -1
- package/cjs/rules/strict-id-in-types.js +4 -3
- package/cjs/rules/unique-fragment-name.js +2 -1
- package/cjs/siblings.js +8 -3
- package/cjs/utils.js +2 -1
- package/esm/cache.js +1 -0
- package/esm/chunk-BMTV3EA2.js +8 -0
- package/esm/configs/index.js +1 -0
- package/esm/configs/operations-all.js +32 -27
- package/esm/configs/operations-recommended.js +57 -52
- package/esm/configs/relay.js +17 -12
- package/esm/configs/schema-all.js +26 -21
- package/esm/configs/schema-recommended.js +53 -48
- package/esm/documents.js +3 -1
- package/esm/estree-converter/converter.js +1 -0
- package/esm/estree-converter/utils.js +2 -1
- package/esm/flat-configs.js +1 -0
- package/esm/graphql-config.js +1 -0
- package/esm/index.js +1 -0
- package/esm/parser.js +5 -3
- package/esm/processor.js +2 -1
- package/esm/rules/alphabetize.js +13 -9
- package/esm/rules/description-style.js +1 -0
- package/esm/rules/graphql-js-validation.js +14 -8
- package/esm/rules/index.js +1 -0
- package/esm/rules/input-name.js +1 -0
- package/esm/rules/lone-executable-definition.js +6 -3
- package/esm/rules/match-document-filename.js +3 -1
- package/esm/rules/naming-convention.js +3 -2
- package/esm/rules/no-anonymous-operations.js +1 -0
- package/esm/rules/no-case-insensitive-enum-values-duplicates.js +3 -1
- package/esm/rules/no-deprecated.js +5 -2
- package/esm/rules/no-duplicate-fields.js +1 -0
- package/esm/rules/no-hashtag-description.js +1 -0
- package/esm/rules/no-one-place-fragments.js +2 -1
- package/esm/rules/no-root-type.js +1 -0
- package/esm/rules/no-scalar-result-type-on-mutation.js +1 -0
- package/esm/rules/no-typename-prefix.js +1 -0
- package/esm/rules/no-unreachable-types.js +3 -2
- package/esm/rules/no-unused-fields.js +5 -2
- package/esm/rules/relay-arguments.js +3 -1
- package/esm/rules/relay-connection-types.js +9 -2
- package/esm/rules/relay-edge-types.js +8 -4
- package/esm/rules/relay-page-info.js +3 -1
- package/esm/rules/require-deprecation-date.js +4 -2
- package/esm/rules/require-deprecation-reason.js +3 -1
- package/esm/rules/require-description.js +4 -2
- package/esm/rules/require-field-of-type-query-in-mutation-result.js +2 -1
- package/esm/rules/require-id-when-available.js +1 -0
- package/esm/rules/require-import-fragment.js +3 -1
- package/esm/rules/require-nullable-fields-with-oneof.js +1 -0
- package/esm/rules/require-nullable-result-in-root.js +2 -1
- package/esm/rules/require-type-pattern-with-oneof.js +3 -1
- package/esm/rules/selection-set-depth.js +1 -0
- package/esm/rules/strict-id-in-types.js +5 -3
- package/esm/rules/unique-fragment-name.js +3 -1
- package/esm/rules/unique-operation-name.js +1 -0
- package/esm/schema.js +1 -0
- package/esm/siblings.js +9 -3
- package/esm/testkit.js +1 -0
- package/esm/utils.js +3 -1
- 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
|
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
|
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
|
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
|
-
|
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
|
});
|
package/esm/schema.js
CHANGED
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
|
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
|
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) =>
|
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
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
|
-
|
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.
|
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
|
}
|