Skip to content

Conversation

@rzzf
Copy link
Contributor

@rzzf rzzf commented Dec 11, 2025

resolves #2733

This is indeed valid syntax.
See Vue Playground

@changeset-bot
Copy link

changeset-bot bot commented Dec 11, 2025

🦋 Changeset detected

Latest commit: 3ea9630

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.

Thank you for looking into it. Looks good to me 🙂

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 the vue/valid-v-for rule to correctly allow empty value aliases in v-for directives, such as v-for="(, key) in obj", which is valid Vue.js syntax when you only need the key/index from an iteration.

Key Changes:

  • Updated validation logic to only report an error when both value and key are empty
  • Added test cases for the newly allowed syntax patterns
  • Removed incorrectly failing test case

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
lib/rules/valid-v-for.js Modified the empty alias validation to allow empty value when a key is present
tests/lib/rules/valid-v-for.js Added valid test cases for (, key) and (, key, index) patterns; removed false-positive invalid test
.changeset/silly-falcons-explain.md Added changeset documenting the patch-level fix

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

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/valid-v-for should not trigger on looping through only keys of an object

2 participants