From 09ea463ecf3b2c04c765c028092b6ed2d553bde1 Mon Sep 17 00:00:00 2001 From: rzzf Date: Thu, 11 Dec 2025 13:48:30 +0800 Subject: [PATCH 1/2] fix(vue/valid-v-for): allow using an empty alias in value --- lib/rules/valid-v-for.js | 2 +- tests/lib/rules/valid-v-for.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/rules/valid-v-for.js b/lib/rules/valid-v-for.js index 21781142b..dc9686fe3 100644 --- a/lib/rules/valid-v-for.js +++ b/lib/rules/valid-v-for.js @@ -163,7 +163,7 @@ module.exports = { const key = lhs[1] const index = lhs[2] - if (value === null) { + if (value === null && !key) { context.report({ node: expr, messageId: 'invalidEmptyAlias' diff --git a/tests/lib/rules/valid-v-for.js b/tests/lib/rules/valid-v-for.js index 451b86811..b47ca59dc 100644 --- a/tests/lib/rules/valid-v-for.js +++ b/tests/lib/rules/valid-v-for.js @@ -46,6 +46,14 @@ tester.run('valid-v-for', rule, { filename: 'test.vue', code: '' }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, { filename: 'test.vue', code: '' @@ -183,11 +191,6 @@ tester.run('valid-v-for', rule, { code: '', errors: ["'v-for' directives require that attribute value."] }, - { - filename: 'test.vue', - code: '', - errors: ["Invalid alias ''."] - }, { filename: 'test.vue', code: '', From 3ea9630db961316c09164fa21549bda770b461d4 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 11 Dec 2025 09:22:43 +0100 Subject: [PATCH 2/2] Add changeset --- .changeset/silly-falcons-explain.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/silly-falcons-explain.md diff --git a/.changeset/silly-falcons-explain.md b/.changeset/silly-falcons-explain.md new file mode 100644 index 000000000..0f4ed5415 --- /dev/null +++ b/.changeset/silly-falcons-explain.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": patch +--- + +Fix `vue/valid-v-for` rule to allow empty value alias