@pengzhanbo/tsconfig 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/package.json +24 -0
- package/tsconfig.json +54 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.vue.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 pengzhanbo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @pengzhanbo/tsconfig
|
|
2
|
+
|
|
3
|
+
The tsconfig preset.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add -D @pengzhanbo/tsconfig
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Config
|
|
14
|
+
|
|
15
|
+
In `tsconfig.json`
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"extends": "@pengzhanbo/tsconfig/tsconfig.json"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"extends": [
|
|
26
|
+
"@pengzhanbo/tsconfig/tsconfig.json",
|
|
27
|
+
"@pengzhanbo/tsconfig/tsconfig.lib.json"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"extends": "@pengzhanbo/tsconfig/tsconfig.vue.json"
|
|
35
|
+
}
|
|
36
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pengzhanbo/tsconfig",
|
|
3
|
+
"version": "1.41.0",
|
|
4
|
+
"author": "pengzhanbo <q942450674@outlook.com> (https://github/pengzhanbo/)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/pengzhanbo/configs#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git@github.com:pengzhanbo/configs.git",
|
|
10
|
+
"directory": "packages/tsconfig"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"tsconfig"
|
|
14
|
+
],
|
|
15
|
+
"main": "tsconfig.json",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"typescript": "5.x"
|
|
18
|
+
},
|
|
19
|
+
"peerDependenciesMeta": {
|
|
20
|
+
"typescript": {
|
|
21
|
+
"optional": true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://www.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// - 对于Vite而言,实际编译目标由Vite配置中的`build.target`选项决定。
|
|
5
|
+
// 因此请勿修改此处的`target`字段。为确保动态`import()`和`import.meta`正常工作,该值至少需设置为`ES2020`。
|
|
6
|
+
// - 若未使用Vite构建工具,可自行覆盖`target`字段配置。
|
|
7
|
+
"target": "ESNext",
|
|
8
|
+
// 即使没有 `import` 或 `export` 的文件也会被视为模块。
|
|
9
|
+
// 这有助于避免诸如“无法重新声明块级作用域变量‘name’”这类难以捉摸的错误。
|
|
10
|
+
// https://www.totaltypescript.com/cannot-redeclare-block-scoped-variable#solution-3-your-module-isnt-a-module
|
|
11
|
+
"moduleDetection": "force",
|
|
12
|
+
// 为了符合规范要求。
|
|
13
|
+
// 若 `target` 设置为 `ES2020` 或更高版本,默认值为 `true`。
|
|
14
|
+
// 此处显式设置为 `true`,以防某些用户需要覆盖 `target` 配置。
|
|
15
|
+
"useDefineForClassFields": true,
|
|
16
|
+
"libReplacement": false,
|
|
17
|
+
// 只要您正在使用构建工具,我们建议您编写并发布 ES 模块格式的代码。
|
|
18
|
+
// 即使您的目标运行环境是 Node.js 也应如此,因为:
|
|
19
|
+
// - `CommonJS` 已过于陈旧
|
|
20
|
+
// - 生态系统尚未完全适配 `Node16`/`NodeNext` 模式
|
|
21
|
+
// 此建议适用于 Vitest、Vite 配置文件、Vite SSR 等各类环境。
|
|
22
|
+
"module": "ESNext",
|
|
23
|
+
// 我们预期用户会使用打包工具。
|
|
24
|
+
// 因此这里启用了一些仅在打包工具中可用的解析功能。
|
|
25
|
+
"moduleResolution": "bundler",
|
|
26
|
+
"resolveJsonModule": true,
|
|
27
|
+
"allowImportingTsExtensions": true,
|
|
28
|
+
"strict": true,
|
|
29
|
+
// `"noImplicitThis": true` 属于 `strict` 选项的组成部分
|
|
30
|
+
// 此处再次单独声明,以防某些用户选择禁用 `strict` 模式
|
|
31
|
+
// 该配置会针对 `this` 上的数据属性启用更严格的类型推断。
|
|
32
|
+
"noImplicitThis": true,
|
|
33
|
+
// See <https://www.semver-ts.org/formal-spec/5-compiler-considerations.html#strictness>
|
|
34
|
+
// 截至 TypeScript 5.9 版本,这两个选项也已纳入推荐的 tsconfig 配置中。
|
|
35
|
+
"noUncheckedIndexedAccess": true,
|
|
36
|
+
// 目前暂不启用。在当前生态系统中难以落地。
|
|
37
|
+
// 需要达成更多共识才能推进。
|
|
38
|
+
// "exactOptionalPropertyTypes": true,
|
|
39
|
+
|
|
40
|
+
// 大多数非库项目无需生成声明文件。
|
|
41
|
+
// 因此我们默认添加此选项,使配置对大多数用户更友好。
|
|
42
|
+
"noEmit": true,
|
|
43
|
+
|
|
44
|
+
// Recommended
|
|
45
|
+
"esModuleInterop": true,
|
|
46
|
+
"forceConsistentCasingInFileNames": true,
|
|
47
|
+
// <https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#verbatimmodulesyntax>
|
|
48
|
+
// 所有未使用类型修饰符的导入或导出语句均会保留。
|
|
49
|
+
// 任何使用了类型修饰符的内容都会被完全移除。
|
|
50
|
+
"verbatimModuleSyntax": true,
|
|
51
|
+
// See <https://github.com/vuejs/vue-cli/pull/5688>
|
|
52
|
+
"skipLibCheck": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://www.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"emitDeclarationOnly": true,
|
|
6
|
+
|
|
7
|
+
// 为库生成声明文件。
|
|
8
|
+
"noEmit": false,
|
|
9
|
+
// 库通常需要更严格的类型精确度。
|
|
10
|
+
// 例如,其类型必须与 Vue 类型兼容。
|
|
11
|
+
// 因此我们不应跳过其依赖项的类型检查。
|
|
12
|
+
"skipLibCheck": false
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"display": "Vue 3",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
// Required in Vue projects
|
|
6
|
+
"jsx": "preserve",
|
|
7
|
+
"jsxImportSource": "vue",
|
|
8
|
+
"lib": [
|
|
9
|
+
// 目标设置为ES2020以与Vite对齐。
|
|
10
|
+
// <https://vite.dev/config/build-options.html#build-target>
|
|
11
|
+
// 对新版本语言内置功能的支持
|
|
12
|
+
// 交由用户自行处理,因为这将要求:
|
|
13
|
+
// - 项目无需支持旧版本浏览器;
|
|
14
|
+
// - 或项目已正确包含必要的polyfill。
|
|
15
|
+
"ES2020",
|
|
16
|
+
|
|
17
|
+
"DOM",
|
|
18
|
+
"DOM.Iterable"
|
|
19
|
+
|
|
20
|
+
// 由于 Vue 3 放弃了对 IE 的支持,因此没有 `ScriptHost`
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
// 设置为空以避免意外包含不需要的类型,
|
|
24
|
+
// 例如可能污染全局作用域的Node.js类型。
|
|
25
|
+
"types": []
|
|
26
|
+
}
|
|
27
|
+
}
|