Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: false positives for import vars with TS in svelte/valid-compile #790

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ninety-lobsters-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-svelte": patch
---

fix: false positives for import vars with TS in `svelte/valid-compile`
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function transform(
ts.ScriptTarget.ESNext,
module: ts.ModuleKind.ESNext,
importsNotUsedAsValues: ts.ImportsNotUsedAsValues.Preserve,
preserveValueImports: true,
Copy link
Member

@dummdidumm dummdidumm Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That option is deprecated since TypeScript 5.0 and AFAIK will not do anything anymore starting 5.5. (not sure if this also applies to transpileModule, but definitely when running tsc). I think it's better to use verbatimModuleSyntax instead, assuming a TS version that has it is the minimum required version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comment!
I knew it was deprecated, but I didn't know it would be removed in 5.5. It seems that we need to specify both so that it works with older versions of typescript 😅

sourceMap: true
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
</script>

{$page}
Loading