noSvelteExportLet (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Rule available since:
v2.5.15 - Diagnostic Category:
lint/nursery/noSvelteExportLet - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noSvelteExportLet": "error" } } }}Description
Section titled “Description”Disallow declaring Svelte component props with export let.
Svelte 5 declares component props with the $props() rune. Exporting a let or var
binding from the instance <script> is the legacy way of declaring props: it opts the
component into legacy mode, and it is a compile error in runes mode.
Exports from a <script module> block are regular module exports, not props, so they
are ignored.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<script>export let name;</script>code-block.svelte:2:1 lint/nursery/noSvelteExportLet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Declaring component props with export let is legacy Svelte syntax.
1 │ <script>
> 2 │ export let name;
│ ^^^^^^^^^^
3 │ </script>
4 │
ℹ Svelte 5 declares props with the $props() rune. Declaring props with export makes the component run in legacy mode, and is a compile error in runes mode.
ℹ Destructure the props from $props() instead, for example: let { name } = $props();. See the Svelte 5 migration guide.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<script>let className;export { className as class };</script>code-block.svelte:3:10 lint/nursery/noSvelteExportLet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Exporting className declares a component prop with legacy Svelte syntax.
1 │ <script>
2 │ let className;
> 3 │ export { className as class };
│ ^^^^^^^^^^^^^^^^^^
4 │ </script>
5 │
ℹ Svelte 5 declares props with the $props() rune. Declaring props with export makes the component run in legacy mode, and is a compile error in runes mode.
ℹ Destructure the props from $props() instead, for example: let { name } = $props();. See the Svelte 5 migration guide.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<script>let { name, class: className } = $props();</script><script module>export let count = 0;</script>References
Section titled “References”Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.