Skip to content

Commit

Permalink
fix: remove VListItemContent with no attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Jul 17, 2023
1 parent bbd36cc commit dd5ea58
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rules/no-deprecated-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ module.exports = {
node: element,
messageId: 'removed',
data: { name: hyphenate(tag) },
fix (fixer) {
if (tag === 'VListItemContent' && !element.startTag.attributes.length) {
return element.children.length
? [fixer.remove(element.startTag), fixer.remove(element.endTag)]
: fixer.remove(element)
}
},
})
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/rules/no-deprecated-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@ tester.run('no-deprecated-components', rule, {
output: '<template><v-subheader /></template>',
errors: [{ messageId: 'replacedWithCustom' }],
},
{
code: '<template><v-list-item><v-list-item-content><v-list-item-title /></v-list-item-content></v-list-item></template>',
output: '<template><v-list-item><v-list-item-title /></v-list-item></template>',
errors: [{ messageId: 'removed' }],
},
{
code: '<template><v-list-item><v-list-item-content></v-list-item-content></v-list-item></template>',
output: '<template><v-list-item></v-list-item></template>',
errors: [{ messageId: 'removed' }],
},
{
code: '<template><v-list-item><v-list-item-content class="foo"><v-list-item-title /></v-list-item-content></v-list-item></template>',
errors: [{ messageId: 'removed' }],
},
],
})

0 comments on commit dd5ea58

Please sign in to comment.