Skip to content

Commit

Permalink
fix(no-deprecated-slot-attribute): no fix for dynamic components (#2530)
Browse files Browse the repository at this point in the history
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
  • Loading branch information
privatenumber and ota-meshi authored Sep 2, 2024
1 parent b08273c commit 21d3ed8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rules/syntaxes/utils/can-convert-to-v-slot.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module.exports = function canConvertToVSlot(element, sourceCode, tokenStore) {
const ownerElement = element.parent
if (
ownerElement.type === 'VDocumentFragment' ||
!utils.isCustomComponent(ownerElement)
!utils.isCustomComponent(ownerElement) ||
ownerElement.name === 'component'
) {
return false
}
Expand Down
13 changes: 13 additions & 0 deletions tests/lib/rules/no-deprecated-slot-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,19 @@ tester.run('no-deprecated-slot-attribute', rule, {
</my-component>
</template>`,
errors: ['`slot` attributes are deprecated.']
},
{
code: `
<template>
<component :is="toggle ? 'my-component' : 'div'">
<div slot="named">
Passing in a named slot to a div worked with old syntax
But not with new syntax
</div>
</component>
</template>`,
output: null,
errors: ['`slot` attributes are deprecated.']
}
]
})

0 comments on commit 21d3ed8

Please sign in to comment.