Skip to content

breaking: new options, deprecate svelteStrictMode #379

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
wants to merge 5 commits into from

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Jul 14, 2023

  • add svelteSelfCloseComponents and svelteSelfCloseElements to specify whether or not empty elements/components should self-close. svelteStrictMode no longer has any effect on this behavior.
    • an alternative to this would to not have these options and instead do whatever the user specified. In other words, if the user says <div></div> it stays as this, and if the user says <div /> that also stays like this. This is what Prettier currently does in both HTML and JSX
  • svelteAllowShorthand now takes precedence over svelteStrictMode, which no longer has any effect on that behavior
  • svelteStrictMode is deprecated as future Svelte versions might coerce numbers coming from mustache tags inside strings into strings

closes #348
closes #284
closes #279
closes #238
related to #377

dummdidumm and others added 5 commits December 11, 2022 21:30
* refactor: Remove deprecated concat

* Remove Concat node checks
Updates the code base to using prettier v3. This required a refactoring of embeds since the call timing is now different

---------

Co-authored-by: Simon H <[email protected]>
Co-authored-by: Rolaka <[email protected]>
Co-authored-by: Simon Holthausen <[email protected]>
- add `svelteSelfCloseComponents` and `svelteSelfCloseElements` to specify whether or not empty elements/components should self-close. `svelteStrictMode` no longer has any effect on this behavior
- `svelteAllowShorthand` now takes precedence over `svelteStrictMode`, which no longer has any effect on that behavior
- `svelteStrictMode` is deprecated as future Svelte versions might coerce numbers coming from mustache tags inside strings into strings

closes #348
closes #284
closes #279
closes #238
related to #377
@Conduitry
Copy link
Member

To summarize what I said in Discord:

I don't think we should have either svelteSelfCloseComponents or svelteSelfCloseElements as options.

For elements, I think we should either leave them as the user wrote them, or else rewrite them according to whether they're a valid void element in HTML (even though the Svelte compiler doesn't care about that). I don't have a strong opinion one way or the other.

For components, leaving it as the user wrote it would probably be fine, if that's what Prettier does for JSX.

dummdidumm added a commit that referenced this pull request Jul 14, 2023
- whether or not empty elements/components should self-close is now left to the user - in other words, if you write `<div />` or `<Component />` that stays as is, and so does `<div></div>`/`<Component></Component>`. `svelteStrictMode` no longer has any effect on this behavior
- `svelteAllowShorthand` now takes precedence over `svelteStrictMode`, which no longer has any effect on that behavior
- `svelteStrictMode` is deprecated as future Svelte versions might coerce numbers coming from mustache tags inside strings into strings

closes #348
closes #284
closes #279
closes #238
related to #377
superseeds / closes #379 as less options = better
@dummdidumm dummdidumm changed the base branch from next to master July 17, 2023 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants