Skip to content

no-useless-children-snippet

Reports a {#snippet children()} with no parameters inside a component.

It is the same as writing the content in the component, and the longer form hides that.

To fix, write the content without the snippet.

Reported
...
<C>{#snippet children()}hi{/snippet}</C>
<C>{#snippet children(x)}{x}{/snippet}</C>
...
After the fix
...
<C>{#snippet children()}hi{/snippet}</C>
<C>{#snippet children(x)}{x}{/snippet}</C>
...
angular:
lint:
rules:
no-useless-children-snippet: warn # off, warn (default), error
html:
lint:
rules:
no-useless-children-snippet: warn # off, warn (default), error
svelte:
lint:
rules:
no-useless-children-snippet: warn # off, warn (default), error
vue:
lint:
rules:
no-useless-children-snippet: warn # off, warn (default), error

Enabled by the presets: html/eslint-plugin-svelte-recommended.

Suppress one line with sudsy-disable-next-line no-useless-children-snippet in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-svelte no-useless-children-snippet full