@graphql-eslint/eslint-plugin 4.2.1 → 4.2.2-alpha-20241203143722-89cfa4d29f25233b5e6dabf8888901a7b9a51be9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/meta.js +1 -1
- package/cjs/processor.js +2 -10
- package/cjs/rules/alphabetize/index.js +1 -1
- package/cjs/rules/naming-convention/index.d.cts +2 -1
- package/cjs/rules/naming-convention/index.js +1 -2
- package/cjs/rules/no-root-type/index.js +1 -1
- package/cjs/rules/require-nullable-result-in-root/index.js +1 -1
- package/cjs/rules/strict-id-in-types/index.js +1 -2
- package/cjs/utils.d.cts +1 -3
- package/cjs/utils.js +2 -7
- package/esm/index.d.ts +1 -1
- package/esm/meta.js +1 -1
- package/esm/processor.js +3 -11
- package/esm/rules/alphabetize/index.js +2 -2
- package/esm/rules/index.d.ts +1 -1
- package/esm/rules/naming-convention/index.d.ts +2 -1
- package/esm/rules/naming-convention/index.js +1 -2
- package/esm/rules/no-root-type/index.js +2 -2
- package/esm/rules/require-nullable-result-in-root/index.js +2 -2
- package/esm/rules/strict-id-in-types/index.js +2 -3
- package/esm/utils.d.ts +1 -3
- package/esm/utils.js +2 -7
- package/index.browser.js +7 -11
- package/package.json +1 -1
package/cjs/meta.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});const version = "4.2.
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});const version = "4.2.2-alpha-20241203143722-89cfa4d29f25233b5e6dabf8888901a7b9a51be9";
|
2
2
|
|
3
3
|
|
4
4
|
exports.version = version;
|
package/cjs/processor.js
CHANGED
@@ -27,16 +27,8 @@ const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = exports.pro
|
|
27
27
|
modules = [],
|
28
28
|
globalGqlIdentifierName = ["gql", "graphql"],
|
29
29
|
gqlMagicComment = "GraphQL"
|
30
|
-
} = pluckConfig;
|
31
|
-
keywords = [
|
32
|
-
...new Set(
|
33
|
-
[
|
34
|
-
...modules.map(({ identifier }) => identifier),
|
35
|
-
..._utils.asArray.call(void 0, globalGqlIdentifierName),
|
36
|
-
gqlMagicComment
|
37
|
-
].filter(_utilsjs.truthy)
|
38
|
-
)
|
39
|
-
];
|
30
|
+
} = pluckConfig, result = [...modules.map(({ identifier }) => identifier).filter((v) => !!v), ..._utils.asArray.call(void 0, globalGqlIdentifierName), gqlMagicComment];
|
31
|
+
keywords = [...new Set(result)];
|
40
32
|
}
|
41
33
|
if (keywords.every((keyword) => !code.includes(keyword)))
|
42
34
|
return [code];
|
@@ -278,7 +278,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
278
278
|
_graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
279
279
|
_graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION
|
280
280
|
]
|
281
|
-
].filter(
|
281
|
+
].filter((v) => !!v).flat().join(","), selectionsSelector = _optionalChain([opts, 'access', _2 => _2.selections, 'optionalAccess', _3 => _3.join, 'call', _4 => _4(",")]), argumentsSelector = _optionalChain([opts, 'access', _5 => _5.arguments, 'optionalAccess', _6 => _6.join, 'call', _7 => _7(",")]);
|
282
282
|
if (fieldsSelector && (listeners[fieldsSelector] = (node) => {
|
283
283
|
checkNodes(node.fields);
|
284
284
|
}), opts.values) {
|
@@ -104,7 +104,8 @@ declare const schema: {
|
|
104
104
|
readonly default: false;
|
105
105
|
};
|
106
106
|
readonly types: {
|
107
|
-
readonly description: `Includes
|
107
|
+
readonly description: `Includes:
|
108
|
+
${string}`;
|
108
109
|
readonly oneOf: readonly [{
|
109
110
|
readonly $ref: "#/definitions/asString";
|
110
111
|
}, {
|
@@ -5,7 +5,6 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
|
8
|
-
|
9
8
|
var _utilsjs = require('../../utils.js');
|
10
9
|
const KindToDisplayName = {
|
11
10
|
// types
|
@@ -442,7 +441,7 @@ ${_utilsjs.TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
442
441
|
}, listeners = {};
|
443
442
|
allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
|
444
443
|
const selectors = new Set(
|
445
|
-
[types && _utilsjs.TYPES_KINDS, Object.keys(restOptions)].
|
444
|
+
[types && _utilsjs.TYPES_KINDS, Object.keys(restOptions)].filter((v) => !!v).flat()
|
446
445
|
);
|
447
446
|
for (const selector of selectors)
|
448
447
|
listeners[selector] = checkNode(selector);
|
@@ -59,7 +59,7 @@ const schema = {
|
|
59
59
|
const schema2 = _utilsjs.requireGraphQLSchema.call(void 0, "no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
|
60
60
|
disallow.has("mutation") && schema2.getMutationType(),
|
61
61
|
disallow.has("subscription") && schema2.getSubscriptionType()
|
62
|
-
].filter(
|
62
|
+
].filter((v) => !!v).map((type) => type.name).join("|");
|
63
63
|
return rootTypeNames ? {
|
64
64
|
[`:matches(ObjectTypeDefinition, ObjectTypeExtension) > .name[value=/^(${rootTypeNames})$/]`](node) {
|
65
65
|
const typeName = node.value;
|
@@ -43,7 +43,7 @@ const RULE_ID = "require-nullable-result-in-root", rule = exports.rule = {
|
|
43
43
|
},
|
44
44
|
create(context) {
|
45
45
|
const schema = _utilsjs.requireGraphQLSchema.call(void 0, RULE_ID, context), rootTypeNames = new Set(
|
46
|
-
[schema.getQueryType(), schema.getMutationType()].filter(
|
46
|
+
[schema.getQueryType(), schema.getMutationType()].filter((v) => !!v).map((type) => type.name)
|
47
47
|
), sourceCode = context.getSourceCode();
|
48
48
|
return {
|
49
49
|
"ObjectTypeDefinition,ObjectTypeExtension"(node) {
|
@@ -4,7 +4,6 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
8
7
|
var _utilsjs = require('../../utils.js');
|
9
8
|
const RULE_ID = "strict-id-in-types", schema = {
|
10
9
|
type: "array",
|
@@ -128,7 +127,7 @@ const RULE_ID = "strict-id-in-types", schema = {
|
|
128
127
|
schema2.getQueryType(),
|
129
128
|
schema2.getMutationType(),
|
130
129
|
schema2.getSubscriptionType()
|
131
|
-
].filter(
|
130
|
+
].filter((v) => !!v).map((type) => type.name).join("|")})$/]`](node) {
|
132
131
|
const typeName = node.name.value;
|
133
132
|
if (_optionalChain([options, 'access', _ => _.exceptions, 'access', _2 => _2.types, 'optionalAccess', _3 => _3.includes, 'call', _4 => _4(typeName)]) || _optionalChain([options, 'access', _5 => _5.exceptions, 'access', _6 => _6.suffixes, 'optionalAccess', _7 => _7.some, 'call', _8 => _8((suffix) => typeName.endsWith(suffix))]))
|
134
133
|
return;
|
package/cjs/utils.d.cts
CHANGED
@@ -37,10 +37,8 @@ declare const ARRAY_DEFAULT_OPTIONS: {
|
|
37
37
|
};
|
38
38
|
};
|
39
39
|
declare const englishJoinWords: (words: string[]) => string;
|
40
|
-
type Truthy<T> = T extends '' | 0 | false | null | undefined ? never : T;
|
41
|
-
declare function truthy<T>(value: T): value is Truthy<T>;
|
42
40
|
declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
|
43
41
|
declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
|
44
42
|
declare const eslintSelectorsTip = "> [!TIP]\n>\n> These fields are defined by ESLint [`selectors`](https://eslint.org/docs/developer-guide/selectors).\n> Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector.";
|
45
43
|
|
46
|
-
export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, eslintSelectorsTip, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLOperations, requireGraphQLSchema, slash
|
44
|
+
export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, eslintSelectorsTip, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLOperations, requireGraphQLSchema, slash };
|
package/cjs/utils.js
CHANGED
@@ -72,11 +72,7 @@ const REPORT_ON_FIRST_CHARACTER = { column: 0, line: 1 }, ARRAY_DEFAULT_OPTIONS
|
|
72
72
|
items: {
|
73
73
|
type: "string"
|
74
74
|
}
|
75
|
-
}, englishJoinWords = exports.englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words)
|
76
|
-
function truthy(value) {
|
77
|
-
return !!value;
|
78
|
-
}
|
79
|
-
const DisplayNodeNameMap = {
|
75
|
+
}, englishJoinWords = exports.englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words), DisplayNodeNameMap = {
|
80
76
|
[_graphql.Kind.ARGUMENT]: "argument",
|
81
77
|
[_graphql.Kind.BOOLEAN]: "boolean",
|
82
78
|
[_graphql.Kind.DIRECTIVE_DEFINITION]: "directive",
|
@@ -167,5 +163,4 @@ const eslintSelectorsTip = `> [!TIP]
|
|
167
163
|
|
168
164
|
|
169
165
|
|
170
|
-
|
171
|
-
exports.ARRAY_DEFAULT_OPTIONS = ARRAY_DEFAULT_OPTIONS; exports.CWD = CWD; exports.REPORT_ON_FIRST_CHARACTER = REPORT_ON_FIRST_CHARACTER; exports.TYPES_KINDS = TYPES_KINDS; exports.VIRTUAL_DOCUMENT_REGEX = VIRTUAL_DOCUMENT_REGEX; exports.camelCase = camelCase; exports.convertCase = convertCase; exports.displayNodeName = displayNodeName; exports.englishJoinWords = englishJoinWords; exports.eslintSelectorsTip = eslintSelectorsTip; exports.getLocation = getLocation; exports.getNodeName = getNodeName; exports.getTypeName = getTypeName; exports.logger = logger; exports.pascalCase = pascalCase; exports.requireGraphQLOperations = requireGraphQLOperations; exports.requireGraphQLSchema = requireGraphQLSchema; exports.slash = slash; exports.truthy = truthy;
|
166
|
+
exports.ARRAY_DEFAULT_OPTIONS = ARRAY_DEFAULT_OPTIONS; exports.CWD = CWD; exports.REPORT_ON_FIRST_CHARACTER = REPORT_ON_FIRST_CHARACTER; exports.TYPES_KINDS = TYPES_KINDS; exports.VIRTUAL_DOCUMENT_REGEX = VIRTUAL_DOCUMENT_REGEX; exports.camelCase = camelCase; exports.convertCase = convertCase; exports.displayNodeName = displayNodeName; exports.englishJoinWords = englishJoinWords; exports.eslintSelectorsTip = eslintSelectorsTip; exports.getLocation = getLocation; exports.getNodeName = getNodeName; exports.getTypeName = getTypeName; exports.logger = logger; exports.pascalCase = pascalCase; exports.requireGraphQLOperations = requireGraphQLOperations; exports.requireGraphQLSchema = requireGraphQLSchema; exports.slash = slash;
|
package/esm/index.d.ts
CHANGED
@@ -49,10 +49,10 @@ declare const _default: {
|
|
49
49
|
};
|
50
50
|
rules: {
|
51
51
|
alphabetize: GraphQLESLintRule<{
|
52
|
-
values?: boolean | undefined;
|
53
52
|
definitions?: boolean | undefined;
|
54
53
|
selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
|
55
54
|
arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
|
55
|
+
values?: boolean | undefined;
|
56
56
|
fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
|
57
57
|
variables?: boolean | undefined;
|
58
58
|
groups?: string[] | undefined;
|
package/esm/meta.js
CHANGED
package/esm/processor.js
CHANGED
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
import { asArray } from "@graphql-tools/utils";
|
6
6
|
import { loadOnDiskGraphQLConfig } from "./graphql-config.js";
|
7
7
|
import { version } from "./meta.js";
|
8
|
-
import { CWD, REPORT_ON_FIRST_CHARACTER
|
8
|
+
import { CWD, REPORT_ON_FIRST_CHARACTER } from "./utils.js";
|
9
9
|
const blocksMap = /* @__PURE__ */ new Map();
|
10
10
|
let onDiskConfig, onDiskConfigLoaded = !1;
|
11
11
|
const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = {
|
@@ -27,16 +27,8 @@ const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = {
|
|
27
27
|
modules = [],
|
28
28
|
globalGqlIdentifierName = ["gql", "graphql"],
|
29
29
|
gqlMagicComment = "GraphQL"
|
30
|
-
} = pluckConfig;
|
31
|
-
keywords = [
|
32
|
-
...new Set(
|
33
|
-
[
|
34
|
-
...modules.map(({ identifier }) => identifier),
|
35
|
-
...asArray(globalGqlIdentifierName),
|
36
|
-
gqlMagicComment
|
37
|
-
].filter(truthy)
|
38
|
-
)
|
39
|
-
];
|
30
|
+
} = pluckConfig, result = [...modules.map(({ identifier }) => identifier).filter((v) => !!v), ...asArray(globalGqlIdentifierName), gqlMagicComment];
|
31
|
+
keywords = [...new Set(result)];
|
40
32
|
}
|
41
33
|
if (keywords.every((keyword) => !code.includes(keyword)))
|
42
34
|
return [code];
|
@@ -2,7 +2,7 @@ import {
|
|
2
2
|
Kind
|
3
3
|
} from "graphql";
|
4
4
|
import lowerCase from "lodash.lowercase";
|
5
|
-
import { ARRAY_DEFAULT_OPTIONS, displayNodeName
|
5
|
+
import { ARRAY_DEFAULT_OPTIONS, displayNodeName } from "../../utils.js";
|
6
6
|
const RULE_ID = "alphabetize", fieldsEnum = [
|
7
7
|
Kind.OBJECT_TYPE_DEFINITION,
|
8
8
|
Kind.INTERFACE_TYPE_DEFINITION,
|
@@ -278,7 +278,7 @@ const RULE_ID = "alphabetize", fieldsEnum = [
|
|
278
278
|
Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
279
279
|
Kind.INPUT_OBJECT_TYPE_EXTENSION
|
280
280
|
]
|
281
|
-
].filter(
|
281
|
+
].filter((v) => !!v).flat().join(","), selectionsSelector = opts.selections?.join(","), argumentsSelector = opts.arguments?.join(",");
|
282
282
|
if (fieldsSelector && (listeners[fieldsSelector] = (node) => {
|
283
283
|
checkNodes(node.fields);
|
284
284
|
}), opts.values) {
|
package/esm/rules/index.d.ts
CHANGED
@@ -12,10 +12,10 @@ import 'json-schema-to-ts';
|
|
12
12
|
|
13
13
|
declare const rules: {
|
14
14
|
alphabetize: GraphQLESLintRule<{
|
15
|
-
values?: boolean | undefined;
|
16
15
|
definitions?: boolean | undefined;
|
17
16
|
selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
|
18
17
|
arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
|
18
|
+
values?: boolean | undefined;
|
19
19
|
fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
|
20
20
|
variables?: boolean | undefined;
|
21
21
|
groups?: string[] | undefined;
|
@@ -104,7 +104,8 @@ declare const schema: {
|
|
104
104
|
readonly default: false;
|
105
105
|
};
|
106
106
|
readonly types: {
|
107
|
-
readonly description: `Includes
|
107
|
+
readonly description: `Includes:
|
108
|
+
${string}`;
|
108
109
|
readonly oneOf: readonly [{
|
109
110
|
readonly $ref: "#/definitions/asString";
|
110
111
|
}, {
|
@@ -4,7 +4,6 @@ import {
|
|
4
4
|
convertCase,
|
5
5
|
displayNodeName,
|
6
6
|
englishJoinWords,
|
7
|
-
truthy,
|
8
7
|
TYPES_KINDS
|
9
8
|
} from "../../utils.js";
|
10
9
|
const KindToDisplayName = {
|
@@ -442,7 +441,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
442
441
|
}, listeners = {};
|
443
442
|
allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
|
444
443
|
const selectors = new Set(
|
445
|
-
[types && TYPES_KINDS, Object.keys(restOptions)].
|
444
|
+
[types && TYPES_KINDS, Object.keys(restOptions)].filter((v) => !!v).flat()
|
446
445
|
);
|
447
446
|
for (const selector of selectors)
|
448
447
|
listeners[selector] = checkNode(selector);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ARRAY_DEFAULT_OPTIONS, requireGraphQLSchema
|
1
|
+
import { ARRAY_DEFAULT_OPTIONS, requireGraphQLSchema } from "../../utils.js";
|
2
2
|
const schema = {
|
3
3
|
type: "array",
|
4
4
|
minItems: 1,
|
@@ -59,7 +59,7 @@ const schema = {
|
|
59
59
|
const schema2 = requireGraphQLSchema("no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
|
60
60
|
disallow.has("mutation") && schema2.getMutationType(),
|
61
61
|
disallow.has("subscription") && schema2.getSubscriptionType()
|
62
|
-
].filter(
|
62
|
+
].filter((v) => !!v).map((type) => type.name).join("|");
|
63
63
|
return rootTypeNames ? {
|
64
64
|
[`:matches(ObjectTypeDefinition, ObjectTypeExtension) > .name[value=/^(${rootTypeNames})$/]`](node) {
|
65
65
|
const typeName = node.value;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Kind } from "graphql";
|
2
|
-
import { getNodeName, requireGraphQLSchema
|
2
|
+
import { getNodeName, requireGraphQLSchema } from "../../utils.js";
|
3
3
|
const RULE_ID = "require-nullable-result-in-root", rule = {
|
4
4
|
meta: {
|
5
5
|
type: "suggestion",
|
@@ -43,7 +43,7 @@ const RULE_ID = "require-nullable-result-in-root", rule = {
|
|
43
43
|
},
|
44
44
|
create(context) {
|
45
45
|
const schema = requireGraphQLSchema(RULE_ID, context), rootTypeNames = new Set(
|
46
|
-
[schema.getQueryType(), schema.getMutationType()].filter(
|
46
|
+
[schema.getQueryType(), schema.getMutationType()].filter((v) => !!v).map((type) => type.name)
|
47
47
|
), sourceCode = context.getSourceCode();
|
48
48
|
return {
|
49
49
|
"ObjectTypeDefinition,ObjectTypeExtension"(node) {
|
@@ -3,8 +3,7 @@ import {
|
|
3
3
|
ARRAY_DEFAULT_OPTIONS,
|
4
4
|
displayNodeName,
|
5
5
|
englishJoinWords,
|
6
|
-
requireGraphQLSchema
|
7
|
-
truthy
|
6
|
+
requireGraphQLSchema
|
8
7
|
} from "../../utils.js";
|
9
8
|
const RULE_ID = "strict-id-in-types", schema = {
|
10
9
|
type: "array",
|
@@ -128,7 +127,7 @@ const RULE_ID = "strict-id-in-types", schema = {
|
|
128
127
|
schema2.getQueryType(),
|
129
128
|
schema2.getMutationType(),
|
130
129
|
schema2.getSubscriptionType()
|
131
|
-
].filter(
|
130
|
+
].filter((v) => !!v).map((type) => type.name).join("|")})$/]`](node) {
|
132
131
|
const typeName = node.name.value;
|
133
132
|
if (options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix)))
|
134
133
|
return;
|
package/esm/utils.d.ts
CHANGED
@@ -37,10 +37,8 @@ declare const ARRAY_DEFAULT_OPTIONS: {
|
|
37
37
|
};
|
38
38
|
};
|
39
39
|
declare const englishJoinWords: (words: string[]) => string;
|
40
|
-
type Truthy<T> = T extends '' | 0 | false | null | undefined ? never : T;
|
41
|
-
declare function truthy<T>(value: T): value is Truthy<T>;
|
42
40
|
declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
|
43
41
|
declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
|
44
42
|
declare const eslintSelectorsTip = "> [!TIP]\n>\n> These fields are defined by ESLint [`selectors`](https://eslint.org/docs/developer-guide/selectors).\n> Paste or drop code into the editor in [ASTExplorer](https://astexplorer.net) and inspect the generated AST to compose your selector.";
|
45
43
|
|
46
|
-
export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, eslintSelectorsTip, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLOperations, requireGraphQLSchema, slash
|
44
|
+
export { ARRAY_DEFAULT_OPTIONS, CWD, type CaseStyle, REPORT_ON_FIRST_CHARACTER, TYPES_KINDS, VIRTUAL_DOCUMENT_REGEX, camelCase, convertCase, displayNodeName, englishJoinWords, eslintSelectorsTip, getLocation, getNodeName, getTypeName, logger, pascalCase, requireGraphQLOperations, requireGraphQLSchema, slash };
|
package/esm/utils.js
CHANGED
@@ -72,11 +72,7 @@ const REPORT_ON_FIRST_CHARACTER = { column: 0, line: 1 }, ARRAY_DEFAULT_OPTIONS
|
|
72
72
|
items: {
|
73
73
|
type: "string"
|
74
74
|
}
|
75
|
-
}, englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words)
|
76
|
-
function truthy(value) {
|
77
|
-
return !!value;
|
78
|
-
}
|
79
|
-
const DisplayNodeNameMap = {
|
75
|
+
}, englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words), DisplayNodeNameMap = {
|
80
76
|
[Kind.ARGUMENT]: "argument",
|
81
77
|
[Kind.BOOLEAN]: "boolean",
|
82
78
|
[Kind.DIRECTIVE_DEFINITION]: "directive",
|
@@ -166,6 +162,5 @@ export {
|
|
166
162
|
pascalCase,
|
167
163
|
requireGraphQLOperations,
|
168
164
|
requireGraphQLSchema,
|
169
|
-
slash
|
170
|
-
truthy
|
165
|
+
slash
|
171
166
|
};
|
package/index.browser.js
CHANGED
@@ -150,7 +150,7 @@ function convertToESTree(node, schema16) {
|
|
150
150
|
}
|
151
151
|
|
152
152
|
// src/meta.ts
|
153
|
-
var version = "4.2.
|
153
|
+
var version = "4.2.2-alpha-20241203143722-89cfa4d29f25233b5e6dabf8888901a7b9a51be9";
|
154
154
|
|
155
155
|
// src/siblings.ts
|
156
156
|
import {
|
@@ -233,11 +233,7 @@ var REPORT_ON_FIRST_CHARACTER = { column: 0, line: 1 }, ARRAY_DEFAULT_OPTIONS =
|
|
233
233
|
items: {
|
234
234
|
type: "string"
|
235
235
|
}
|
236
|
-
}, englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words)
|
237
|
-
function truthy(value) {
|
238
|
-
return !!value;
|
239
|
-
}
|
240
|
-
var DisplayNodeNameMap = {
|
236
|
+
}, englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words), DisplayNodeNameMap = {
|
241
237
|
[Kind2.ARGUMENT]: "argument",
|
242
238
|
[Kind2.BOOLEAN]: "boolean",
|
243
239
|
[Kind2.DIRECTIVE_DEFINITION]: "directive",
|
@@ -732,7 +728,7 @@ var RULE_ID = "alphabetize", fieldsEnum = [
|
|
732
728
|
Kind4.INPUT_OBJECT_TYPE_DEFINITION,
|
733
729
|
Kind4.INPUT_OBJECT_TYPE_EXTENSION
|
734
730
|
]
|
735
|
-
].filter(
|
731
|
+
].filter((v) => !!v).flat().join(","), selectionsSelector = opts.selections?.join(","), argumentsSelector = opts.arguments?.join(",");
|
736
732
|
if (fieldsSelector && (listeners[fieldsSelector] = (node) => {
|
737
733
|
checkNodes(node.fields);
|
738
734
|
}), opts.values) {
|
@@ -2333,7 +2329,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
2333
2329
|
}, listeners = {};
|
2334
2330
|
allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
|
2335
2331
|
let selectors = new Set(
|
2336
|
-
[types && TYPES_KINDS, Object.keys(restOptions)].
|
2332
|
+
[types && TYPES_KINDS, Object.keys(restOptions)].filter((v) => !!v).flat()
|
2337
2333
|
);
|
2338
2334
|
for (let selector of selectors)
|
2339
2335
|
listeners[selector] = checkNode2(selector);
|
@@ -2902,7 +2898,7 @@ var schema7 = {
|
|
2902
2898
|
let schema16 = requireGraphQLSchema("no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
|
2903
2899
|
disallow.has("mutation") && schema16.getMutationType(),
|
2904
2900
|
disallow.has("subscription") && schema16.getSubscriptionType()
|
2905
|
-
].filter(
|
2901
|
+
].filter((v) => !!v).map((type) => type.name).join("|");
|
2906
2902
|
return rootTypeNames ? {
|
2907
2903
|
[`:matches(ObjectTypeDefinition, ObjectTypeExtension) > .name[value=/^(${rootTypeNames})$/]`](node) {
|
2908
2904
|
let typeName = node.value;
|
@@ -4510,7 +4506,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
|
|
4510
4506
|
},
|
4511
4507
|
create(context) {
|
4512
4508
|
let schema16 = requireGraphQLSchema(RULE_ID18, context), rootTypeNames = new Set(
|
4513
|
-
[schema16.getQueryType(), schema16.getMutationType()].filter(
|
4509
|
+
[schema16.getQueryType(), schema16.getMutationType()].filter((v) => !!v).map((type) => type.name)
|
4514
4510
|
), sourceCode = context.getSourceCode();
|
4515
4511
|
return {
|
4516
4512
|
"ObjectTypeDefinition,ObjectTypeExtension"(node) {
|
@@ -5057,7 +5053,7 @@ var RULE_ID22 = "strict-id-in-types", schema15 = {
|
|
5057
5053
|
schema16.getQueryType(),
|
5058
5054
|
schema16.getMutationType(),
|
5059
5055
|
schema16.getSubscriptionType()
|
5060
|
-
].filter(
|
5056
|
+
].filter((v) => !!v).map((type) => type.name).join("|")})$/]`](node) {
|
5061
5057
|
let typeName = node.name.value;
|
5062
5058
|
if (options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix)))
|
5063
5059
|
return;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.2-alpha-20241203143722-89cfa4d29f25233b5e6dabf8888901a7b9a51be9",
|
4
4
|
"type": "module",
|
5
5
|
"description": "GraphQL plugin for ESLint",
|
6
6
|
"repository": "https://github.com/dimaMachina/graphql-eslint",
|