sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
307 stars 38 forks source link

Snippets that use a `() => void` type break eslint when using typescript #904

Closed AlbertMarashi closed 3 weeks ago

AlbertMarashi commented 2 months ago

Describe the bug

There's a weird eslint bug with parsing snippets that contain () => void, even if it is commented out.

Reproduction

<script lang="ts">

</script>

{#snippet editor_button(foo: {
    // onclick: () => void,
})}

{/snippet}

Parsing error: '}' expected.eslint


<script lang="ts">

</script>

{#snippet editor_button(foo: {
    onclick: () => void,
})}

{/snippet}

Parsing error: '=>' expected.eslint

Logs

No response

System Info

System:
    OS: macOS 14.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 108.48 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
    pnpm: 9.7.0 - ~/Library/pnpm/pnpm
    bun: 1.1.18 - ~/.bun/bin/bun
  Browsers:
    Chrome: 128.0.6613.138
    Safari: 17.2
  npmPackages:
    svelte: 5.0.0-next.244 => 5.0.0-next.244

Severity

blocking upgrade

paoloricciuti commented 2 months ago

This feels like a https://github.com/sveltejs/eslint-plugin-svelte issue or a https://github.com/sveltejs/svelte-eslint-parser issue considering that svelte parse this correctly (i can't move it there unfortunately)

ota-meshi commented 3 weeks ago

Duplicate of #872 It has already been fixed.