pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
svelte/no-dynamic-slot-name |
disallow dynamic slot name |
v0.14.0 |
disallow dynamic slot name
- ⚙️ This rule is included in
"plugin:svelte/recommended"
. - 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
This rule reports the dynamically specified <slot>
name.
Dynamic <slot>
names are not allowed in Svelte, so you must use static names.
The auto-fix of this rule can be replaced with a static <slot>
name if the expression given to the <slot>
name is static and resolvable.
<script>
/* eslint svelte/no-dynamic-slot-name: "error" */
const SLOT_NAME = 'bad';
</script>
<!-- ✓ GOOD -->
<slot name="good" />
<!-- ✗ BAD -->
<slot name={SLOT_NAME} />
Nothing.
This rule was introduced in eslint-plugin-svelte v0.14.0