Skip to content

svelte5 - custom attributes like src must be removed from tag when preprocessing them #652

Open
@dominikg

Description

@dominikg

Describe the bug
A recent change in svelte5 made attributes on <script> protected. Proprocessors using custom attributes must remove them to avoid warnings

/home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/e2e-tests/svelte-preprocess/src/lib/multifile/MultiFile.svelte
  2:19  error  Unrecognized attribute — should be one of `generics`, `lang` or `module`. If this exists for a preprocessor, ensure that the preprocessor removes it(script_unknown_attribute)  svelte/valid-compile

https://github.com/sveltejs/vite-plugin-svelte/pull/960/files#diff-22639710c6daf7afe79020aa0bd65ee0147141762bf41af679f23042a2a4128b

Logs
Please include browser console and server logs around the time this bug occurred.

To Reproduce
clone vite-plugin-svelte repo
remove disable comment: https://github.com/sveltejs/vite-plugin-svelte/blob/12b7af76dac68b4cf3b60bba269aa927a2528716/packages/e2e-tests/svelte-preprocess/src/lib/multifile/MultiFile.svelte#L2

run pnpm lint

Expected behavior
no warning

Information about your project:

latest vite, svelte5-next and svelte-preprocess

Additional context
eslint-plugin-svelte currently makes an error out of this warning, which might be too harsh

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