Skip to content

Svelte 5: Can we have strict mode? #9416

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

Closed
oodavid opened this issue Nov 13, 2023 · 3 comments · Fixed by #11203
Closed

Svelte 5: Can we have strict mode? #9416

oodavid opened this issue Nov 13, 2023 · 3 comments · Fixed by #11203
Labels
Milestone

Comments

@oodavid
Copy link

oodavid commented Nov 13, 2023

Describe the problem

When testing svelte 5, I want to get warnings (or errors) when using the svelte features that have been superseded in Svelte 5, ie:

GoodbyeHello
storesrunes
getters & settersclasses
slotsnippet & render
on:xonx

I respect (and need!) backwards compatibility, but I love the small surface-area of Svelte. With Svelte 5 I'm not thrilled at the idea of different team-members adopting different approaches. it sounds... complex

Describe the proposed solution

Have a flag in our config files, AND on the documentation

Alternatives considered

Swallow sadness

Importance

would make my life easier

@dummdidumm
Copy link
Member

Only on:x and slot can really be considered as warnings. getters/setters still have their place, it's not in any way discouraged to use them - classes are just another tool at your disposal now. Stores are similar, for modeling complex asynchronous streams of data they are still very good. So the latter two feel more like something that would go into eslint-plugin-svelte as optional rules.

@bfanger
Copy link
Contributor

bfanger commented Mar 30, 2024

+1 for reporting <slot /> and on:event as deprecation warnings when in runes mode.

Maybe change the wording of

They continue to work, however, and you can mix and match snippets and slots in your components.

https://svelte-5-preview.vercel.app/docs/snippets

into a stronger stance .

@Rich-Harris Rich-Harris modified the milestones: 5.x, 5.0 Apr 1, 2024
@Rich-Harris
Copy link
Member

Moving this to the 5.0 milestone — agree that warning on on:x and <slot> in runes mode is probably a good idea, and we probably don't want to start doing so in a minor

dummdidumm added a commit that referenced this issue Apr 17, 2024
- warn on slots and event handlers in runes mode
- error on `<slot>` + `{@render ...}` tag usage in same component

closes #9416
Rich-Harris pushed a commit that referenced this issue Apr 17, 2024
* breaking: warn/error on old syntax in runes mode

- warn on slots and event handlers in runes mode
- error on `<slot>` + `{@render ...}` tag usage in same component

closes #9416

* render tag + slot could occur in legacy mode as well, error there, too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants