Skip to content

Commit

Permalink
refactor: improve tsconfig (element-plus#5993)
Browse files Browse the repository at this point in the history
* refactor: improve tsconfig

* chore: add cypress tsconfig
  • Loading branch information
sxzz authored Feb 15, 2022
1 parent e248187 commit 7b7afc8
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const copyFiles = () =>
path.resolve(epOutput, 'README.md')
),
copyFile(
path.resolve(projRoot, 'typings/global.d.ts'),
path.resolve(projRoot, 'global.d.ts'),
path.resolve(epOutput, 'global.d.ts')
),
])
Expand Down
12 changes: 7 additions & 5 deletions build/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"extends": "../tsconfig.json",
"extends": "@vue/tsconfig/tsconfig.node.json",
"compilerOptions": {
"module": "CommonJS",
"target": "ESNext",
"lib": ["ESNext"]
"target": "ES2021",
"lib": ["ES2021"],
"types": ["node"],
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["**/*.ts"]
"include": ["**/*"]
}
10 changes: 10 additions & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["./integration/**/*", "./support/**/*"],
"compilerOptions": {
"isolatedModules": false,
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
}
}
File renamed without changes.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@
"@types/lodash": "4.14.178",
"@types/lodash-es": "4.17.6",
"@types/node": "17.0.16",
"@types/rollup-plugin-css-only": "^3.1.0",
"@types/sass": "1.43.1",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
"@vitejs/plugin-vue": "2.2.0",
"@vitejs/plugin-vue-jsx": "1.3.7",
"@vue/babel-plugin-jsx": "1.1.1",
"@vue/test-utils": "2.0.0-rc.16",
"@vue/tsconfig": "^0.1.3",
"babel-jest": "26.6.3",
"chalk": "4.1.2",
"components-helper": "2.0.0",
Expand Down
10 changes: 3 additions & 7 deletions play/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"compilerOptions": {
"strict": true,
"allowJs": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"types": ["vite/client", "./global"],
"resolveJsonModule": true,
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"baseUrl": "."
"types": ["node", "vite/client", "../typings/components"],
"allowSyntheticDefaultImports": true
},
"include": ["**/*"]
}
30 changes: 30 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions tsconfig.jest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["packages/**/*.test.*", "packages/**/*.spec.*"],
"compilerOptions": {
"composite": true,
"lib": ["DOM"],
"types": ["node", "jest"],
"jsx": "preserve"
}
}
22 changes: 12 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"compilerOptions": {
"allowJs": true,
"strict": true,
"module": "ES6",
"target": "ES2018",
"noImplicitAny": false,
"declaration": true,
"moduleResolution": "Node",
"esModuleInterop": true,
"jsx": "preserve",
"sourceMap": true,
"lib": ["ES2018", "DOM"],
"lib": ["ES2018", "DOM", "DOM.Iterable"],
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"types": ["unplugin-vue-define-options", "jest", "./typings/jsx-shim"]
"types": ["unplugin-vue-define-options"]
},
"include": ["packages"],
"exclude": ["node_modules", "**/dist"]
"references": [{ "path": "./tsconfig.jest.json" }],
"include": ["packages", "typings"],
"exclude": [
"node_modules",
"**/dist",
"**/__tests__",
"**/*.test.*",
"**/*.spec.*"
]
}
2 changes: 2 additions & 0 deletions play/global.d.ts → typings/components.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// For this project development

// GlobalComponents for Volar
declare module 'vue' {
export interface GlobalComponents {
Expand Down

0 comments on commit 7b7afc8

Please sign in to comment.