Skip to content

fix(no-unused-class-name): detect duplicated class names #1260

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

Merged
merged 3 commits into from
Jun 27, 2025

Conversation

tbashiyy
Copy link
Contributor

close #1259

Copy link

changeset-bot bot commented Jun 27, 2025

🦋 Changeset detected

Latest commit: ffc2030

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

Copy link
Contributor

github-actions bot commented Jun 27, 2025

Try the Instant Preview in Online Playground

ESLint Online Playground

Install the Instant Preview to Your Local

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

Published Instant Preview Packages:

View Commit

@baseballyama baseballyama self-assigned this Jun 27, 2025
Comment on lines +39 to +42
const classesUsedInTemplate: {
className: string;
loc: AST.SourceLocation;
}[] = [];
Copy link
Member

Choose a reason for hiding this comment

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

Is this better in terms of performance?

Suggested change
const classesUsedInTemplate: {
className: string;
loc: AST.SourceLocation;
}[] = [];
const classesUsedInTemplate: Record<string, AST.SourceLocation[] = {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think performance is no changes for now.
Because this code just execute by loop. (No access by key.)

If data structure is changed, I think code will be complex a little for now.

@baseballyama baseballyama changed the title fix(no-unused-class-name): fix detect duplicated class name fix(no-unused-class-name): detect duplicated class names Jun 27, 2025
Co-authored-by: Yuichiro Yamashita <[email protected]>
@baseballyama baseballyama merged commit a51363f into sveltejs:main Jun 27, 2025
17 checks passed
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.

Cannnot detect all unused-class-name codes
2 participants