Skip to content

Add rule no-useless-children-snippet #909

Closed
@marekdedic

Description

@marekdedic

Motivation

Any content inside a component tag becomes the children snippet. Thus, If you have a component with a children snippet without parameters, that's unnecessary.

Description

I'd like to add a rule that bans the children snippet if it has no parameters

Examples

<script>
</script>

<!-- ✓ GOOD -->
<Foo>
  {#snippet bar()}
    Hello
  {/snippet}
</Foo>

<Foo>
  {#snippet children(val)}
    Hello {val}
  {/snippet}
</Foo>

<Foo>
  Hello
</Foo>

<!-- ✗ BAD -->
<Foo>
  {#snippet children()}
    Hello
  {/snippet}
</Foo>

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions