Skip to content

migration: named slots collision with javascript keywordsΒ #14277

@TorstenDittmann

Description

@TorstenDittmann

Describe the bug

Using named slots with a name that is a reserved keyword in JS, will create a broken snippet πŸ‘πŸ»

Probably all of these will affect migration => https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords

Create a PR that will re-use the @migration-task logic => #14278

Reproduction

having

<slot name="new">
    ...
</slot>

will create following in migration:

{#snippet new()}

and results into the following error:

ts: 'new' is a reserved word in JavaScript and cannot be used here

Logs

No logs during migration

System Info

System:
    OS: macOS 15.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 85.53 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
    npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
    pnpm: 9.7.0 - ~/.nvm/versions/node/v20.13.1/bin/pnpm
    bun: 1.1.30 - ~/.bun/bin/bun
  Browsers:
    Chrome: 130.0.6723.117
    Safari: 18.1
  npmPackages:
    svelte: ^5.0.0 => 5.1.15

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions