Skip to content

Commit c89ddce

Browse files
committed
fix(define-slots): cover to slot.name in tag_end
1 parent 98d8090 commit c89ddce

File tree

2 files changed

+51
-24
lines changed

2 files changed

+51
-24
lines changed

Diff for: playground/src/components/Comp.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<div @click="()=> $emit('update', 2)">
3-
<slot :id="`${id}`"/>
4-
<slot name="bottom" v-bind="{ foo: id }" />
3+
<slot name="top" v-bind="{ foo: id }" />
4+
<slot :id="`${id}`">{{ id }}</slot>
5+
<slot name="bottom" v-bind="{ foo: id }">bottom</slot>
56
</div>
67
</template>
78

@@ -14,6 +15,7 @@ defineEmits<{
1415
1516
defineSlots<{
1617
default: (props: { id: string }) => any
18+
top: (props: { foo: number }) => any
1719
bottom: (props: { foo: number }) => any
1820
}>()
1921
</script>

Diff for: src/rules/define-slots.yml

+47-22
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,62 @@
11
id: v-define-slots default
22
language: html
3+
utils:
4+
is-default-slot:
5+
kind: tag_name
6+
regex: ^slot$
7+
precedes:
8+
kind: attribute
9+
not:
10+
has:
11+
kind: attribute_name
12+
regex: ^name$
313
rule:
4-
kind: tag_name
5-
regex: ^slot$
6-
precedes:
7-
kind: attribute
8-
not:
9-
has:
10-
kind: attribute_name
11-
regex: ^name$
14+
any:
15+
- matches: is-default-slot
16+
- kind: tag_name
17+
inside:
18+
kind: end_tag
19+
follows:
20+
kind: start_tag
21+
stopBy: end
22+
has:
23+
matches: is-default-slot
1224
fix:
1325
slots.default
1426

1527
---
1628

1729
id: v-define-slots name
1830
language: html
31+
utils:
32+
is-slot:
33+
kind: tag_name
34+
regex: ^slot$
35+
precedes:
36+
kind: attribute
37+
has:
38+
kind: attribute_name
39+
regex: ^name$
40+
precedes:
41+
kind: quoted_attribute_value
42+
has:
43+
kind: attribute_value
44+
pattern: $A
45+
stopBy: end
1946
rule:
20-
kind: tag_name
21-
regex: ^slot$
22-
precedes:
23-
kind: attribute
24-
has:
25-
kind: attribute_name
26-
regex: ^name$
27-
precedes:
28-
kind: quoted_attribute_value
29-
has:
30-
kind: attribute_value
31-
pattern: $V
32-
stopBy: end
47+
any:
48+
- matches: is-slot
49+
- kind: tag_name
50+
regex: slot
51+
inside:
52+
kind: end_tag
53+
follows:
54+
kind: start_tag
55+
stopBy: end
56+
has:
57+
matches: is-slot
3358
fix:
34-
slots.$V
59+
slots.$A
3560

3661
---
3762

0 commit comments

Comments
 (0)