Skip to content

Commit 9b7737d

Browse files
committed
fix: lint
1 parent e672078 commit 9b7737d

File tree

4 files changed

+66
-55
lines changed

4 files changed

+66
-55
lines changed

docs/features/macros.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@ import { defineConfig } from 'vite'
2121
import vueJsxVapor from 'vue-jsx-vapor/vite'
2222

2323
export default defineConfig({
24-
vueJsxVapor({
25-
macros: true,
26-
}),
24+
plugins: [
25+
vueJsxVapor({
26+
macros: true,
27+
}),
28+
],
2729
})
2830
```
2931

3032
```ts {5} [tsm.config.ts]
3133
import vueJsxVapor from 'vue-jsx-vapor/volar'
3234

3335
export default {
34-
vueJsxVapor({
35-
macros: true,
36-
}),
36+
plugins: [
37+
vueJsxVapor({
38+
macros: true,
39+
}),
40+
],
3741
}
3842
```
3943

@@ -208,7 +212,7 @@ export default () => (
208212
<Comp<1>>
209213
<template v-slot={{ foo }}>{foo}</template>
210214
<template v-slot:title={{ bar }}>{bar}</template>
211-
// ^?
215+
// ^?
212216
</Comp>
213217
)
214218
```
@@ -217,7 +221,6 @@ export default () => (
217221

218222
Just like in Vue SFC.
219223

220-
221224
```tsx
222225
import { useRef } from 'vue-jsx-vapor'
223226

@@ -233,9 +236,7 @@ export default () => {
233236
compRef.value?.foo
234237
// ^?
235238

236-
return (
237-
<Comp ref={compRef} foo={1 as const} />
238-
)
239+
return <Comp ref={compRef} foo={1 as const} />
239240
}
240241
```
241242

@@ -247,16 +248,15 @@ import { useRef } from 'vue-jsx-vapor'
247248
import { useExpose } from '/vue-macros/jsx-macros/use-expose'
248249

249250
const Comp = ({ foo }) => {
250-
;(currentInstance.exposed = {
251+
currentInstance.exposed = {
251252
foo,
252-
})
253+
}
253254
return <div />
254255
}
255256
```
256257

257258
:::
258259

259-
260260
## defineStyle
261261

262262
```ts

docs/introduction/getting-started.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ import { defineConfig } from 'vite'
3131
import vueJsxVapor from 'vue-jsx-vapor/vite'
3232

3333
export default defineConfig({
34-
vueJsxVapor({
35-
macros: true,
36-
}),
34+
plugins: [
35+
vueJsxVapor({
36+
macros: true,
37+
}),
38+
],
3739
})
3840
```
3941

@@ -46,16 +48,17 @@ It works similarly to [@vue/language-tools](https://github.com/vuejs/language-to
4648

4749
By default, after installing the `ts-macro` VSCode plugin, `ts-macro` will automatically load `vue-jsx-vapor/volar` by analyzing `vite.config.ts` and shared vueJsxVapor's options. so you don't need to config `tsm.config.ts`. But if you want, you can also configure it manually:
4850

49-
5051
::: code-group
5152

5253
```ts [tsm.config.ts]
5354
import vueJsxVapor from 'vue-jsx-vapor/volar'
5455

5556
export default {
56-
vueJsxVapor({
57-
macros: true,
58-
}),
57+
plugins: [
58+
vueJsxVapor({
59+
macros: true,
60+
}),
61+
],
5962
}
6063
```
6164

docs/introduction/interop.md

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@
99
::: code-group
1010

1111
```ts [vite.config.ts]
12+
import vueJsx from '@vitejs/plugin-vue-jsx'
1213
import { defineConfig } from 'vite'
1314
import vueJsxVapor from 'vue-jsx-vapor/vite'
14-
import vueJsx from '@vitejs/plugin-vue-jsx'
1515

1616
export default defineConfig({
17-
vueJsxVapor({
18-
macros: true,
19-
interop: true,
20-
}),
21-
vueJsx()
17+
plugins: [
18+
vueJsxVapor({
19+
macros: true,
20+
interop: true,
21+
}),
22+
vueJsx(),
23+
],
2224
})
2325
```
2426

@@ -29,11 +31,17 @@ createApp(App).use(vaporInteropPlugin).mount('#app')
2931
```
3032

3133
```tsx [App.tsx] twoslash1
32-
import {computed, defineComponent, defineVaporComponent, ref, ref as useRef } from 'vue'
34+
import {
35+
computed,
36+
defineComponent,
37+
defineVaporComponent,
38+
ref,
39+
ref as useRef,
40+
} from 'vue'
3341

3442
const Comp = defineVaporComponent(({ count = 0 }) => {
3543
defineExpose({
36-
double: computed(() => count * 2)
44+
double: computed(() => count * 2),
3745
})
3846
return <span> x 2 = </span>
3947
})
@@ -43,39 +51,39 @@ export default defineComponent(() => {
4351
const compRef = useRef()
4452
return () => (
4553
<>
46-
<input
47-
value={count.value}
48-
onInput={e => count.value = +e.currentTarget.value}
49-
/>
54+
<input
55+
value={count.value}
56+
onInput={(e) => (count.value = +e.currentTarget.value)}
57+
/>
5058

5159
<Comp count={count.value} ref={compRef}></Comp>
5260
{compRef.value?.double}
5361
</>
5462
)
5563
})
56-
5764
```
5865

5966
:::
6067

61-
6268
## Virtual DOM in Vapor
6369

6470
[REPL](https://repl.zmjs.dev/vuejs/virtual-dom-in-vapor)
6571

6672
::: code-group
6773

6874
```ts [vite.config.ts]
75+
import vueJsx from '@vitejs/plugin-vue-jsx'
6976
import { defineConfig } from 'vite'
7077
import vueJsxVapor from 'vue-jsx-vapor/vite'
71-
import vueJsx from '@vitejs/plugin-vue-jsx'
7278

7379
export default defineConfig({
74-
vueJsxVapor({
75-
macros: true,
76-
interop: true,
77-
}),
78-
vueJsx()
80+
plugins: [
81+
vueJsxVapor({
82+
macros: true,
83+
interop: true,
84+
}),
85+
vueJsx(),
86+
],
7987
})
8088
```
8189

@@ -86,11 +94,17 @@ createVaporApp(App).use(vaporInteropPlugin).mount('#app')
8694
```
8795

8896
```tsx [App.tsx] twoslash1
89-
import {computed, defineComponent, defineVaporComponent, ref, ref as useRef } from 'vue'
97+
import {
98+
computed,
99+
defineComponent,
100+
defineVaporComponent,
101+
ref,
102+
ref as useRef,
103+
} from 'vue'
90104

91105
const Comp = defineVaporComponent(({ count = 0 }) => {
92106
defineExpose({
93-
double: computed(() => count * 2)
107+
double: computed(() => count * 2),
94108
})
95109
return <span> x 2 = </span>
96110
})
@@ -100,17 +114,16 @@ export default defineComponent(() => {
100114
const compRef = useRef()
101115
return () => (
102116
<>
103-
<input
104-
value={count.value}
105-
onInput={e => count.value = +e.currentTarget.value}
106-
/>
117+
<input
118+
value={count.value}
119+
onInput={(e) => (count.value = +e.currentTarget.value)}
120+
/>
107121

108122
<Comp count={count.value} ref={compRef}></Comp>
109123
{compRef.value?.double}
110124
</>
111125
)
112126
})
113-
114127
```
115128

116-
:::
129+
:::

eslint.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ export default sxzz()
77
'unicorn/no-new-array',
88
)
99
.append([
10-
{
11-
name: 'warn',
12-
rules: {
13-
'unused-imports/no-unused-vars': 'warn',
14-
},
15-
},
1610
{
1711
name: 'docs',
1812
files: ['**/*.md/*.tsx'],
@@ -21,6 +15,7 @@ export default sxzz()
2115
'no-mutable-exports': 'off',
2216
'no-duplicate-imports': 'off',
2317
'import/first': 'off',
18+
'unused-imports/no-unused-vars': 'off',
2419
},
2520
},
2621
])

0 commit comments

Comments
 (0)