-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsconfig.base.json
114 lines (93 loc) · 4.51 KB
/
tsconfig.base.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
"compilerOptions": {
// https://www.typescriptlang.org/tsconfig#baseUrl
"baseUrl": ".",
// All new TypeScript projects should use "esModuleInterop": true.
// https://esbuild.github.io/content-types/#es-module-interop
// https://www.typescriptlang.org/tsconfig#esModuleInterop
"esModuleInterop": true,
// https://www.typescriptlang.org/tsconfig#forceConsistentCasingInFileNames
"forceConsistentCasingInFileNames": true,
// Setting "importHelpers" to true would mean that a consumer of a library
// of this monorepo would need to declare tslib as a dependency. Don't do it!
// https://www.typescriptlang.org/tsconfig#importHelpers
"importHelpers": false,
// This is not important for this project, but it speeds up compilation
// times, so I want to remember it for larger projects.
// https://www.typescriptlang.org/tsconfig#incremental
"incremental": true,
// This project uses esbuild to bundle its applications. esbuild compiles
// the files independently, so we must set "isolatedModules": true.
// https://esbuild.github.io/content-types/#isolated-modules
// https://www.typescriptlang.org/tsconfig#isolatedModules
"isolatedModules": true,
// Leave "lib" empty here, and define it in the tsconfig of each package, so
// it's more explicit.
// https://www.typescriptlang.org/tsconfig#lib
"lib": [],
// All of the libraries of this monorepo are compiled for ESM only (no CJS).
// https://www.typescriptlang.org/tsconfig#module
// https://www.typescriptlang.org/docs/handbook/module-resolution.html
"module": "es2020",
// TypeScript 4.5 (released on 16th November, 2021) can use "nodenext" to
// support ECMAScript Modules (ESM).
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/
// https://www.typescriptlang.org/tsconfig#moduleResolution
// https://www.typescriptlang.org/docs/handbook/module-resolution.html
"moduleResolution": "node",
// "moduleResolution": "nodenext",
// https://www.typescriptlang.org/tsconfig#noImplicitAny
"noImplicitAny": true,
// https://www.typescriptlang.org/tsconfig#noUnusedLocals
"noUnusedLocals": true,
// https://www.typescriptlang.org/tsconfig#noUnusedParameters
"noUnusedParameters": true,
// paths are resolved relative to baseUrl
// I am not sure if I really need these path mappings. I do need the path
// mapping in my Jest config, but these ones?
// https://www.typescriptlang.org/tsconfig/#paths
"paths": {
"@jackdbd/*": [
"../packages/*/lib/index.d.ts",
"../packages/*/lib/index.js"
]
},
// As far as I understand, preserveConstEnums has no effect for non-const
// enums and should not affect the bundle size, but it must be set to true
// when isolatedModules is set to true.
// https://stackoverflow.com/questions/28818849/how-do-the-different-enum-variants-work-in-typescript
// https://www.typescriptlang.org/tsconfig#preserveConstEnums
// https://ncjamieson.com/dont-export-const-enums/
"preserveConstEnums": true,
// it would be safer to set skipLibCheck to false, but it's kind of slow.
// Maybe enable it from time to time to type check dependencies.
// https://www.typescriptlang.org/tsconfig#skipLibCheck
"skipLibCheck": true,
// In most cases I want to generate source maps.
// https://m.signalvnoise.com/paying-tribute-to-the-web-with-view-source/
"sourceMap": true,
// strict mode sets many strict compiler options to true in one go.
// https://www.typescriptlang.org/tsconfig#strict
"strict": true,
// https://www.typescriptlang.org/tsconfig#strictNullChecks
"strictNullChecks": true,
// The libraries of this monorepo target Node.js
// You may “mix and match” target and lib settings as desired, but you could
// just set target for convenience.
// https://www.typescriptlang.org/tsconfig#target
// https://node.green/
"target": "es2020",
// https://www.typescriptlang.org/tsconfig#typeRoots
"typeRoots": ["../node_modules/@types", "../custom-types"],
"verbatimModuleSyntax": true
},
"exclude": [
// monorepo root node_modules. Those dependencies that are hoisted by npm
// workspaces end up here.
"../node_modules",
// node_modules of each package. Those dependencies that npm cannot hoist
// end up here. This happens because different packages require a different
// version of the same dependency.
"../packages/*/node_modules"
]
}