Skip to content

Commit 94b702b

Browse files
authored
Fix incorrect scope analysis for reactive stores (#189)
1 parent 3876861 commit 94b702b

7 files changed

+4821
-0
lines changed

src/parser/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export function parseForESLint(
8585
extractTokens(ctx);
8686
analyzeStoreScope(resultScript.scopeManager!);
8787
analyzeReactiveScope(resultScript.scopeManager!);
88+
analyzeStoreScope(resultScript.scopeManager!); // for reactive vars
8889

8990
// Add $$xxx variable
9091
for (const $$name of ["$$slots", "$$props", "$$restProps"]) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script>
2+
import { writable } from "svelte/store";
3+
4+
const bar = {
5+
foo : writable(0),
6+
};
7+
8+
$: ({ foo } = bar);
9+
10+
$: baz = $foo;
11+
</script>
12+
13+
{baz}

0 commit comments

Comments
 (0)