-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Nesting components with Svelte 5 snippet parameters with the same name can cause ESLint errors #871
Comments
I think that rule correctly reports shadowing, why do you think it's not ideal? |
Agreed, it's not a bug in ESLint. What's not ideal is that it's quite common for components to accept parameters with the same names, and for them to be nested, so this makes the use of snippets as parameters break in what is likely a common case. |
Oh I see. So snippet tags define variables, but users don't intend variable definitions, and |
https://github.com/eslint/eslint/blob/main/lib/rules/no-shadow.js |
Fixed by sveltejs/svelte-eslint-parser#645. |
Describe the bug
When components in nested scopes use the same snippet names, ESLint's no-shadow rule detects that the inner scope is shadowing the snippet name from the outer scope.
While the example shows a contrived use-case, I ran into this pretty quickly once I started creating reusable UI components. I've temporarily disabled ESLint's no-shadow rule, but of course that isn't ideal.
Reproduction
Example with ESLint configuration on GitHub
Example with the same code on REPL
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: