sveltejs / svelte-eslint-parser

Svelte parser for ESLint
https://sveltejs.github.io/svelte-eslint-parser/
MIT License
90 stars 19 forks source link

Conflict with `lib.dom.d.ts` when using runes #557

Open AlbertMarashi opened 1 month ago

AlbertMarashi commented 1 month ago

Before You File a Bug Report Please Confirm You Have Done The Following...

What version of ESLint are you using?

What version of eslint-plugin-svelte and svelte-eslint-parser are you using?

What did you do?

https://sveltejs.github.io/svelte-eslint-parser/virtual-script-code/#eJyrVkrOT0lVslKyKU4uyiwoUchJzEu3jVEqKY5RsovJy0ktUahWyEvMTVWotYKyrBSKS4oy89IVahVsFVQKivILijU0Y/Ji8mz0IWYA9cH0KNUCAEUdIQ4=

<script lang="ts">
let { name }: { name: string } = $props()

</script>
{ name }

What did you expect to happen?

Name should be able to be defined and not conflict with globals

What actually happened?

It conflicts with the DOM lib globals

Link to GitHub Repo with Minimal Reproducible Example

https://sveltejs.github.io/svelte-eslint-parser/virtual-script-code/#eJyrVkrOT0lVslKyKU4uyiwoUchJzEu3jVEqKY5RsovJy0ktUahWyEvMTVWotYKyrBSKS4oy89IVahVsFVQKivILijU0Y/Ji8mz0IWYA9cH0KNUCAEUdIQ4=

Additional comments

No response

AlbertMarashi commented 1 month ago

Adding an export {} to the end of the virtual script code resolves this issue, as it forces typescript to treat the module as an actual module