Visitar URL original
fix(prefer-separate-static-class): ignore `.attr` and `.prop` class bindings by ValentinYoushkevich · Pull Request #3219 · vuejs/eslint-plugin-vue · GitHub
Skip to content

fix(prefer-separate-static-class): ignore .attr and .prop class bindings - #3219

Merged
waynzh merged 2 commits into
vuejs:masterfrom
ValentinYoushkevich:fix/prefer-separate-static-class-attr-modifier
Oct 30, 2026
Merged

waynzh merged 2 commits into
vuejs:masterfrom
ValentinYoushkevich:fix/prefer-separate-static-class-attr-modifier

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

vue/prefer-separate-static-class reports :class.attr="'emoji-trigger'" and :class.prop="'hint'" like a plain :class, and --fix turns them into class="...", which changes what renders. Vue compiles these modifiers into ^class and .class keys (vBind.ts), so the value skips class normalization and fallthrough merging, and runtime-dom writes it as a raw attribute or as the class DOM property instead of calling patchClass (patchProp.ts). Moving such a value into a static class attribute isn't an equivalent rewrite. Playground: all three lines are reported on 10.12.0, only the plain :class one should be.

The rule now skips v-bind:class with .attr or .prop, including the .class shorthand. .camel is still reported, since it leaves class unchanged.

Fixes #2534

@ValentinYoushkevich ValentinYoushkevich mentioned this pull request Oct 27, 2026
2 tasks done
@changeset-bot

changeset-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ced63a4

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

@FloEdelmann FloEdelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@FloEdelmann
FloEdelmann requested a review from a team October 27, 2026 12:09

@waynzh waynzh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@waynzh
waynzh merged commit 10c05d8 into vuejs:master Oct 30, 2026
17 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to ignore :class.attr

3 participants