From c89ddce9117229017abc507581f13e5eb47fd08c Mon Sep 17 00:00:00 2001 From: gaokefei <260480378@qq.com> Date: Sat, 2 Dec 2023 12:56:08 +0800 Subject: [PATCH 1/3] fix(define-slots): cover to slot.name in tag_end --- playground/src/components/Comp.vue | 6 ++- src/rules/define-slots.yml | 69 ++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/playground/src/components/Comp.vue b/playground/src/components/Comp.vue index 90eb9a3..3836e35 100644 --- a/playground/src/components/Comp.vue +++ b/playground/src/components/Comp.vue @@ -1,7 +1,8 @@ @@ -14,6 +15,7 @@ defineEmits<{ defineSlots<{ default: (props: { id: string }) => any + top: (props: { foo: number }) => any bottom: (props: { foo: number }) => any }>() \ No newline at end of file diff --git a/src/rules/define-slots.yml b/src/rules/define-slots.yml index 2b77427..eb09014 100644 --- a/src/rules/define-slots.yml +++ b/src/rules/define-slots.yml @@ -1,14 +1,26 @@ id: v-define-slots default language: html +utils: + is-default-slot: + kind: tag_name + regex: ^slot$ + precedes: + kind: attribute + not: + has: + kind: attribute_name + regex: ^name$ rule: - kind: tag_name - regex: ^slot$ - precedes: - kind: attribute - not: - has: - kind: attribute_name - regex: ^name$ + any: + - matches: is-default-slot + - kind: tag_name + inside: + kind: end_tag + follows: + kind: start_tag + stopBy: end + has: + matches: is-default-slot fix: slots.default @@ -16,22 +28,35 @@ fix: id: v-define-slots name language: html +utils: + is-slot: + kind: tag_name + regex: ^slot$ + precedes: + kind: attribute + has: + kind: attribute_name + regex: ^name$ + precedes: + kind: quoted_attribute_value + has: + kind: attribute_value + pattern: $A + stopBy: end rule: - kind: tag_name - regex: ^slot$ - precedes: - kind: attribute - has: - kind: attribute_name - regex: ^name$ - precedes: - kind: quoted_attribute_value - has: - kind: attribute_value - pattern: $V - stopBy: end + any: + - matches: is-slot + - kind: tag_name + regex: slot + inside: + kind: end_tag + follows: + kind: start_tag + stopBy: end + has: + matches: is-slot fix: - slots.$V + slots.$A --- From 6eda9fa278eabb7dbd6f8025ec5f40d5923e2a82 Mon Sep 17 00:00:00 2001 From: gaokefei <260480378@qq.com> Date: Sat, 2 Dec 2023 15:00:01 +0800 Subject: [PATCH 2/3] feat(jsx-directive): support template-ref --- playground/src/App.vue | 3 +++ src/rules/jsx-directive/v-bind.yml | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/playground/src/App.vue b/playground/src/App.vue index c0b4f05..e680d7f 100644 --- a/playground/src/App.vue +++ b/playground/src/App.vue @@ -1,10 +1,12 @@