@vocawiki/tsconfig 0.0.0-stage → 0.1.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 +78 -2
- package/base.json +31 -0
- package/package.json +25 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vocawiki contributors
|
|
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
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vocawiki/tsconfig
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vocawiki 共享的 TypeScript 配置。
|
|
4
|
+
|
|
5
|
+
内容源自 `vocawiki-frontend` 的 `tsconfig.base.json`,只保留与具体项目无关的编译选项:
|
|
6
|
+
它**不包含** `target`、`module`、`lib`、`paths`、`include` 等与运行环境强绑定的字段,请在使用项目中自行补充。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add -D @vocawiki/tsconfig
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 使用
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"extends": "./node_modules/@vocawiki/tsconfig/base"
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
也支持省略 `./node_modules/` 前缀:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"extends": "@vocawiki/tsconfig/base"
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
以及显式带扩展名的写法:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"extends": "@vocawiki/tsconfig/base.json"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
最小的可用示例:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"extends": "@vocawiki/tsconfig/base",
|
|
43
|
+
"compilerOptions": {
|
|
44
|
+
"target": "esnext",
|
|
45
|
+
"module": "esnext",
|
|
46
|
+
"lib": ["ESNext"],
|
|
47
|
+
"paths": {
|
|
48
|
+
"~/*": ["./src/*"]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"include": ["src"]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 刻意关闭的配置项
|
|
56
|
+
|
|
57
|
+
```jsonc
|
|
58
|
+
"noUnusedLocals": false,
|
|
59
|
+
"noUnusedParameters": false,
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
未使用的变量与参数交给 [Oxlint](../oxlint-config/README.md) 检查:Lint 支持 `_` 前缀约定、能识别仅类型层面的使用,
|
|
63
|
+
且报错位置与修复建议更友好。
|
|
64
|
+
|
|
65
|
+
## 常见搭配
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm add -D @vocawiki/tsconfig
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`package.json`:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"scripts": {
|
|
76
|
+
"lint:tsc": "tsc --noEmit"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
package/base.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup
|
|
4
|
+
"moduleDetection": "force",
|
|
5
|
+
"jsx": "react-jsx",
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
|
|
8
|
+
// Bundler mode
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
|
|
14
|
+
// Best practices
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"erasableSyntaxOnly": true,
|
|
17
|
+
"strict": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"noFallthroughCasesInSwitch": true,
|
|
20
|
+
"noUncheckedIndexedAccess": true,
|
|
21
|
+
"noImplicitOverride": true,
|
|
22
|
+
"noUnusedLocals": false, // 由 Oxlint 管理
|
|
23
|
+
"noUnusedParameters": false, // 由 Oxlint 管理
|
|
24
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
25
|
+
"forceConsistentCasingInFileNames": true,
|
|
26
|
+
"noImplicitAny": true,
|
|
27
|
+
"noImplicitReturns": true,
|
|
28
|
+
"noImplicitThis": true,
|
|
29
|
+
"noUncheckedSideEffectImports": true
|
|
30
|
+
}
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocawiki/tsconfig",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vocawiki 共享的 TypeScript 配置",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"tsconfig",
|
|
7
|
+
"typescript",
|
|
8
|
+
"config"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"files": [
|
|
13
|
+
"base.json"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
"./base": "./base.json",
|
|
17
|
+
"./base.json": "./base.json"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/vocawiki/project-configs.git",
|
|
22
|
+
"directory": "packages/tsconfig"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"provenance": true
|
|
27
|
+
}
|
|
6
28
|
}
|