Skip to content

Commit 9dac0d9

Browse files
committed
chore: improve tsconfig
1 parent 83f1f4f commit 9dac0d9

File tree

9 files changed

+35
-24
lines changed

9 files changed

+35
-24
lines changed

packages/babel-plugin-jsx/README-zh_CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ const App = {
169169
```
170170
171171
```jsx
172-
<input v-model={[val, ['modifier']]} />;
172+
;<input v-model={[val, ['modifier']]} />
173173
// 或者
174-
<input v-model_modifier={val} />
174+
;<input v-model_modifier={val} />
175175
```
176176
177177
```jsx
178-
<A v-model={[val, 'argument', ['modifier']]} />;
178+
;<A v-model={[val, 'argument', ['modifier']]} />
179179
// 或者
180-
<input v-model:argument_modifier={val} />
180+
;<input v-model:argument_modifier={val} />
181181
```
182182
183183
会编译成:

packages/babel-plugin-jsx/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ const App = {
173173
```
174174
175175
```jsx
176-
<input v-model={[val, ['modifier']]} />;
176+
;<input v-model={[val, ['modifier']]} />
177177
// Or
178-
<input v-model_modifier={val} />
178+
;<input v-model_modifier={val} />
179179
```
180180
181181
```jsx
182-
<A v-model={[val, 'argument', ['modifier']]} />;
182+
;<A v-model={[val, 'argument', ['modifier']]} />
183183
// Or
184-
<input v-model:argument_modifier={val} />
184+
;<input v-model:argument_modifier={val} />
185185
```
186186
187187
Will compile to:

packages/babel-plugin-jsx/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { State, VueJSXPluginOptions } from './interface'
1111
import type * as BabelCore from '@babel/core'
1212
import type { NodePath, Visitor } from '@babel/traverse'
1313

14-
export { VueJSXPluginOptions }
14+
export type { VueJSXPluginOptions }
1515

1616
const hasJSX = (parentPath: NodePath<t.Program>) => {
1717
let fileHasJSX = false

packages/babel-plugin-resolve-type/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@vue/compiler-sfc'
1111
import type * as BabelCore from '@babel/core'
1212

13-
export { SimpleTypeResolveOptions as Options }
13+
export type { SimpleTypeResolveOptions as Options }
1414

1515
const plugin: (
1616
api: object,

packages/jsx-explorer/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ function main() {
4141
},
4242
}
4343

44-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
44+
monaco.typescript.typescriptDefaults.setDiagnosticsOptions({
4545
noSemanticValidation: true,
4646
})
47-
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
47+
monaco.typescript.typescriptDefaults.setCompilerOptions({
4848
allowJs: true,
4949
allowNonTsExtensions: true,
50-
jsx: monaco.languages.typescript.JsxEmit.Preserve,
51-
target: monaco.languages.typescript.ScriptTarget.Latest,
52-
module: monaco.languages.typescript.ModuleKind.ESNext,
50+
jsx: monaco.typescript.JsxEmit.Preserve,
51+
target: monaco.typescript.ScriptTarget.Latest,
52+
module: monaco.typescript.ModuleKind.ESNext,
5353
isolatedModules: true,
5454
})
5555

packages/jsx-explorer/src/options.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createApp, defineComponent, reactive } from 'vue'
22
import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
33

4-
export { VueJSXPluginOptions }
4+
export type { VueJSXPluginOptions }
55

66
export const compilerOptions: VueJSXPluginOptions = reactive({
77
mergeProps: true,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import VueJSX from '@vitejs/plugin-vue-jsx'
2+
import { defaultClientConditions, defineConfig } from 'vite'
3+
export default defineConfig({
4+
resolve: {
5+
conditions: ['dev', ...defaultClientConditions],
6+
},
7+
define: {
8+
'process.env.BABEL_TYPES_8_BREAKING': 'false',
9+
},
10+
plugins: [VueJSX()],
11+
})

tsconfig.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
{
22
"compilerOptions": {
3-
"target": "ESNext",
3+
"target": "esnext",
44
"jsx": "preserve",
55
"jsxImportSource": "vue",
6-
"lib": ["ES2023", "DOM", "DOM.Iterable"],
6+
"lib": ["es2023", "DOM"],
7+
"moduleDetection": "force",
78
"customConditions": ["dev"],
8-
"module": "ESNext",
9+
"module": "preserve",
910
"moduleResolution": "bundler",
1011
"resolveJsonModule": true,
1112
"types": ["vitest/globals"],
12-
"allowJs": true,
1313
"strict": true,
1414
"noUnusedLocals": true,
15+
"declaration": true,
1516
"noEmit": true,
1617
"esModuleInterop": true,
18+
"verbatimModuleSyntax": true,
1719
"skipLibCheck": true
18-
}
20+
},
21+
"include": ["packages/*/src", "packages/*/test", "vitest.config.ts"]
1922
}

vitest.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { defineConfig } from 'vitest/config'
33
import Jsx from './packages/babel-plugin-jsx/src'
44

55
export default defineConfig({
6-
resolve: {
7-
conditions: ['dev'],
8-
},
96
esbuild: {
107
jsx: 'preserve',
118
},

0 commit comments

Comments
 (0)