Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 21d3ed8

Browse filesBrowse files
fix(no-deprecated-slot-attribute): no fix for dynamic components (#2530)
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
1 parent b08273c commit 21d3ed8
Copy full SHA for 21d3ed8

File tree

2 files changed

+15
-1
lines changed
Filter options

2 files changed

+15
-1
lines changed

‎lib/rules/syntaxes/utils/can-convert-to-v-slot.js

Copy file name to clipboardExpand all lines: lib/rules/syntaxes/utils/can-convert-to-v-slot.js
+2-1Lines changed: 2 additions & 1 deletion
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
}

‎tests/lib/rules/no-deprecated-slot-attribute.js

Copy file name to clipboardExpand all lines: tests/lib/rules/no-deprecated-slot-attribute.js
+13Lines changed: 13 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.