Skip to content

Commit 21d3ed8

Browse files
fix(no-deprecated-slot-attribute): no fix for dynamic components (#2530)
Co-authored-by: Yosuke Ota <[email protected]>
1 parent b08273c commit 21d3ed8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Diff for: lib/rules/syntaxes/utils/can-convert-to-v-slot.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ module.exports = function canConvertToVSlot(element, sourceCode, tokenStore) {
2828
const ownerElement = element.parent
2929
if (
3030
ownerElement.type === 'VDocumentFragment' ||
31-
!utils.isCustomComponent(ownerElement)
31+
!utils.isCustomComponent(ownerElement) ||
32+
ownerElement.name === 'component'
3233
) {
3334
return false
3435
}

Diff for: tests/lib/rules/no-deprecated-slot-attribute.js

+13
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,19 @@ tester.run('no-deprecated-slot-attribute', rule, {
668668
</my-component>
669669
</template>`,
670670
errors: ['`slot` attributes are deprecated.']
671+
},
672+
{
673+
code: `
674+
<template>
675+
<component :is="toggle ? 'my-component' : 'div'">
676+
<div slot="named">
677+
Passing in a named slot to a div worked with old syntax
678+
But not with new syntax
679+
</div>
680+
</component>
681+
</template>`,
682+
output: null,
683+
errors: ['`slot` attributes are deprecated.']
671684
}
672685
]
673686
})

0 commit comments

Comments
 (0)