@sicoti/tsconfig 1.0.0 → 1.0.1
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/README.md +366 -331
- package/base.json +89 -89
- package/bun.json +39 -39
- package/nestjs.json +47 -47
- package/nextjs.json +47 -47
- package/package.json +2 -2
- package/react-library.json +42 -42
package/README.md
CHANGED
|
@@ -1,331 +1,366 @@
|
|
|
1
|
-
# @sicoti/tsconfig
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@sicoti/tsconfig)
|
|
4
|
-
[](https://www.npmjs.com/package/@sicoti/tsconfig)
|
|
5
|
-
[](https://www.typescriptlang.org/)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
###
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
|
|
149
|
-
##
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
### `
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
//
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
"
|
|
304
|
-
|
|
305
|
-
"
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
1
|
+
# @sicoti/tsconfig
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@sicoti/tsconfig)
|
|
4
|
+
[](https://www.npmjs.com/package/@sicoti/tsconfig)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
> Centralized, shareable TypeScript configuration presets that enforce maximum type safety and best practices for modern JavaScript projects. Built for Next.js, NestJS, React libraries, and Bun with zero configuration.
|
|
9
|
+
|
|
10
|
+
## 📋 Table of Contents
|
|
11
|
+
|
|
12
|
+
- [🚀 Features](#-features)
|
|
13
|
+
- [📦 Installation](#-installation)
|
|
14
|
+
- [🔍 Requirements](#-requirements)
|
|
15
|
+
- [⚡ Quick Start](#-quick-start)
|
|
16
|
+
- [Next.js Applications](#nextjs-applications)
|
|
17
|
+
- [NestJS Applications](#nestjs-applications)
|
|
18
|
+
- [React Component Libraries](#react-component-libraries)
|
|
19
|
+
- [Bun Packages & CLI Tools](#bun-packages--cli-tools)
|
|
20
|
+
- [📋 Available Presets](#-available-presets)
|
|
21
|
+
- [🔒 Strict Type Checking](#-strict-type-checking)
|
|
22
|
+
- [Enabled by `strict: true`](#enabled-by-strict-true)
|
|
23
|
+
- [Additional Safety Checks (Not in `strict: true`)](#additional-safety-checks-not-in-strict-true)
|
|
24
|
+
- [❓ Why These Checks Matter](#-why-these-checks-matter)
|
|
25
|
+
- [`noUncheckedIndexedAccess`](#nouncheckedindexedaccess)
|
|
26
|
+
- [`noFallthroughCasesInSwitch`](#nofallthroughcasesinswitch)
|
|
27
|
+
- [`exactOptionalPropertyTypes`](#exactoptionalpropertytypes)
|
|
28
|
+
- [Why `strict: true` Alone Is Not Enough](#why-strict-true-alone-is-not-enough)
|
|
29
|
+
- [🏗️ Architecture](#️-architecture)
|
|
30
|
+
- [Design Philosophy](#design-philosophy)
|
|
31
|
+
- [🔧 Customization](#-customization)
|
|
32
|
+
- [📝 Changelog](#-changelog)
|
|
33
|
+
- [🤝 Contributing](#-contributing)
|
|
34
|
+
- [📄 License](#-license)
|
|
35
|
+
|
|
36
|
+
## ✨ Features
|
|
37
|
+
|
|
38
|
+
- 🔒 **Maximum Type Safety** — Strict mode plus additional safety checks beyond `strict: true`
|
|
39
|
+
- 📦 **Environment-Specific Presets** — Optimized configs for Next.js, NestJS, React libraries, and Bun
|
|
40
|
+
- 🎯 **Zero Configuration** — Works out of the box with sensible defaults
|
|
41
|
+
- 🔧 **Fully Extensible** — Easy to override any setting for your specific needs
|
|
42
|
+
- 📚 **Well Documented** — Clear comments explaining every option
|
|
43
|
+
|
|
44
|
+
## 📦 Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# npm
|
|
48
|
+
npm install -D @sicoti/tsconfig typescript
|
|
49
|
+
|
|
50
|
+
# yarn
|
|
51
|
+
yarn add -D @sicoti/tsconfig typescript
|
|
52
|
+
|
|
53
|
+
# pnpm
|
|
54
|
+
pnpm add -D @sicoti/tsconfig typescript
|
|
55
|
+
|
|
56
|
+
# bun
|
|
57
|
+
bun add -D @sicoti/tsconfig typescript
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 🔍 Requirements
|
|
61
|
+
|
|
62
|
+
- **TypeScript**: `>= 5.9.0`
|
|
63
|
+
- **Node.js**: `>= 18.0.0` (for full ES module support)
|
|
64
|
+
- **Package Manager**: npm, yarn, pnpm, or bun
|
|
65
|
+
|
|
66
|
+
## ⚡ Quick Start
|
|
67
|
+
|
|
68
|
+
Choose the preset that matches your project type and extend it in your `tsconfig.json`:
|
|
69
|
+
|
|
70
|
+
### Next.js Applications
|
|
71
|
+
|
|
72
|
+
```jsonc
|
|
73
|
+
{
|
|
74
|
+
"extends": "@sicoti/tsconfig/nextjs.json",
|
|
75
|
+
"compilerOptions": {
|
|
76
|
+
"baseUrl": ".",
|
|
77
|
+
"paths": {
|
|
78
|
+
"@/*": ["./src/*"]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
82
|
+
"exclude": ["node_modules"]
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### NestJS Applications
|
|
87
|
+
|
|
88
|
+
```jsonc
|
|
89
|
+
{
|
|
90
|
+
"extends": "@sicoti/tsconfig/nestjs.json",
|
|
91
|
+
"compilerOptions": {
|
|
92
|
+
"outDir": "./dist",
|
|
93
|
+
"baseUrl": ".",
|
|
94
|
+
"paths": {
|
|
95
|
+
"@/*": ["./src/*"]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"include": ["src/**/*"],
|
|
99
|
+
"exclude": ["node_modules", "dist"]
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### React Component Libraries
|
|
104
|
+
|
|
105
|
+
```jsonc
|
|
106
|
+
{
|
|
107
|
+
"extends": "@sicoti/tsconfig/react-library.json",
|
|
108
|
+
"compilerOptions": {
|
|
109
|
+
"outDir": "./dist",
|
|
110
|
+
"rootDir": "./src",
|
|
111
|
+
"baseUrl": ".",
|
|
112
|
+
"paths": {
|
|
113
|
+
"@/*": ["./src/*"]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"include": ["src/**/*"],
|
|
117
|
+
"exclude": ["dist", "node_modules"]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Bun Packages & CLI Tools
|
|
122
|
+
|
|
123
|
+
```jsonc
|
|
124
|
+
{
|
|
125
|
+
"extends": "@sicoti/tsconfig/bun.json",
|
|
126
|
+
"compilerOptions": {
|
|
127
|
+
"outDir": "./dist",
|
|
128
|
+
"rootDir": "./src",
|
|
129
|
+
"baseUrl": ".",
|
|
130
|
+
"paths": {
|
|
131
|
+
"@/*": ["./src/*"]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"include": ["src/**/*"],
|
|
135
|
+
"exclude": ["dist", "node_modules"]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 📋 Available Presets
|
|
140
|
+
|
|
141
|
+
| Preset | Use Case | Key Features |
|
|
142
|
+
| :------- | :--------- | :------------- |
|
|
143
|
+
| `nextjs.json` | Next.js apps (App Router / Pages Router) | `jsx: preserve`, `noEmit`, Next.js plugin |
|
|
144
|
+
| `nestjs.json` | NestJS backend applications | Decorator metadata, source maps, DI support |
|
|
145
|
+
| `react-library.json` | React component libraries | `jsx: react-jsx`, declaration files, source maps |
|
|
146
|
+
| `bun.json` | Bun runtime packages & CLI tools | Declaration files, optimized for Bun bundler |
|
|
147
|
+
| `base.json` | ⚠️ Internal foundation (not for direct use) | Universal strict settings |
|
|
148
|
+
|
|
149
|
+
## 🔒 Strict Type Checking
|
|
150
|
+
|
|
151
|
+
All presets inherit from `base.json` which enables maximum type safety:
|
|
152
|
+
|
|
153
|
+
### Enabled by `strict: true`
|
|
154
|
+
|
|
155
|
+
| Option | Description |
|
|
156
|
+
| :------- | :------------ |
|
|
157
|
+
| `strictNullChecks` | Check null/undefined assignments |
|
|
158
|
+
| `strictFunctionTypes` | Strict function type checking |
|
|
159
|
+
| `strictBindCallApply` | Type checking for bind/call/apply |
|
|
160
|
+
| `strictPropertyInitialization` | Ensure class properties are initialized |
|
|
161
|
+
| `noImplicitThis` | Error on implicit 'this' types |
|
|
162
|
+
| `noImplicitAny` | Error on implicit 'any' types |
|
|
163
|
+
| `alwaysStrict` | Emit "use strict" in all files |
|
|
164
|
+
| `useUnknownInCatchVariables` | Use 'unknown' instead of 'any' in catch |
|
|
165
|
+
|
|
166
|
+
### Additional Safety Checks (Not in `strict: true`)
|
|
167
|
+
|
|
168
|
+
| Option | Description |
|
|
169
|
+
| :------- | :------------ |
|
|
170
|
+
| `noUnusedLocals` | Error on unused local variables |
|
|
171
|
+
| `noUnusedParameters` | Error on unused function parameters |
|
|
172
|
+
| `noImplicitReturns` | Error when not all paths return a value |
|
|
173
|
+
| `noFallthroughCasesInSwitch` | Error on switch case fall-through |
|
|
174
|
+
| `allowUnreachableCode` | Error on unreachable code |
|
|
175
|
+
| `noUncheckedIndexedAccess` | Add `undefined` to index signature results |
|
|
176
|
+
| `exactOptionalPropertyTypes` | Distinguish between `undefined` and missing |
|
|
177
|
+
| `noPropertyAccessFromIndexSignature` | Require bracket notation for index access |
|
|
178
|
+
| `noImplicitOverride` | Require 'override' keyword for overrides |
|
|
179
|
+
| `noUncheckedSideEffectImports` | Validate side-effect imports exist |
|
|
180
|
+
|
|
181
|
+
## 💡 Why These Checks Matter
|
|
182
|
+
|
|
183
|
+
### `noUncheckedIndexedAccess`
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// ❌ Without: No error, crashes at runtime
|
|
187
|
+
const users: User[] = [];
|
|
188
|
+
const first = users[0]; // Type: User (WRONG!)
|
|
189
|
+
first.name; // 💥 Runtime error: Cannot read property 'name' of undefined
|
|
190
|
+
|
|
191
|
+
// ✅ With: Compiler catches it
|
|
192
|
+
const first = users[0]; // Type: User | undefined
|
|
193
|
+
if (first) {
|
|
194
|
+
first.name; // ✓ Safe access
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### `noFallthroughCasesInSwitch`
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
// ❌ Without: Silent fall-through bug
|
|
202
|
+
switch (action) {
|
|
203
|
+
case "login":
|
|
204
|
+
login();
|
|
205
|
+
// Oops! Falls through to logout!
|
|
206
|
+
case "logout":
|
|
207
|
+
logout();
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ✅ With: TS7029 error prevents the bug
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### `exactOptionalPropertyTypes`
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
interface Config {
|
|
218
|
+
cache?: { ttl: number };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ❌ Without: Both accepted but have different semantics
|
|
222
|
+
setConfig({}); // OK - cache is missing
|
|
223
|
+
setConfig({ cache: undefined }); // OK - but this explicitly sets cache to undefined!
|
|
224
|
+
|
|
225
|
+
// ✅ With: Explicit undefined is an error
|
|
226
|
+
// TS2379: Type 'undefined' is not assignable to type '{ ttl: number }'
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Why `strict: true` Alone Is Not Enough
|
|
230
|
+
|
|
231
|
+
Many developers assume that `"strict": true` enables all TypeScript safety checks. **This is a common misconception.** The `strict` flag only enables 8 specific checks, leaving many critical safety features disabled by default.
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
// ❌ This code compiles with ONLY strict: true
|
|
235
|
+
|
|
236
|
+
// 1. Unused variables? No error.
|
|
237
|
+
const unusedVar = "I'm never used";
|
|
238
|
+
|
|
239
|
+
// 2. Array access without bounds checking? No error.
|
|
240
|
+
const users: string[] = [];
|
|
241
|
+
const first = users[0]; // Type: string (but it's actually undefined!)
|
|
242
|
+
first.toUpperCase(); // 💥 Runtime crash!
|
|
243
|
+
|
|
244
|
+
// 3. Switch fall-through? No error.
|
|
245
|
+
function handle(action: "save" | "delete") {
|
|
246
|
+
switch (action) {
|
|
247
|
+
case "save":
|
|
248
|
+
save();
|
|
249
|
+
// Oops! Falls through to delete!
|
|
250
|
+
case "delete":
|
|
251
|
+
deleteAll(); // 💥 Unintended deletion!
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// 4. Missing return in some branches? No error.
|
|
256
|
+
function getValue(condition: boolean): string {
|
|
257
|
+
if (condition) {
|
|
258
|
+
return "value";
|
|
259
|
+
}
|
|
260
|
+
// 💥 Returns undefined, but TypeScript says it returns string!
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
// ✅ With @sicoti/tsconfig - ALL of these are caught at compile time!
|
|
266
|
+
|
|
267
|
+
// 1. TS6133: 'unusedVar' is declared but never used
|
|
268
|
+
const unusedVar = "I'm never used";
|
|
269
|
+
|
|
270
|
+
// 2. TS18048: 'first' is possibly 'undefined'
|
|
271
|
+
const users: string[] = [];
|
|
272
|
+
const first = users[0]; // Type: string | undefined
|
|
273
|
+
if (first) {
|
|
274
|
+
first.toUpperCase(); // ✓ Safe!
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// 3. TS7029: Fallthrough case in switch
|
|
278
|
+
function handle(action: "save" | "delete") {
|
|
279
|
+
switch (action) {
|
|
280
|
+
case "save":
|
|
281
|
+
save();
|
|
282
|
+
break; // ✓ Required!
|
|
283
|
+
case "delete":
|
|
284
|
+
deleteAll();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 4. TS7030: Not all code paths return a value
|
|
289
|
+
function getValue(condition: boolean): string {
|
|
290
|
+
if (condition) {
|
|
291
|
+
return "value";
|
|
292
|
+
}
|
|
293
|
+
return "default"; // ✓ Required!
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Bottom line:** `strict: true` is just the starting point. This package enables **10+ additional checks** that catch real bugs before they reach production.
|
|
298
|
+
|
|
299
|
+
## 🏗️ Architecture
|
|
300
|
+
|
|
301
|
+
```mermaid
|
|
302
|
+
flowchart TD
|
|
303
|
+
base["base.json<br/>Foundation (DO NOT extend directly)<br/>Universal strict settings"] --> nextjs["nextjs.json<br/>Next.js applications<br/>jsx: preserve, noEmit, Next.js plugin"]
|
|
304
|
+
base --> nestjs["nestjs.json<br/>NestJS applications<br/>Decorator metadata, source maps, DI support"]
|
|
305
|
+
base --> bun["bun.json<br/>Bun runtime packages & CLI tools<br/>Declaration files, optimized for Bun bundler"]
|
|
306
|
+
base --> reactlib["react-library.json<br/>React component libraries<br/>jsx: react-jsx, declaration files, source maps"]
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Design Philosophy
|
|
310
|
+
|
|
311
|
+
**`base.json` includes:**
|
|
312
|
+
|
|
313
|
+
- Universal strict type checking settings
|
|
314
|
+
- Modern ES module configuration
|
|
315
|
+
- Code quality checks (unused code, control flow)
|
|
316
|
+
- Import safety validations
|
|
317
|
+
|
|
318
|
+
**`base.json` intentionally excludes:**
|
|
319
|
+
|
|
320
|
+
- `lib` (DOM, ESNext) — Varies by runtime environment
|
|
321
|
+
- `jsx` settings — Only for React-based projects
|
|
322
|
+
- `sourceMap`, `declaration` — Build output varies by project
|
|
323
|
+
- `emitDecoratorMetadata` — Only for NestJS/decorator-based DI
|
|
324
|
+
|
|
325
|
+
## 🔧 Customization
|
|
326
|
+
|
|
327
|
+
You can override any setting in your project's `tsconfig.json`:
|
|
328
|
+
|
|
329
|
+
```jsonc
|
|
330
|
+
{
|
|
331
|
+
"extends": "@sicoti/tsconfig/nextjs.json",
|
|
332
|
+
"compilerOptions": {
|
|
333
|
+
// Override specific settings
|
|
334
|
+
"noUncheckedIndexedAccess": false, // Disable if too strict for your codebase
|
|
335
|
+
"baseUrl": ".",
|
|
336
|
+
"paths": {
|
|
337
|
+
"@/*": ["./src/*"],
|
|
338
|
+
"@components/*": ["./src/components/*"]
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## 📝 Changelog
|
|
345
|
+
|
|
346
|
+
See [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.
|
|
347
|
+
|
|
348
|
+
## 🤝 Contributing
|
|
349
|
+
|
|
350
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
351
|
+
|
|
352
|
+
1. Fork the repository
|
|
353
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
354
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
|
|
355
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
356
|
+
5. Open a Pull Request
|
|
357
|
+
|
|
358
|
+
## 📄 License
|
|
359
|
+
|
|
360
|
+
[MIT](LICENSE) © [SICOTI Team](https://github.com/SICOTI-Peru)
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
<p align="center">
|
|
365
|
+
Made with ❤️ by the <a href="https://github.com/SICOTI-Peru">SICOTI Team</a>
|
|
366
|
+
</p>
|