Skip to content
Source
Sign inSign up
TanStack/query

fix(eslint-plugin): exhaustive-deps with variables and type assertions (#9643) #9687

Mergedfbieler(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/9687/headmerged by TkDodo View on GitHub

Showing 3 changed files with 101 additions and 19 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/cold-falcons-warn.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/eslint-plugin-query': patch
+---
+​
+fix: exhaustive-deps with variables and type assertions
57 additions and 0 deletionspackages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.tsModified
View file
@@ -227,6 +227,39 @@
+ name: 'should pass with queryKeyFactory result assigned to a variable',
+ code: `
+ function fooQueryKeyFactory(dep: string) {
+ return ["foo", dep];
+ }
+​
+ const useFoo = (dep: string) => {
+ const queryKey = fooQueryKeyFactory(dep);
+ return useQuery({
+ queryKey,
+ queryFn: () => Promise.resolve(dep),
+ })
+ }