Skip to content

fix(no-shadow): ignore {#snippet} if it uses under component #992

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

Closed
wants to merge 1 commit into from

Conversation

baseballyama
Copy link
Member

close: #871

Copy link

changeset-bot bot commented Jan 5, 2025

🦋 Changeset detected

Latest commit: 1a779d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@baseballyama baseballyama force-pushed the fix/no-shadow branch 4 times, most recently from 37cfbd1 to b45d9ec Compare January 5, 2025 04:04
@baseballyama baseballyama changed the title fix(no-shadow): ignore {#snippet} if it uses unser component. fix(no-shadow): ignore {#snippet} if it uses under component Jan 5, 2025
Copy link

pkg-pr-new bot commented Jan 5, 2025

Open in Stackblitz

npm i https://pkg.pr.new/eslint-plugin-svelte@992

commit: 1a779d1

@baseballyama baseballyama force-pushed the fix/no-shadow branch 2 times, most recently from 2dcd746 to d19ddfc Compare January 5, 2025 05:29
@ota-meshi
Copy link
Member

Thank you for working on this.

However, when I saw your implementation on this PR and #995, I had second thoughts.
I think it might be better to change the parser and solve it with a scope manager.

I think it would be better to make the snippet declaration not add variables (remove variables) if they are declared in a component and the declared identifier is not used elsewhere. That way, I think it probably won't affect any other rules.

What do you think?

@baseballyama
Copy link
Member Author

How are the arguments passed to that snippet handled?

@ota-meshi
Copy link
Member

ota-meshi commented Jan 14, 2025

They should be added to the scope and processed.
I think the snippet would be treated like an anonymous function expression.

@baseballyama
Copy link
Member Author

They should be added to the scope and processed.
I think the snippet would be treated like an anonymous function expression.

I think it's good!

@baseballyama baseballyama deleted the fix/no-shadow branch January 16, 2025 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nesting components with Svelte 5 snippet parameters with the same name can cause ESLint errors
2 participants