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 consistent-selector-style rule #925

Merged
merged 9 commits into from
Jan 15, 2025

Conversation

marekdedic
Copy link
Contributor

Closes #898

Copy link

changeset-bot bot commented Nov 22, 2024

🦋 Changeset detected

Latest commit: 70e1add

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 consistent-selector-style branch from a0301c4 to df5843e Compare November 22, 2024 15:38
@marekdedic marekdedic force-pushed the consistent-selector-style branch 3 times, most recently from 49a6b98 to e963ca7 Compare December 6, 2024 00:00
@marekdedic marekdedic force-pushed the consistent-selector-style branch 17 times, most recently from 55843f5 to 219c6c0 Compare December 14, 2024 23:09
@marekdedic
Copy link
Contributor Author

Hi, @ota-meshi! This one is I think ready for review, however, it needs sveltejs/svelte-eslint-parser#619 and #965 first.

@marekdedic marekdedic force-pushed the consistent-selector-style branch 2 times, most recently from 6f4d51b to e2829bf Compare January 3, 2025 11:12
Copy link

pkg-pr-new bot commented Jan 3, 2025

Open in Stackblitz

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

commit: 70e1add

@marekdedic marekdedic force-pushed the consistent-selector-style branch from e2829bf to d40acf7 Compare January 3, 2025 11:16
typeSelections: Map<string, AST.SvelteHTMLElement[]>
): boolean {
const types = new Set(selection.map((node) => node.name.name));
if (types.size > 1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't report any selection which could be replaced by multiple type selections (e.g. replacing .emphasized {} by i, b {}). That can be added later I think (maybe gated with a configuration option?)

@marekdedic marekdedic force-pushed the consistent-selector-style branch from d40acf7 to 88b68e3 Compare January 3, 2025 14:36
@marekdedic marekdedic marked this pull request as ready for review January 3, 2025 14:36
@marekdedic marekdedic force-pushed the consistent-selector-style branch 2 times, most recently from ffef936 to 3ba8c93 Compare January 11, 2025 19:39
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!
I have a few comments.

@marekdedic marekdedic force-pushed the consistent-selector-style branch from 3ba8c93 to e2157ea Compare January 14, 2025 09:10
@marekdedic marekdedic requested a review from ota-meshi January 14, 2025 09:22
@marekdedic marekdedic force-pushed the consistent-selector-style branch from c066569 to b1253f7 Compare January 14, 2025 09:24
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.

LGTM! Thank you!

@ota-meshi ota-meshi merged commit faf90ef into sveltejs:main Jan 15, 2025
17 checks passed
@marekdedic marekdedic deleted the consistent-selector-style branch January 15, 2025 08:31
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 consistent-selector-style
2 participants