Skip to content

@typescript-eslint/no-shadow maybe shouldn't trigger on Snippets? #908

Closed
@marekdedic

Description

@marekdedic

Description

Hi, the rule @typescript-eslint/no-shadow now triggers on snippets like this:

<ComponentWithSnippet>
  {#snippet children()}
    <AnotherComponentWithSnippet>
      {#snippet children()}
        Hello!
      {/snippet}
    </AnotherComponentWithSnippet>
  {/snippet}
</ComponentWithSnippet>

This results on an error on the second children function (children' is already declared in the upper scope on line ...). However, this is probably (?) Mostly a false positive - you aren't actually shadowing a meaningful function or variable and you cannot really always control Snippet names (e.g. when they come from a 3rd party library) and you want to use the name children if possible...

Could we change the rule/parsing/...? so that this rule never triggers on snippets? I can't come up with an example where you'd actually want the rule to trigger on snippets, but maybe there is some?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions