@@ -12,15 +12,28 @@ module.exports = {
12
12
/**
13
13
* Checks whether the given node can convert to the `v-slot`.
14
14
* @param {VAttribute | null } slotAttr node of `slot`
15
+ * @param {VElement } slotAttr node of `slot`
15
16
* @returns {boolean } `true` if the given node can convert to the `v-slot`
16
17
*/
17
- function canConvertToVSlot ( slotAttr ) {
18
- if ( ! slotAttr || ! slotAttr . value ) {
19
- return true
18
+ function canConvertToVSlot ( slotAttr , element ) {
19
+ if ( slotAttr ) {
20
+ if ( ! slotAttr . value ) {
21
+ return true
22
+ }
23
+ const slotName = slotAttr . value . value
24
+ // If non-Latin characters are included it can not be converted.
25
+ return ! / [ ^ a - z ] / i. test ( slotName )
20
26
}
21
- const slotName = slotAttr . value . value
22
- // If non-Latin characters are included it can not be converted.
23
- return ! / [ ^ a - z ] / i. test ( slotName )
27
+
28
+ const vBindSlotAttr = element . attributes
29
+ . find ( attr =>
30
+ attr . directive === true &&
31
+ attr . key . name . name === 'bind' &&
32
+ attr . key . argument &&
33
+ attr . key . argument . name === 'slot' )
34
+ // if the element have `v-bind:slot` it can not be converted.
35
+ // Conversion of `v-bind:slot` is done with `vue/no-deprecated-slot-attribute`.
36
+ return ! vBindSlotAttr
24
37
}
25
38
26
39
/**
@@ -62,7 +75,7 @@ module.exports = {
62
75
const element = scopeAttr . parent
63
76
const slotAttr = element . attributes
64
77
. find ( attr => attr . directive === false && attr . key . name === 'slot' )
65
- if ( ! canConvertToVSlot ( slotAttr ) ) {
78
+ if ( ! canConvertToVSlot ( slotAttr , element ) ) {
66
79
return null
67
80
}
68
81
return fixSlotToVSlot ( fixer , slotAttr , scopeAttr )
0 commit comments