Skip to content

feat: add vue/prefer-v-model rule#3062

Merged
waynzh merged 8 commits intomasterfrom
prefer-v-model
Mar 27, 2026
Merged

feat: add vue/prefer-v-model rule#3062
waynzh merged 8 commits intomasterfrom
prefer-v-model

Conversation

@FloEdelmann
Copy link
Copy Markdown
Member

Fixes #2237.

FloEdelmann and others added 5 commits March 25, 2026 16:00
Suggests replacing `:prop`/`@update:prop` pairs with `v-model` on custom
components. Handles both `foo = $event` and `(val) => foo = val` handler
forms, camelCase/kebab-case normalization, and modelValue shorthand.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: aeeedf1

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 Minor

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 requested a review from Copilot March 25, 2026 15:19
@FloEdelmann FloEdelmann changed the title feat: add vue/prefer-v-model rule (#2237) feat: add vue/prefer-v-model rule Mar 25, 2026
Copy link
Copy Markdown
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

Adds a new Vue rule (vue/prefer-v-model) to suggest simplifying :prop + @update:prop pairs into v-model usage in Vue 3 templates (Fixes #2237).

Changes:

  • Implement vue/prefer-v-model rule with suggestion-based autofix output.
  • Add comprehensive rule tests covering valid/invalid patterns and suggestion outputs.
  • Register the rule in the plugin and add documentation + docs index entry.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/lib/rules/prefer-v-model.test.ts Adds RuleTester coverage for the new rule, including suggestion outputs.
lib/rules/prefer-v-model.ts Implements detection and suggestion generation for v-model replacements.
lib/plugin.ts Registers prefer-v-model in the exported rules map.
docs/rules/prefer-v-model.md Adds end-user documentation and examples for the new rule.
docs/rules/index.md Adds the rule to the docs rules table and reference links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

FloEdelmann and others added 2 commits March 25, 2026 16:34
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@waynzh waynzh left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

@waynzh waynzh merged commit 8cb00fb into master Mar 27, 2026
18 checks passed
@waynzh waynzh deleted the prefer-v-model branch March 27, 2026 13:09
@github-actions github-actions bot mentioned this pull request Mar 16, 2026
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.

Rule proposal: vue/prefer-v-model

4 participants