diff --git a/lib/rules/valid-v-model.js b/lib/rules/valid-v-model.js index 426cf6be2..757c169e4 100644 --- a/lib/rules/valid-v-model.js +++ b/lib/rules/valid-v-model.js @@ -147,7 +147,7 @@ module.exports = { for (const reference of node.value.references) { const id = reference.id - if (id.parent.type === 'MemberExpression' || id.parent.type === 'BinaryExpression') { + if (id.parent.type !== 'VExpressionContainer') { continue } diff --git a/tests/lib/rules/valid-v-model.js b/tests/lib/rules/valid-v-model.js index 191a04294..80cd4eb15 100644 --- a/tests/lib/rules/valid-v-model.js +++ b/tests/lib/rules/valid-v-model.js @@ -75,6 +75,38 @@ tester.run('valid-v-model', rule, { filename: 'test.vue', code: '' }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, + { + filename: 'test.vue', + code: '' + }, { filename: 'test.vue', code: '' @@ -119,6 +151,16 @@ tester.run('valid-v-model', rule, { filename: 'test.vue', code: '', errors: ["'v-model' directives cannot update the iteration variable 'x' itself."] + }, + { + filename: 'test.vue', + code: '', + errors: ["'v-model' directives cannot update the iteration variable 'x' itself."] + }, + { + filename: 'test.vue', + code: '', + errors: ["'v-model' directives cannot update the iteration variable 'x' itself."] } ] })