Skip to content
Source
Sign inSign up
TanStack/query

fix(eslint-plugin-query/exhaustive-deps): check top-level '<script>' variables in '.svelte' files #12553

Openlazerg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12553/headopened View on GitHub

Showing 3 changed files with 64 additions and 2 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/exhaustive-deps-svelte-top-level.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/eslint-plugin-query': patch
+---
+​
+fix(eslint-plugin-query/exhaustive-deps): check top-level `<script>` variables in `.svelte` files
50 additions and 0 deletionspackages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.tsModified
View file
@@ -709,6 +709,20 @@
+ name: 'should pass in Svelte file when deps are correctly included',
+ filename: 'Component.svelte',
+ code: normalizeIndent`
+ import { createQuery } from '@tanstack/svelte-query'
+ import { fetchEntity } from './api'
+​
+ let id = $state(1)
+ const query = createQuery(() => ({
+ queryKey: ['entity', id],
+ queryFn: () => fetchEntity(id),
+ }))
+ `,
+ },