Skip to content

Commit dd5ea58

Browse files
committed
fix: remove VListItemContent with no attributes
1 parent bbd36cc commit dd5ea58

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/rules/no-deprecated-components.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ module.exports = {
100100
node: element,
101101
messageId: 'removed',
102102
data: { name: hyphenate(tag) },
103+
fix (fixer) {
104+
if (tag === 'VListItemContent' && !element.startTag.attributes.length) {
105+
return element.children.length
106+
? [fixer.remove(element.startTag), fixer.remove(element.endTag)]
107+
: fixer.remove(element)
108+
}
109+
},
103110
})
104111
}
105112
}

tests/rules/no-deprecated-components.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,19 @@ tester.run('no-deprecated-components', rule, {
2525
output: '<template><v-subheader /></template>',
2626
errors: [{ messageId: 'replacedWithCustom' }],
2727
},
28+
{
29+
code: '<template><v-list-item><v-list-item-content><v-list-item-title /></v-list-item-content></v-list-item></template>',
30+
output: '<template><v-list-item><v-list-item-title /></v-list-item></template>',
31+
errors: [{ messageId: 'removed' }],
32+
},
33+
{
34+
code: '<template><v-list-item><v-list-item-content></v-list-item-content></v-list-item></template>',
35+
output: '<template><v-list-item></v-list-item></template>',
36+
errors: [{ messageId: 'removed' }],
37+
},
38+
{
39+
code: '<template><v-list-item><v-list-item-content class="foo"><v-list-item-title /></v-list-item-content></v-list-item></template>',
40+
errors: [{ messageId: 'removed' }],
41+
},
2842
],
2943
})

0 commit comments

Comments
 (0)