Skip to content

Commit b23457d

Browse files
committed
Handle edge case <component is="div" />
1 parent d0b15ef commit b23457d

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Diff for: lib/rules/no-unregistered-components.js

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ module.exports = {
9797
}
9898
},
9999
"VAttribute[directive=false][key.name='is']" (node) {
100+
if (utils.isHtmlWellKnownElementName(node.value.value)) return
100101
usedComponentNodes.push({ node, name: node.value.value })
101102
},
102103
"VElement[name='template']" (rootNode) {

Diff for: tests/lib/rules/no-unregistered-components.js

+36
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,42 @@ tester.run('no-unregistered-components', rule, {
261261
</template>
262262
`
263263
},
264+
{
265+
filename: 'test.vue',
266+
code: `
267+
<template>
268+
<component is="div" />
269+
</template>
270+
`
271+
},
272+
{
273+
filename: 'test.vue',
274+
code: `
275+
<template>
276+
<component is="span">
277+
Text
278+
</component>
279+
</template>
280+
`
281+
},
282+
{
283+
filename: 'test.vue',
284+
code: `
285+
<template>
286+
<Component is="div" />
287+
</template>
288+
`
289+
},
290+
{
291+
filename: 'test.vue',
292+
code: `
293+
<template>
294+
<Component is="span">
295+
Text
296+
</Component>
297+
</template>
298+
`
299+
},
264300
{
265301
filename: 'test.vue',
266302
code: `

0 commit comments

Comments
 (0)