Skip to content

Conversation

@Yizack
Copy link
Contributor

@Yizack Yizack commented Nov 26, 2025

This PR fixes #2974 and adds its respective test case

Also added additional tests for edge cases with combining parents including:

  • Non-intersecting conditions with nested objects
  • Binary expressions within logical expressions
  • Template literals within logical expressions

@changeset-bot
Copy link

changeset-bot bot commented Nov 26, 2025

🦋 Changeset detected

Latest commit: 791d65e

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-vue 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
Member

@FloEdelmann FloEdelmann left a 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! 🙂

Copy link
Contributor

Copilot AI left a 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 parentExpr parameter 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.

@FloEdelmann
Copy link
Member

I'll merge this and release another patch version, but feel free to review this after merging @ota-meshi and @waynzh!

@FloEdelmann FloEdelmann merged commit bd4abe5 into vuejs:master Nov 27, 2025
21 checks passed
@github-actions github-actions bot mentioned this pull request Nov 27, 2025
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.

no-duplicate-class-names: reports on the same class names applied under non-intersecting conditions

2 participants