Skip to content

Commit

Permalink
fix(eslint-plugin): ignore internal properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Newbie012 committed Mar 11, 2023
1 parent b8b0562 commit 8614233
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,19 @@ ruleTester.run('exhaustive-deps', rule, {
})
`,
},
{
name: 'should not fail if queryKey does not include an internal dependency',
code: normalizeIndent`
useQuery({
queryKey: ["api"],
queryFn: async () => {
const response = Promise.resolve([]);
const data = await response.json();
return data[0].name;
},
});
`,
},
],
invalid: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-query/src/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const ASTUtils = {
}

const references = scope.references
.filter((x) => x.isRead())
.filter((x) => x.isRead() && !scope.set.has(x.identifier.name))
.map((x) => {
const referenceNode = ASTUtils.traverseUpOnly(x.identifier, [
AST_NODE_TYPES.MemberExpression,
Expand Down

0 comments on commit 8614233

Please sign in to comment.