Skip to content

fix(no-duplicate-class-names): check the joined string of concatenations and template literals - #3285

Open
ValentinYoushkevich wants to merge 3 commits into
vuejs:masterfrom
ValentinYoushkevich:fix/no-duplicate-class-names-template-prefix
Open

ValentinYoushkevich wants to merge 3 commits into
vuejs:masterfrom
ValentinYoushkevich:fix/no-duplicate-class-names-template-prefix

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

vue/no-duplicate-class-names split each part of a string concatenation or template literal as a complete class list. So Vuetify's docs :class="`text-${size} font-weight-${weight} text-${color}`" (Headline.vue#L4) get Duplicate class name 'text-', 'tag' + 'tag tag' (tagtag tag) is reported and autofixed to 'tag' + 'tag', which drops tag, and 'ta' + 'g tag' (tag tag) is not reported (playground).

Now the rule joins the parts before splitting class names. A class name joined with an expression is skipped as ambiguous. A duplicate inside one string keeps the autofix, which no longer breaks template parts next to ${} (`${a} b b` became `${a} b}`), and one that spans several parts is reported without a fix.

Fixes #3283

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4791f8a

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

This branch has not been deployed

No deployments
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.

vue/no-duplicate-class-names splits concatenated strings before class names are formed

1 participant