Skip to content

Commit cd8ce3d

Browse files
committed
Fixed #648
1 parent 501a409 commit cd8ce3d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/rules/valid-v-model.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ module.exports = {
156156
context.report({
157157
node,
158158
loc: node.loc,
159-
message: "'v-model' directives cannot update the iteration variable 'x' itself."
159+
message: "'v-model' directives cannot update the iteration variable '{{varName}}' itself.",
160+
data: { varName: id.name }
160161
})
161162
}
162163
}

tests/lib/rules/valid-v-model.js

+5
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ tester.run('valid-v-model', rule, {
161161
filename: 'test.vue',
162162
code: '<template><div><div v-for="x in list"><input v-model="(((x)))"></div></div></template>',
163163
errors: ["'v-model' directives cannot update the iteration variable 'x' itself."]
164+
},
165+
{
166+
filename: 'test.vue',
167+
code: '<template><div><div v-for="e in list"><input v-model="e"></div></div></template>',
168+
errors: ["'v-model' directives cannot update the iteration variable 'e' itself."]
164169
}
165170
]
166171
})

0 commit comments

Comments
 (0)