diff --git a/lib/rules/no-useless-v-bind.js b/lib/rules/no-useless-v-bind.js index 34f0ad033..54584b389 100644 --- a/lib/rules/no-useless-v-bind.js +++ b/lib/rules/no-useless-v-bind.js @@ -132,14 +132,16 @@ module.exports = { let attrValue if (quoteChar === '"') { attrValue = strValue.replace(DOUBLE_QUOTES_RE, '"') + attrValue = quoteChar + attrValue + quoteChar } else if (quoteChar === "'") { attrValue = strValue.replace(SINGLE_QUOTES_RE, ''') + attrValue = quoteChar + attrValue + quoteChar } else { attrValue = strValue .replace(DOUBLE_QUOTES_RE, '"') .replace(SINGLE_QUOTES_RE, ''') } - yield fixer.replaceText(expression, attrValue) + yield fixer.replaceText(value, attrValue) } }) } diff --git a/tests/lib/rules/no-useless-v-bind.js b/tests/lib/rules/no-useless-v-bind.js index 907125cc1..34a76d0df 100644 --- a/tests/lib/rules/no-useless-v-bind.js +++ b/tests/lib/rules/no-useless-v-bind.js @@ -136,6 +136,34 @@ tester.run('no-useless-v-bind', rule, { 'Unexpected `v-bind` with a string literal value.', 'Unexpected `v-bind` with a string literal value.' ] + }, + { + code: ` + `, + output: ` + `, + errors: [ + 'Unexpected `v-bind` with a string literal value.', + 'Unexpected `v-bind` with a string literal value.', + 'Unexpected `v-bind` with a string literal value.', + 'Unexpected `v-bind` with a string literal value.', + 'Unexpected `v-bind` with a string literal value.', + 'Unexpected `v-bind` with a string literal value.' + ] } ] })