Skip to content

Commit f7b7649

Browse files
authored
fix: false positives for import vars with TS in svelte/valid-compile (#790)
close #652 This PR fixes the issue mentioned in the comments below. #652 (comment) In the code posted at the top of the thread the rule seems to work correctly, and correctly shows the svelte compiler warnings.
1 parent 23f7bf2 commit f7b7649

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

.changeset/ninety-lobsters-dress.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-svelte": patch
3+
---
4+
5+
fix: false positives for import vars with TS in `svelte/valid-compile`

packages/eslint-plugin-svelte/src/shared/svelte-compile-warns/transform/typescript.ts

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function transform(
3535
ts.ScriptTarget.ESNext,
3636
module: ts.ModuleKind.ESNext,
3737
importsNotUsedAsValues: ts.ImportsNotUsedAsValues.Preserve,
38+
preserveValueImports: true,
3839
sourceMap: true
3940
}
4041
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script lang="ts">
2+
import { page } from '$app/stores';
3+
</script>
4+
5+
{$page}

0 commit comments

Comments
 (0)