-
-
Notifications
You must be signed in to change notification settings - Fork 700
fix(vue/no-duplicate-class-names): improve non-intersecting conditions and combining parents #2980
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
Conversation
🦋 Changeset detectedLatest commit: 791d65e 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 |
FloEdelmann
left a comment
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.
Nice, thank you for the quick fix! 🙂
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 fixes issue #2974 by improving duplicate class name detection in the vue/no-duplicate-class-names rule. The fix addresses false positives when class names appear in non-intersecting conditional expressions, while correctly detecting duplicates within combining expressions (BinaryExpression and TemplateLiteral).
Key Changes:
- Added
parentExprparameter tracking to identify the parent expression context for each class name - Modified LogicalExpression handling to mark the right side as always conditional (
unconditional=false) - Enhanced duplicate detection logic to consider class names in different LogicalExpressions as non-intersecting (not duplicates) unless one is unconditional or they share the same combining parent
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/rules/no-duplicate-class-names.js | Implements parent expression tracking throughout extractClassNodes function and updates duplicate detection logic to distinguish between non-intersecting conditions and combining expressions |
| tests/lib/rules/no-duplicate-class-names.js | Adds comprehensive test coverage for non-intersecting conditions (nested objects, multiple logical expressions, binary in logical) and duplicate detection in combining expressions (binary and template literals within logical expressions) |
| .changeset/major-planes-fly.md | Documents the patch fix for false positives in non-intersecting conditions and improved duplicate detection in combining expressions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'll merge this and release another patch version, but feel free to review this after merging @ota-meshi and @waynzh! |
This PR fixes #2974 and adds its respective test case
Also added additional tests for edge cases with combining parents including: