Skip to content

Commit 028e4af

Browse files
committed
feat(sg): convert dot to underline
1 parent 9b94f36 commit 028e4af

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

eslint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ export default antfu(
1818
'yaml/indent': 'off',
1919
},
2020
},
21+
ignores: ['**/playground/**'],
2122
},
2223
)

playground/src/App.vue

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const compRef = shallowRef()
2020
v-loading.fullscreen.lock="true"
2121
v-memo="[select?.id === i.id]"
2222
v-on="on"
23+
v-on:click="alert"
24+
@sub-mit.prevent
2325
@click.once="select = i"
2426
@submit="alert"
2527
@update:model-value="select.id = $event"

src/sg/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export async function sg(target: string) {
6565

6666
if (['setup-sfc', 'define-render', 'export-render'].includes(macro)) {
6767
await $`${sg} scan -c ${config}.yml -U --filter '^self-closing-tag' ${target}`
68+
await $`${sg} scan -c ${config}.yml -U --filter '^dot-to-underline' ${target}`
6869
await $`${sg} scan -c ${config}.yml -U --filter '^v-' ${target}`
6970
await $`${sg} scan -c ${config}.yml -U --filter '^${macro === 'setup-sfc' ? 'export-render' : macro}' ${target}`
7071
await useTsx(async () => {
+17-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
id: v-directive
22
language: html
33
rule:
4-
kind: attribute
4+
kind: quoted_attribute_value
55
has:
6+
kind: attribute_value
7+
pattern: $V
8+
follows:
69
kind: attribute_name
710
pattern: $NAME
8-
regex: ^v-
9-
precedes:
10-
kind: quoted_attribute_value
11-
has:
12-
kind: attribute_value
13-
pattern: $V
14-
stopBy: end
11+
regex: ^v-|@
12+
stopBy: end
13+
fix: |-
14+
{$V}
15+
16+
---
17+
18+
id: dot-to-underline
19+
language: html
20+
rule:
21+
kind: attribute_name
22+
pattern: $NAME
1523
transform:
1624
K:
1725
replace:
1826
replace: \.
1927
by: _
2028
source: $NAME
2129
fix: |-
22-
$K={$V}
30+
$K

0 commit comments

Comments
 (0)