Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marekdedic opened this issue Nov 8, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@marekdedic
Copy link
Contributor

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?

@marekdedic marekdedic added the enhancement New feature or request label Nov 8, 2024
@marekdedic
Copy link
Contributor Author

Hmm, sorry, now I found #871, which is very similar....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant