Skip to content

Commit 40257ed

Browse files
committed
fix tests
1 parent 42750a6 commit 40257ed

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/plugin/src/rules/require-id-when-available.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ const rule: GraphQLESLintRule<RequireIdWhenAvailableRuleConfig, true> = {
5858
s => s.kind === 'Field' && s.name.value === fieldName
5959
);
6060

61-
// // check if the parent selection set has the ID field in there
62-
// const { parent } = node as any;
63-
// const hasIdFieldInInterfaceSelectionSet =
64-
// parent &&
65-
// parent.kind === 'InlineFragment' &&
66-
// parent.parent &&
67-
// parent.parent.kind === 'SelectionSet' &&
68-
// !!parent.parent.selections.find(s => s.kind === 'Field' && s.name.value === fieldName);
61+
// check if the parent selection set has the ID field in there
62+
const { parent } = node as any;
63+
const hasIdFieldInInterfaceSelectionSet =
64+
parent &&
65+
parent.kind === 'InlineFragment' &&
66+
parent.parent &&
67+
parent.parent.kind === 'SelectionSet' &&
68+
!!parent.parent.selections.find(s => s.kind === 'Field' && s.name.value === fieldName);
6969

70-
if (!hasIdFieldInSelectionSet) {
70+
if (!hasIdFieldInSelectionSet && !hasIdFieldInInterfaceSelectionSet) {
7171
context.report({
7272
loc: {
7373
start: {

0 commit comments

Comments
 (0)