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

feat: added the no-useless-children-snippet rule #922

Merged
merged 3 commits into from
Dec 31, 2024

Conversation

marekdedic
Copy link
Contributor

@marekdedic marekdedic commented Nov 22, 2024

Closes #909

Copy link

changeset-bot bot commented Nov 22, 2024

🦋 Changeset detected

Latest commit: 4a0df5a

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 Minor

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

@marekdedic marekdedic force-pushed the no-useless-children-snippet branch from 513b696 to 71d34e7 Compare November 22, 2024 10:14
@marekdedic
Copy link
Contributor Author

Blocked by #923 which causes the CI errors

@marekdedic marekdedic marked this pull request as ready for review November 22, 2024 10:30
@ota-meshi ota-meshi force-pushed the no-useless-children-snippet branch from 71d34e7 to f2eaca6 Compare November 27, 2024 07:22
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR! The implementation looks good, but I think we need to fix CI errors.
Could you please put a _requirements.json with {"svelte": ">=5.0.0"} in test fixtures directories to exclude old Svelte tests?
Could you also fix the linting errors?

https://github.com/sveltejs/eslint-plugin-svelte/blob/main/packages/eslint-plugin-svelte/tests/fixtures/rules/no-inner-declarations/invalid/_requirements.json

@marekdedic marekdedic force-pushed the no-useless-children-snippet branch 5 times, most recently from 95f0ab5 to 7722590 Compare November 30, 2024 09:48
@marekdedic marekdedic requested a review from ota-meshi November 30, 2024 09:51
@ota-meshi
Copy link
Member

ota-meshi commented Dec 2, 2024

This PR is looks good, but I made this package ESM.
#932

Could you please merge the main branch and fix it by adding .js to the import statement of your implementation?

@marekdedic marekdedic force-pushed the no-useless-children-snippet branch 3 times, most recently from 742f7c6 to cbf6225 Compare December 2, 2024 11:15
@marekdedic
Copy link
Contributor Author

Done :)

Copy link
Member

@baseballyama baseballyama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cases like this code, “Found an unnecessary children snippet.” appears, but this is incorrect. It would be better to only inspect inside Svelte components.

{#snippet children()}
  Hi!
{/snippet}

{@render children()}

https://svelte.dev/playground/hello-world?version=5.16.0#H4sIAAAAAAAAE23LywrCMBSE4Vep46aFovusdNd3sC5qM2IgnobkeCPk3SWgC8HtN_9kyHQlDAZ6vzSPJXrbtLROaTv0ODvPBHPI0FeoXQX039c-hE2602u105T4z-dFlKIJBnmdxIVAbeaL8zZS2q6MMurgVqPk7WetJHkXKZbxN0UP5VNhNN5YjuUNEZNJhcEAAAA=

@marekdedic marekdedic force-pushed the no-useless-children-snippet branch from cbf6225 to ce84da4 Compare December 30, 2024 16:46
Copy link

pkg-pr-new bot commented Dec 30, 2024

Open in Stackblitz

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

commit: 4a0df5a

@marekdedic marekdedic force-pushed the no-useless-children-snippet branch from ce84da4 to 4a0df5a Compare December 30, 2024 16:58
@marekdedic
Copy link
Contributor Author

@baseballyama Good catch, fixed & added it as a test :)

@baseballyama baseballyama merged commit f4a0fa7 into sveltejs:main Dec 31, 2024
18 checks passed
@marekdedic marekdedic deleted the no-useless-children-snippet branch December 31, 2024 13:25
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.

Add rule no-useless-children-snippet
3 participants