@graphql-eslint/eslint-plugin 4.2.1-alpha-20241201060249-5244cf7e07b7338f66f98426dcba2471a48954b2 → 4.2.1-alpha-20241203141049-86a719064ca3fc2ec3104d78b21866df1c2c5587
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/index.d.cts +1 -1
- package/cjs/meta.js +1 -1
- package/cjs/processor.js +10 -2
- package/cjs/rules/alphabetize/index.js +1 -1
- package/cjs/rules/index.d.cts +1 -1
- package/cjs/rules/naming-convention/index.d.cts +1 -2
- package/cjs/rules/naming-convention/index.js +2 -1
- 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 +2 -1
- package/cjs/utils.d.cts +3 -1
- package/cjs/utils.js +7 -2
- package/esm/meta.js +1 -1
- package/esm/processor.js +11 -3
- package/esm/rules/alphabetize/index.js +2 -2
- package/esm/rules/naming-convention/index.d.ts +1 -2
- package/esm/rules/naming-convention/index.js +2 -1
- 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 +3 -2
- package/esm/utils.d.ts +3 -1
- package/esm/utils.js +7 -2
- package/index.browser.js +11 -7
- package/package.json +2 -2
package/cjs/index.d.cts
CHANGED
@@ -49,10 +49,10 @@ declare const _default: {
|
|
49
49
|
};
|
50
50
|
rules: {
|
51
51
|
alphabetize: GraphQLESLintRule<{
|
52
|
+
values?: boolean | undefined;
|
52
53
|
definitions?: boolean | undefined;
|
53
54
|
selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
|
54
55
|
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/cjs/meta.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});const version = "4.2.1-alpha-
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});const version = "4.2.1-alpha-20241203141049-86a719064ca3fc2ec3104d78b21866df1c2c5587";
|
2
2
|
|
3
3
|
|
4
4
|
exports.version = version;
|
package/cjs/processor.js
CHANGED
@@ -27,8 +27,16 @@ 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 = [
|
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
|
+
];
|
32
40
|
}
|
33
41
|
if (keywords.every((keyword) => !code.includes(keyword)))
|
34
42
|
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(_utilsjs.truthy).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) {
|
package/cjs/rules/index.d.cts
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;
|
15
16
|
definitions?: boolean | undefined;
|
16
17
|
selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
|
17
18
|
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,8 +104,7 @@ declare const schema: {
|
|
104
104
|
readonly default: false;
|
105
105
|
};
|
106
106
|
readonly types: {
|
107
|
-
readonly description: `Includes
|
108
|
-
${string}`;
|
107
|
+
readonly description: `Includes:\n${string}`;
|
109
108
|
readonly oneOf: readonly [{
|
110
109
|
readonly $ref: "#/definitions/asString";
|
111
110
|
}, {
|
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
|
8
|
+
|
8
9
|
var _utilsjs = require('../../utils.js');
|
9
10
|
const KindToDisplayName = {
|
10
11
|
// types
|
@@ -441,7 +442,7 @@ ${_utilsjs.TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
441
442
|
}, listeners = {};
|
442
443
|
allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
|
443
444
|
const selectors = new Set(
|
444
|
-
[types && _utilsjs.TYPES_KINDS, Object.keys(restOptions)].
|
445
|
+
[types && _utilsjs.TYPES_KINDS, Object.keys(restOptions)].flat().filter(_utilsjs.truthy)
|
445
446
|
);
|
446
447
|
for (const selector of selectors)
|
447
448
|
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(_utilsjs.truthy).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(_utilsjs.truthy).map((type) => type.name)
|
47
47
|
), sourceCode = context.getSourceCode();
|
48
48
|
return {
|
49
49
|
"ObjectTypeDefinition,ObjectTypeExtension"(node) {
|
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
|
7
8
|
var _utilsjs = require('../../utils.js');
|
8
9
|
const RULE_ID = "strict-id-in-types", schema = {
|
9
10
|
type: "array",
|
@@ -127,7 +128,7 @@ const RULE_ID = "strict-id-in-types", schema = {
|
|
127
128
|
schema2.getQueryType(),
|
128
129
|
schema2.getMutationType(),
|
129
130
|
schema2.getSubscriptionType()
|
130
|
-
].filter(
|
131
|
+
].filter(_utilsjs.truthy).map((type) => type.name).join("|")})$/]`](node) {
|
131
132
|
const typeName = node.name.value;
|
132
133
|
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))]))
|
133
134
|
return;
|
package/cjs/utils.d.cts
CHANGED
@@ -37,8 +37,10 @@ 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>;
|
40
42
|
declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
|
41
43
|
declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
|
42
44
|
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.";
|
43
45
|
|
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 };
|
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, truthy };
|
package/cjs/utils.js
CHANGED
@@ -72,7 +72,11 @@ 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)
|
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 = {
|
76
80
|
[_graphql.Kind.ARGUMENT]: "argument",
|
77
81
|
[_graphql.Kind.BOOLEAN]: "boolean",
|
78
82
|
[_graphql.Kind.DIRECTIVE_DEFINITION]: "directive",
|
@@ -163,4 +167,5 @@ const eslintSelectorsTip = `> [!TIP]
|
|
163
167
|
|
164
168
|
|
165
169
|
|
166
|
-
|
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;
|
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 } from "./utils.js";
|
8
|
+
import { CWD, REPORT_ON_FIRST_CHARACTER, truthy } 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,8 +27,16 @@ const RELEVANT_KEYWORDS = ["gql", "graphql", "GraphQL"], processor = {
|
|
27
27
|
modules = [],
|
28
28
|
globalGqlIdentifierName = ["gql", "graphql"],
|
29
29
|
gqlMagicComment = "GraphQL"
|
30
|
-
} = pluckConfig
|
31
|
-
keywords = [
|
30
|
+
} = pluckConfig;
|
31
|
+
keywords = [
|
32
|
+
...new Set(
|
33
|
+
[
|
34
|
+
...modules.map(({ identifier }) => identifier),
|
35
|
+
...asArray(globalGqlIdentifierName),
|
36
|
+
gqlMagicComment
|
37
|
+
].filter(truthy)
|
38
|
+
)
|
39
|
+
];
|
32
40
|
}
|
33
41
|
if (keywords.every((keyword) => !code.includes(keyword)))
|
34
42
|
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 } from "../../utils.js";
|
5
|
+
import { ARRAY_DEFAULT_OPTIONS, displayNodeName, truthy } 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(truthy).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) {
|
@@ -104,8 +104,7 @@ declare const schema: {
|
|
104
104
|
readonly default: false;
|
105
105
|
};
|
106
106
|
readonly types: {
|
107
|
-
readonly description: `Includes
|
108
|
-
${string}`;
|
107
|
+
readonly description: `Includes:\n${string}`;
|
109
108
|
readonly oneOf: readonly [{
|
110
109
|
readonly $ref: "#/definitions/asString";
|
111
110
|
}, {
|
@@ -4,6 +4,7 @@ import {
|
|
4
4
|
convertCase,
|
5
5
|
displayNodeName,
|
6
6
|
englishJoinWords,
|
7
|
+
truthy,
|
7
8
|
TYPES_KINDS
|
8
9
|
} from "../../utils.js";
|
9
10
|
const KindToDisplayName = {
|
@@ -441,7 +442,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
441
442
|
}, listeners = {};
|
442
443
|
allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
|
443
444
|
const selectors = new Set(
|
444
|
-
[types && TYPES_KINDS, Object.keys(restOptions)].
|
445
|
+
[types && TYPES_KINDS, Object.keys(restOptions)].flat().filter(truthy)
|
445
446
|
);
|
446
447
|
for (const selector of selectors)
|
447
448
|
listeners[selector] = checkNode(selector);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ARRAY_DEFAULT_OPTIONS, requireGraphQLSchema } from "../../utils.js";
|
1
|
+
import { ARRAY_DEFAULT_OPTIONS, requireGraphQLSchema, truthy } 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(truthy).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 } from "../../utils.js";
|
2
|
+
import { getNodeName, requireGraphQLSchema, truthy } 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(truthy).map((type) => type.name)
|
47
47
|
), sourceCode = context.getSourceCode();
|
48
48
|
return {
|
49
49
|
"ObjectTypeDefinition,ObjectTypeExtension"(node) {
|
@@ -3,7 +3,8 @@ import {
|
|
3
3
|
ARRAY_DEFAULT_OPTIONS,
|
4
4
|
displayNodeName,
|
5
5
|
englishJoinWords,
|
6
|
-
requireGraphQLSchema
|
6
|
+
requireGraphQLSchema,
|
7
|
+
truthy
|
7
8
|
} from "../../utils.js";
|
8
9
|
const RULE_ID = "strict-id-in-types", schema = {
|
9
10
|
type: "array",
|
@@ -127,7 +128,7 @@ const RULE_ID = "strict-id-in-types", schema = {
|
|
127
128
|
schema2.getQueryType(),
|
128
129
|
schema2.getMutationType(),
|
129
130
|
schema2.getSubscriptionType()
|
130
|
-
].filter(
|
131
|
+
].filter(truthy).map((type) => type.name).join("|")})$/]`](node) {
|
131
132
|
const typeName = node.name.value;
|
132
133
|
if (options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix)))
|
133
134
|
return;
|
package/esm/utils.d.ts
CHANGED
@@ -37,8 +37,10 @@ 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>;
|
40
42
|
declare function displayNodeName(node: GraphQLESTreeNode<ASTNode, boolean>): string;
|
41
43
|
declare function getNodeName(node: GraphQLESTreeNode<ASTNode>): string;
|
42
44
|
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.";
|
43
45
|
|
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 };
|
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, truthy };
|
package/esm/utils.js
CHANGED
@@ -72,7 +72,11 @@ 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)
|
75
|
+
}, englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words);
|
76
|
+
function truthy(value) {
|
77
|
+
return !!value;
|
78
|
+
}
|
79
|
+
const DisplayNodeNameMap = {
|
76
80
|
[Kind.ARGUMENT]: "argument",
|
77
81
|
[Kind.BOOLEAN]: "boolean",
|
78
82
|
[Kind.DIRECTIVE_DEFINITION]: "directive",
|
@@ -162,5 +166,6 @@ export {
|
|
162
166
|
pascalCase,
|
163
167
|
requireGraphQLOperations,
|
164
168
|
requireGraphQLSchema,
|
165
|
-
slash
|
169
|
+
slash,
|
170
|
+
truthy
|
166
171
|
};
|
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.1-alpha-
|
153
|
+
var version = "4.2.1-alpha-20241203141049-86a719064ca3fc2ec3104d78b21866df1c2c5587";
|
154
154
|
|
155
155
|
// src/siblings.ts
|
156
156
|
import {
|
@@ -233,7 +233,11 @@ 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)
|
236
|
+
}, englishJoinWords = (words) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(words);
|
237
|
+
function truthy(value) {
|
238
|
+
return !!value;
|
239
|
+
}
|
240
|
+
var DisplayNodeNameMap = {
|
237
241
|
[Kind2.ARGUMENT]: "argument",
|
238
242
|
[Kind2.BOOLEAN]: "boolean",
|
239
243
|
[Kind2.DIRECTIVE_DEFINITION]: "directive",
|
@@ -728,7 +732,7 @@ var RULE_ID = "alphabetize", fieldsEnum = [
|
|
728
732
|
Kind4.INPUT_OBJECT_TYPE_DEFINITION,
|
729
733
|
Kind4.INPUT_OBJECT_TYPE_EXTENSION
|
730
734
|
]
|
731
|
-
].filter(
|
735
|
+
].filter(truthy).flat().join(","), selectionsSelector = opts.selections?.join(","), argumentsSelector = opts.arguments?.join(",");
|
732
736
|
if (fieldsSelector && (listeners[fieldsSelector] = (node) => {
|
733
737
|
checkNodes(node.fields);
|
734
738
|
}), opts.values) {
|
@@ -2329,7 +2333,7 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
|
|
2329
2333
|
}, listeners = {};
|
2330
2334
|
allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
|
2331
2335
|
let selectors = new Set(
|
2332
|
-
[types && TYPES_KINDS, Object.keys(restOptions)].
|
2336
|
+
[types && TYPES_KINDS, Object.keys(restOptions)].flat().filter(truthy)
|
2333
2337
|
);
|
2334
2338
|
for (let selector of selectors)
|
2335
2339
|
listeners[selector] = checkNode2(selector);
|
@@ -2898,7 +2902,7 @@ var schema7 = {
|
|
2898
2902
|
let schema16 = requireGraphQLSchema("no-root-type", context), disallow = new Set(context.options[0].disallow), rootTypeNames = [
|
2899
2903
|
disallow.has("mutation") && schema16.getMutationType(),
|
2900
2904
|
disallow.has("subscription") && schema16.getSubscriptionType()
|
2901
|
-
].filter(
|
2905
|
+
].filter(truthy).map((type) => type.name).join("|");
|
2902
2906
|
return rootTypeNames ? {
|
2903
2907
|
[`:matches(ObjectTypeDefinition, ObjectTypeExtension) > .name[value=/^(${rootTypeNames})$/]`](node) {
|
2904
2908
|
let typeName = node.value;
|
@@ -4506,7 +4510,7 @@ var RULE_ID18 = "require-nullable-result-in-root", rule27 = {
|
|
4506
4510
|
},
|
4507
4511
|
create(context) {
|
4508
4512
|
let schema16 = requireGraphQLSchema(RULE_ID18, context), rootTypeNames = new Set(
|
4509
|
-
[schema16.getQueryType(), schema16.getMutationType()].filter(
|
4513
|
+
[schema16.getQueryType(), schema16.getMutationType()].filter(truthy).map((type) => type.name)
|
4510
4514
|
), sourceCode = context.getSourceCode();
|
4511
4515
|
return {
|
4512
4516
|
"ObjectTypeDefinition,ObjectTypeExtension"(node) {
|
@@ -5053,7 +5057,7 @@ var RULE_ID22 = "strict-id-in-types", schema15 = {
|
|
5053
5057
|
schema16.getQueryType(),
|
5054
5058
|
schema16.getMutationType(),
|
5055
5059
|
schema16.getSubscriptionType()
|
5056
|
-
].filter(
|
5060
|
+
].filter(truthy).map((type) => type.name).join("|")})$/]`](node) {
|
5057
5061
|
let typeName = node.name.value;
|
5058
5062
|
if (options.exceptions.types?.includes(typeName) || options.exceptions.suffixes?.some((suffix) => typeName.endsWith(suffix)))
|
5059
5063
|
return;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "4.2.1-alpha-
|
3
|
+
"version": "4.2.1-alpha-20241203141049-86a719064ca3fc2ec3104d78b21866df1c2c5587",
|
4
4
|
"type": "module",
|
5
5
|
"description": "GraphQL plugin for ESLint",
|
6
6
|
"repository": "https://github.com/dimaMachina/graphql-eslint",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"@graphql-tools/utils": "^10.0.0",
|
46
46
|
"debug": "^4.3.4",
|
47
47
|
"fast-glob": "^3.2.12",
|
48
|
-
"graphql-config": "^5.1.
|
48
|
+
"graphql-config": "^5.1.3",
|
49
49
|
"graphql-depth-limit": "^1.1.0",
|
50
50
|
"lodash.lowercase": "^4.3.0"
|
51
51
|
},
|