chore: tsconfig的配置项修改
This commit is contained in:
parent
9009e48518
commit
7a6b607a69
14224
package-lock.json
generated
Normal file
14224
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -12,8 +12,8 @@
|
|||||||
"lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
|
"lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
|
||||||
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
|
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
|
||||||
"fix": "eslint src --fix",
|
"fix": "eslint src --fix",
|
||||||
"prepare": "husky install",
|
|
||||||
"lint-staged": "lint-staged",
|
"lint-staged": "lint-staged",
|
||||||
|
"prepare": "husky install",
|
||||||
"preinstall": "npx only-allow pnpm"
|
"preinstall": "npx only-allow pnpm"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
|||||||
@ -1,21 +1,16 @@
|
|||||||
{
|
{
|
||||||
// 编译选项
|
// 编译选项
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020", // 指定ECMAScript目标版本
|
"target": "ESNext", // 指定ECMAScript目标版本
|
||||||
"useDefineForClassFields": true,
|
|
||||||
"module": "ESNext", // 设置程序的模块系统
|
"module": "ESNext", // 设置程序的模块系统
|
||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"], //TS需要引用的库,即声明文件,es5 默认引用dom、es5、scripthost,如需要使用es的高级版本特性,通常都需要配置,如es8的数组新特性需要引入"ES2019.Array",
|
"lib": ["ESNext", "DOM"], //TS需要引用的库,即声明文件,es5 默认引用dom、es5、scripthost,如需要使用es的高级版本特性,通常都需要配置,如es8的数组新特性需要引入"ES2019.Array",
|
||||||
"skipLibCheck": true, //忽略所有的声明文件( *.d.ts)的类型检查
|
"skipLibCheck": true, //忽略所有的声明文件( *.d.ts)的类型检查
|
||||||
|
|
||||||
/* Bundler mode */
|
|
||||||
"moduleResolution": "bundler", //模块解析策略。默认使用node的模块解析策略
|
"moduleResolution": "bundler", //模块解析策略。默认使用node的模块解析策略
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true, // 允许导入包含 TypeScript 文档扩展名。
|
||||||
"resolveJsonModule": true, //允许导入扩展名为".json"的模块
|
"resolveJsonModule": true, //允许导入扩展名为".json"的模块
|
||||||
"isolatedModules": true, //将每个文件作为单独的模块(与"ts.transpileModule"类似)。
|
"isolatedModules": true, //将每个文件作为单独的模块(与"ts.transpileModule"类似)。
|
||||||
"noEmit": true, // 不输出文件,即编译后不会生成任何js文件
|
"noEmit": true, // 不输出文件,即编译后不会生成任何js文件
|
||||||
"jsx": "preserve", //preserve模式,在preserve模式下生成代码中会保留JSX以供后续的转换操作使用
|
"jsx": "preserve", //preserve模式,在preserve模式下生成代码中会保留JSX以供后续的转换操作使用
|
||||||
|
|
||||||
/* Linting */
|
|
||||||
"strict": true, //启用所有严格类型检查选项
|
"strict": true, //启用所有严格类型检查选项
|
||||||
"noUnusedLocals": true, // 若有未使用的局部变量则抛错
|
"noUnusedLocals": true, // 若有未使用的局部变量则抛错
|
||||||
"noUnusedParameters": true, // 检若有未使用的函数参数则抛错
|
"noUnusedParameters": true, // 检若有未使用的函数参数则抛错
|
||||||
@ -32,8 +27,8 @@
|
|||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"vite.config.ts",
|
"src/auto-import.d.ts", // 与vite.config.ts中的dts路径一致
|
||||||
"src/auto-import.d.ts" // 与vite.config.ts中的dts路径一致
|
"vite.config.ts"
|
||||||
], // 指定被编译文件所在的目录
|
], // 指定被编译文件所在的目录
|
||||||
// exclude表示要排除的、不编译的文件,它也可以指定一个列表,规则和include一样,可以是文件或文件夹,可以是相对路径或绝对路径,可以使用通配符
|
// exclude表示要排除的、不编译的文件,它也可以指定一个列表,规则和include一样,可以是文件或文件夹,可以是相对路径或绝对路径,可以使用通配符
|
||||||
"exclude": ["node_modules", "dist", "**/*.js"], // 指定不需要被编译的目录
|
"exclude": ["node_modules", "dist", "**/*.js"], // 指定不需要被编译的目录
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user