Repository navigation
feat: add vue/no-duplicate-class-names rule - #2934
Conversation
🦋 Changeset detectedLatest commit: d98ca00 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! |
FloEdelmann
left a comment
There was a problem hiding this comment.
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 |
FloEdelmann
left a comment
There was a problem hiding this comment.
Looks good to me 🙂
Thank you! 🥳
There was a problem hiding this comment.
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.
waynzh
left a comment
There was a problem hiding this comment.
Everything looks good to me, except there might be one case that needs additional handling.
resolves #2932