Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore <Textarea> components in vue/no-textarea-mustache #2024

Merged
merged 4 commits into from Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/rules/no-textarea-mustache.js
Expand Up @@ -23,7 +23,10 @@ module.exports = {
return utils.defineTemplateBodyVisitor(context, {
/** @param {VExpressionContainer} node */
"VElement[name='textarea'] VExpressionContainer"(node) {
if (node.parent.type !== 'VElement') {
if (
node.parent.type !== 'VElement' ||
node.parent.rawName.startsWith('T')
qmhc marked this conversation as resolved.
Show resolved Hide resolved
) {
return
}

Expand Down
9 changes: 9 additions & 0 deletions tests/lib/rules/no-textarea-mustache.js
Expand Up @@ -22,6 +22,10 @@ tester.run('no-textarea-mustache', rule, {
{
filename: 'test.vue',
code: '<template><div><textarea v-model="text"></textarea></div></template>'
},
{
filename: 'test.vue',
code: '<template><div><Textarea>{{text}}</Textarea></div></template>'
}
],
invalid: [
Expand All @@ -30,6 +34,11 @@ tester.run('no-textarea-mustache', rule, {
code: '<template><div><textarea>{{text}}</textarea></div></template>',
errors: ["Unexpected mustache. Use 'v-model' instead."]
},
{
filename: 'test.vue',
code: '<template><div><textarea v-model="text">{{text}}</textarea></div></template>',
errors: ["Unexpected mustache. Use 'v-model' instead."]
},
{
filename: 'test.vue',
code: '<template><div><textarea>{{text}} and {{text}}</textarea></div></template>',
Expand Down