Skip to content

Files

Latest commit

 

History

History
36 lines (23 loc) · 907 Bytes

no-dynamic-slot-name.md

File metadata and controls

36 lines (23 loc) · 907 Bytes

Pattern: Use of dynamic <slot> name

Issue: -

Description

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} />

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-svelte v0.14.0

🔍 Implementation