# svelte/no-useless-children-snippet
disallow explicit children snippet where itβs not needed
- βοΈ This rule is included in
"plugin:svelte/recommended"
.
# π Rule Details
Any content inside component tags that is not a snippet declaration implicitly becomes part of the children snippet. Thus, declaring the children snippet explicitly is only necessary when the snippet has parameters.
<script> /* eslint svelte/no-useless-children-snippet: "error" */ import { Foo } from './Foo.svelte'; </script> <!-- β GOOD --> <Foo> {#snippet bar()} Hello {/snippet} </Foo> <Foo> {#snippet children(val)} Hello {val} {/snippet} </Foo> <Foo>Hello</Foo> <!-- β BAD --> <Foo> Found an unnecessary children snippet. (svelte/no-useless-children-snippet){#snippet children()} Hello {/snippet} </Foo>
# π§ Options
Nothing.
# π Version
This rule was introduced in eslint-plugin-svelte v3.0.0-next.9