-
-
Notifications
You must be signed in to change notification settings - Fork 696
feat: add vue/no-duplicate-class-names
rule
#2934
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
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: fde5af0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
I believe this rule is now ready! |
related to vuejs#2932 discussion
…ents related to vuejs#2932 discussion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Sorry that reviewing took so long. I only have a few small suggestions/requests; in general the code looks really good! 🙂
Hi! No problem, thanks for the review 🙂, I just applied your suggestions and requests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🙂
Thank you! 🥳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new ESLint rule vue/no-duplicate-class-names
that detects and automatically fixes duplicate class names in Vue template class attributes and directives.
Key changes:
- Implements comprehensive duplicate class detection across static attributes, dynamic bindings, arrays, objects, conditionals, and binary expressions
- Provides automatic fixing that preserves original spacing when removing duplicates
- Detects duplicates both within single attributes and across static/dynamic class attributes
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
lib/rules/no-duplicate-class-names.js | Core rule implementation with duplicate detection logic and auto-fix functionality |
tests/lib/rules/no-duplicate-class-names.js | Comprehensive test suite covering valid/invalid cases and various class binding patterns |
lib/index.js | Registers the new rule in the plugin's rule index |
docs/rules/no-duplicate-class-names.md | User-facing documentation with examples and usage guidance |
docs/rules/index.md | Updates rule listing to include the new rule |
.changeset/ten-lines-fail.md | Changelog entry for the new feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
resolves #2932