@graphql-eslint/eslint-plugin 3.14.4-alpha-20230110215528-a1c4235 → 3.14.4-alpha-20230111223410-a558ee8
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/rules/relay-arguments.js +3 -3
- package/cjs/utils.js +1 -1
- package/esm/rules/relay-arguments.js +3 -3
- package/esm/utils.js +1 -1
- package/package.json +1 -1
@@ -78,8 +78,8 @@ exports.rule = {
|
|
78
78
|
fieldNode = fieldNode.parent;
|
79
79
|
}
|
80
80
|
const args = Object.fromEntries(((_a = fieldNode.arguments) === null || _a === void 0 ? void 0 : _a.map(argument => [argument.name.value, argument])) || []);
|
81
|
-
const hasForwardPagination =
|
82
|
-
const hasBackwardPagination =
|
81
|
+
const hasForwardPagination = !!(args.first && args.after);
|
82
|
+
const hasBackwardPagination = !!(args.last && args.before);
|
83
83
|
if (!hasForwardPagination && !hasBackwardPagination) {
|
84
84
|
context.report({
|
85
85
|
node: fieldNode.name,
|
@@ -89,7 +89,7 @@ exports.rule = {
|
|
89
89
|
}
|
90
90
|
function checkField(typeName, argumentName) {
|
91
91
|
const argument = args[argumentName];
|
92
|
-
const hasArgument =
|
92
|
+
const hasArgument = !!argument;
|
93
93
|
let type = argument;
|
94
94
|
if (hasArgument && type.gqlType.kind === graphql_1.Kind.NON_NULL_TYPE) {
|
95
95
|
type = type.gqlType;
|
package/cjs/utils.js
CHANGED
@@ -97,6 +97,6 @@ exports.ARRAY_DEFAULT_OPTIONS = {
|
|
97
97
|
const englishJoinWords = (words) => new Intl.ListFormat('en-US', { type: 'disjunction' }).format(words);
|
98
98
|
exports.englishJoinWords = englishJoinWords;
|
99
99
|
function truthy(value) {
|
100
|
-
return
|
100
|
+
return !!value;
|
101
101
|
}
|
102
102
|
exports.truthy = truthy;
|
@@ -75,8 +75,8 @@ export const rule = {
|
|
75
75
|
fieldNode = fieldNode.parent;
|
76
76
|
}
|
77
77
|
const args = Object.fromEntries(((_a = fieldNode.arguments) === null || _a === void 0 ? void 0 : _a.map(argument => [argument.name.value, argument])) || []);
|
78
|
-
const hasForwardPagination =
|
79
|
-
const hasBackwardPagination =
|
78
|
+
const hasForwardPagination = !!(args.first && args.after);
|
79
|
+
const hasBackwardPagination = !!(args.last && args.before);
|
80
80
|
if (!hasForwardPagination && !hasBackwardPagination) {
|
81
81
|
context.report({
|
82
82
|
node: fieldNode.name,
|
@@ -86,7 +86,7 @@ export const rule = {
|
|
86
86
|
}
|
87
87
|
function checkField(typeName, argumentName) {
|
88
88
|
const argument = args[argumentName];
|
89
|
-
const hasArgument =
|
89
|
+
const hasArgument = !!argument;
|
90
90
|
let type = argument;
|
91
91
|
if (hasArgument && type.gqlType.kind === Kind.NON_NULL_TYPE) {
|
92
92
|
type = type.gqlType;
|
package/esm/utils.js
CHANGED
package/package.json
CHANGED