Skip to content

feat: npx svelte-migrate self-closing-tags #12102

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 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cyan-snails-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-migrate': minor
---

feat: add self-closing-tags migration
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<a href="/about">about</a>
</nav>

<slot />
<slot></slot>
2 changes: 1 addition & 1 deletion packages/create-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/gitignore-parser": "^0.0.3",
"gitignore-parser": "^0.0.2",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"prettier-plugin-svelte": "^3.2.3",
"sucrase": "^3.34.0",
"svelte": "^4.2.10",
"tiny-glob": "^0.2.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/shared/+prettier/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devDependencies": {
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2"
"prettier-plugin-svelte": "^3.2.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Header />

<main>
<slot />
<slot></slot>
</main>

<footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
stageHeight: window.innerHeight,
colors: ['#ff3e00', '#40b3ff', '#676778']
}}
/>
></div>
{/if}

<style>
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/components/layout.svelte
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
2 changes: 1 addition & 1 deletion packages/kit/test/apps/amp/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<slot />
<slot></slot>
<footer>footer</footer>

<style>
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/apps/basics/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setup();
</script>

<slot />
<slot></slot>

<footer>{data.foo.bar}</footer>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
<a href="/accessibility/autofocus/b">autofocus/b</a>
</nav>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<slot />
<slot></slot>

<!-- svelte-ignore a11y-autofocus -->
<input autofocus />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<p id="go-to-element">The browser scrolls to me</p>
</div>
<p id="abcde" style="height: 180vh; background-color: hotpink;">I take precedence</p>
<div />
<div></div>

<a href="/anchor-with-manual-scroll/anchor-afternavigate?x=y#go-to-element">reload me</a>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
<p id="go-to-element">The browser scrolls to me</p>
</div>
<p id="abcde" style="height: 180vh; background-color: hotpink;">I take precedence</p>
<div />
<div></div>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div style="height: 2000px; background: palegoldenrod" />
<div style="height: 2000px; background: palegoldenrod"></div>

<a id="one" href="/data-sveltekit/noscroll/target" data-sveltekit-noscroll>one</a>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div style="height: 2000px; background: palegoldenrod" />
<div style="height: 2000px; background: palegoldenrod"></div>

<h1>target</h1>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</script>

<h1>{decodeURIComponent($page.url.pathname.split('/').pop())}</h1>
<slot />
<slot></slot>

<a href="/encoded/escape-sequences/:-)">:-)</a>
<a href="/encoded/escape-sequences/%23">#</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />;
<slot></slot>;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<iframe title="Child content" src="./child" />
<iframe title="Child content" src="./child"></iframe>
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
</script>

<h1>{data.type} loads: {data.loads}</h1>
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@

<p>layout: {$page.data.count_layout}, page: {$page.data.count_page}</p>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export let data;
</script>

<slot />
<slot></slot>

<pre>{JSON.stringify({
a: data.a,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</script>

<h1>route.id: {data.route.id}</h1>
<slot />
<slot></slot>

<a href="/load/invalidation/route/server/a">/load/invalidation/route/server/a</a>
<a href="/load/invalidation/route/server/b">/load/invalidation/route/server/b</a>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<h1>route.id: {data.route.id}</h1>
<h2>random id: {data.random}</h2>
<slot />
<slot></slot>

<a href="/load/invalidation/route/shared/a">/load/invalidation/route/shared/a</a>
<a href="/load/invalidation/route/shared/b">/load/invalidation/route/shared/b</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="/load/no-server-load/a">a</a>
<a href="/load/no-server-load/b">b</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- TODO remove this file post-https://github.com/sveltejs/kit/issues/5967 -->
<slot />
<slot></slot>

<ul>
<li><a href="/load/unchanged-parent/isolated/a">/load/unchanged-parent/isolated/a</a></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- TODO remove this file post-https://github.com/sveltejs/kit/issues/5967 -->
<slot />
<slot></slot>

<ul>
<li><a href="/load/unchanged/isolated/a">/load/unchanged/isolated/a</a></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<slot />
<slot></slot>
<p id="nested">This is a nested layout component</p>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<slot />
<slot></slot>
<p id="nested-foo">Nested layout foo</p>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<slot />
<slot></slot>
<p id="nested-bar">Nested layout bar</p>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<h1>Layout reset</h1>
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />;
<slot></slot>;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="container">
<span> ^this is not the top of the screen</span>
<div class="spacer" />
<div class="spacer"></div>
</div>

<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="/prerendering/env/prerendered">prerendered</a>
<a href="/prerendering/env/dynamic">dynamic</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

<a href="/routing/b" data-sveltekit-reload>b</a>

<div class="hydrate-test" />
<div class="hydrate-test"></div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<slot />
<slot></slot>

<a href="/routing/cancellation/a">a</a>
<a href="/routing/cancellation/b">b</a>
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<a href="/routing/matched/1">/routing/matched/1</a>
<a href="/routing/matched/everything-else">/routing/matched/everything-else</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>non-greedy</h1>

<slot />
<slot></slot>

<a href="/routing/rest/non-greedy/foo/one/two">foo/one/two</a>
<a href="/routing/rest/non-greedy/food/one/two">food/one/two</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<a href="/routing/rest/path/four">four</a>
<a href="/routing/rest/path/five">five</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
<p data-test-id="pathname-store">{$page.url.pathname}</p>
<p data-test-id="pathname-data">{data.pathname}</p>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

<p>{$page.url.pathname}</p>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1>a</h1>

<div style="height: 200vh; background: teal" />
<div style="height: 200vh; background: teal"></div>

<a data-sveltekit-reload href="/scroll/cross-document/b">b</a>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<nav><a href="/selection/a">a</a> <a href="/selection/b">b</a></nav>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<a href="/shadowed/parent?test">Reload</a>
<a href="/shadowed/parent/sub">Sub</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<a href="/shallow-routing/push-state/a">a</a>
<a href="/shallow-routing/push-state/b">b</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<a href="/shallow-routing/replace-state/a">a</a>
<a href="/shallow-routing/replace-state/b">b</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<a href="/snapshot/b">b</a>
<a href="/snapshot/c" data-sveltekit-reload>c</a>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
<a href="/store/data/zzz">zzz</a> <a href="/store/data/foo">foo</a>
</nav>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
<p>$page.data was updated {count} time(s)</p>
<a href="/store/data/store-updates/a">a</a>
<a href="/store/data/store-updates/b">b</a>
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
{/if}
</div>

<slot />
<slot></slot>
2 changes: 1 addition & 1 deletion packages/kit/test/apps/dev-only/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
setup();
</script>

<slot />
<slot></slot>
2 changes: 1 addition & 1 deletion packages/kit/test/apps/embed/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
setup();
</script>

<slot />
<slot></slot>
2 changes: 1 addition & 1 deletion packages/kit/test/apps/no-ssr/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
setup();
</script>

<slot />
<slot></slot>
2 changes: 1 addition & 1 deletion packages/kit/test/apps/options-2/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
setup();
</script>

<slot />
<slot></slot>
2 changes: 1 addition & 1 deletion packages/kit/test/apps/options/source/pages/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
setup();
</script>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
</script>

<slot />
<slot></slot>

<footer>Custom layout</footer>
2 changes: 1 addition & 1 deletion packages/kit/test/apps/writes/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
setup();
</script>

<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<slot />
<slot></slot>
Loading