@igorskyflyer/tsconfig 1.0.1 → 2.0.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/README.md CHANGED
@@ -27,13 +27,13 @@
27
27
 
28
28
  ## Features
29
29
 
30
- - 🔧 Strict `TypeScript` rules enabled by default
31
- - 📦 Separate configs for `Node` and `browser` environments
32
- - 🎯 `ES2024` target - `modern` and future-ready
33
- - 🗂️ Predefined `src/`, `dist/` and `test/` structure
34
- - 🔍 Catches `unused` locals, parameters and implicit `any`
35
- - 🗺️ `Source maps` and `declaration` maps included
36
- - `Zero-config` setup - extend and go
30
+ - 🔧 Very strict TypeScript configuration by default (`strict: true` + modern strict options)
31
+ - 📦 Separate configs for Node.js and browser environments
32
+ - 🎯 `ES2024` target - modern and future-ready (requires Node ≥ 24)
33
+ - 🗺️ Full source maps + declaration maps for excellent debugging and type publishing
34
+ - `verbatimModuleSyntax` + `isolatedDeclarations` for clean, modern module handling
35
+ - 🔍 Strong type safety with `exactOptionalPropertyTypes`, `noUncheckedIndexedAccess`, and more
36
+ - 🧩 Clean, reusable base - designed to be extended with minimal effort
37
37
 
38
38
  <br>
39
39
 
@@ -42,49 +42,91 @@
42
42
  Install it by executing any of the following, depending on the preferred package manager:
43
43
 
44
44
  ```bash
45
- pnpm add -D @igorskyflyer/tsconfig
45
+ bun add @igorskyflyer/tsconfig -D
46
46
  ```
47
47
 
48
48
  ```bash
49
- yarn add -D @igorskyflyer/tsconfig
49
+ pnpm add @igorskyflyer/tsconfig -D
50
50
  ```
51
51
 
52
52
  ```bash
53
- npm i -D @igorskyflyer/tsconfig
53
+ yarn add @igorskyflyer/tsconfig -D
54
+ ```
55
+
56
+ ```bash
57
+ npm i @igorskyflyer/tsconfig -D
54
58
  ```
55
59
 
56
60
  <br>
57
61
 
58
- Then extend the preferred config in `tsconfig.json`:
62
+ Then extend the preferred config in **tsconfig.json**:
59
63
 
60
- **Node (default):**
61
- ```jsonc
64
+ **Node (default)**
65
+ `tsconfig.json`
66
+ ```json
62
67
  {
63
- "extends": "@igorskyflyer/tsconfig"
68
+ "extends": "@igorskyflyer/tsconfig",
69
+ "include": ["src/**/*"],
70
+ "exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
71
+ "compilerOptions": {
72
+ "rootDir": "./src",
73
+ "outDir": "./dist"
74
+ }
64
75
  }
65
76
  ```
66
77
 
67
- **Node (explicit):**
68
- ```jsonc
78
+ <br>
79
+
80
+ **Node (explicit)**
81
+ `tsconfig.json`
82
+ ```json
69
83
  {
70
- "extends": "@igorskyflyer/tsconfig/node"
84
+ "extends": "@igorskyflyer/tsconfig/node",
85
+ "include": ["src/**/*"],
86
+ "exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
87
+ "compilerOptions": {
88
+ "rootDir": "./src",
89
+ "outDir": "./dist"
90
+ }
71
91
  }
72
92
  ```
73
93
 
74
- **Browser:**
75
- ```jsonc
94
+ <br>
95
+
96
+ **Browser**
97
+ `tsconfig.json`
98
+ ```json
76
99
  {
77
- "extends": "@igorskyflyer/tsconfig/browser"
100
+ "extends": "@igorskyflyer/tsconfig/browser",
101
+ "include": ["src/**/*"],
102
+ "exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
103
+ "compilerOptions": {
104
+ "rootDir": "./src",
105
+ "outDir": "./dist"
106
+ }
78
107
  }
79
108
  ```
80
109
 
81
- **Base only:**
82
- ```jsonc
110
+ <br>
111
+
112
+ **Base only**
113
+ `tsconfig.json`
114
+ ```json
83
115
  {
84
- "extends": "@igorskyflyer/tsconfig/base"
116
+ "extends": "@igorskyflyer/tsconfig/base",
117
+ "include": ["src/**/*"],
118
+ "exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
119
+ "compilerOptions": {
120
+ "rootDir": "./src",
121
+ "outDir": "./dist"
122
+ }
85
123
  }
86
124
  ```
87
125
 
126
+ >[!NOTE]
127
+ > `include`, `exclude`, `rootDir` and `outDir` are project-specific and must be defined locally.
128
+ >
129
+
88
130
  <br>
89
131
 
90
132
  ## Implementation
@@ -92,25 +134,27 @@ Then extend the preferred config in `tsconfig.json`:
92
134
  All configs extend `base`, which defines the shared structure and strict rules.
93
135
 
94
136
  ### Base
137
+ `tsconfig.json`
95
138
  ```jsonc
96
139
  {
97
- "include": ["src/**/*"],
98
- "exclude": ["node_modules/**/*", "test/**/*", "dist/**/*"],
99
140
  "compilerOptions": {
100
- "rootDir": "./src", // source files root
101
- "outDir": "./dist", // compiled output root
102
- "declaration": true, // generate .d.ts files
103
- "declarationMap": true, // generate .d.ts.map files
104
- "sourceMap": true, // generate .js.map files
105
- "verbatimModuleSyntax": true, // enforce explicit import/export types
106
- "strict": true, // enable all strict checks
107
- "noUnusedLocals": true, // error on unused local variables
108
- "noUnusedParameters": true, // error on unused function parameters
109
- "noImplicitAny": true, // error on implicit 'any' types
110
- "noImplicitReturns": true, // error on missing return statements
111
- "skipLibCheck": true, // skip type-checking of .d.ts files
141
+ "declaration": true, // generate .d.ts files
142
+ "declarationMap": true, // generate .d.ts.map files
143
+ "sourceMap": true, // generate .js.map files
144
+ "verbatimModuleSyntax": true, // enforce explicit import/export types
145
+ "isolatedDeclarations": true, // require explicit types on all exports (faster .d.ts emit)
146
+ "strict": true, // enable all strict type checks
147
+ "exactOptionalPropertyTypes": true, // treat optional properties strictly (undefined vs missing)
148
+ "noFallthroughCasesInSwitch": true, // error on switch cases that fall through
149
+ "noUncheckedIndexedAccess": true, // index signatures include undefined
150
+ "noPropertyAccessFromIndexSignature": true, // prevent property access outside index signatures
151
+ "noUnusedLocals": true, // error on unused local variables
152
+ "noUnusedParameters": true, // error on unused function parameters
153
+ "noImplicitAny": true, // error on implicit 'any' types
154
+ "noImplicitReturns": true, // error on functions missing return statements
155
+ "skipLibCheck": true, // skip type-checking of declaration files
112
156
  "forceConsistentCasingInFileNames": true, // enforce consistent file casing
113
- "noEmitOnError": true // skip emit if type errors exist
157
+ "noEmitOnError": true // don't emit files if there are type errors
114
158
  }
115
159
  }
116
160
  ```
@@ -118,12 +162,14 @@ All configs extend `base`, which defines the shared structure and strict rules.
118
162
  ### Node
119
163
 
120
164
  Extends `base` and adds `Node` environment targeting:
165
+ `tsconfig.json`
121
166
  ```jsonc
122
167
  {
123
168
  "extends": "./tsconfig.base.json",
124
169
  "compilerOptions": {
125
170
  "target": "ES2024", // modern JS output
126
171
  "lib": ["ES2024"], // modern built-in types
172
+ "types": ["node"], // Node.js global type definitions
127
173
  "module": "NodeNext", // Node ESM-compatible modules
128
174
  "moduleResolution": "NodeNext" // Node ESM module resolution
129
175
  }
@@ -133,6 +179,7 @@ Extends `base` and adds `Node` environment targeting:
133
179
  ### Browser
134
180
 
135
181
  Extends `base` and adds `browser` environment targeting:
182
+ `tsconfig.json`
136
183
  ```jsonc
137
184
  {
138
185
  "extends": "./tsconfig.base.json",
@@ -140,7 +187,12 @@ Extends `base` and adds `browser` environment targeting:
140
187
  "target": "ES2024", // modern JS output
141
188
  "lib": ["ES2024", "DOM", "DOM.Iterable"], // modern + DOM types
142
189
  "module": "ESNext", // bundler-compatible modules
143
- "moduleResolution": "Bundler" // bundler module resolution
190
+ "moduleResolution": "Bundler", // bundler module resolution
191
+ "allowImportingTsExtensions": true, // allow explicit .ts extensions in imports
192
+ "erasableSyntaxOnly": true, // ensure compatibility with type-stripping engines
193
+ "noEmit": true, // hand over file emission to the bundler
194
+ "declaration": false, // disable base declaration emit to prevent noEmit conflict
195
+ "declarationMap": false // disable base declaration maps
144
196
  }
145
197
  }
146
198
  ```
@@ -185,6 +237,10 @@ Licensed under the [**MIT license**](https://github.com/igorskyflyer/npm-tsconfi
185
237
 
186
238
  ## Related
187
239
 
240
+ This package is part of the [**dotfiles**](https://github.com/igorskyflyer/dotfiles) DX config suite - a curated index of independently installable configuration packages for linting, formatting, editing, JS/TS, React, Vue and many more.
241
+
242
+ ### Other related packages
243
+
188
244
  [**@igorskyflyer/duoscribi**](https://www.npmjs.com/package/@igorskyflyer/duoscribi)
189
245
 
190
246
  > _✒ DúöScríbî allows you to convert letters with diacritics to regular letters. 🤓_
package/package.json CHANGED
@@ -1,18 +1,40 @@
1
1
  {
2
2
  "name": "@igorskyflyer/tsconfig",
3
- "version": "1.0.1",
4
- "description": "🔧 Opinionated, reusable TSConfig base for modern TypeScript projects by igorskyflyer. 🧠",
3
+ "version": "2.0.0",
4
+ "description": "🔧 Opinionated, reusable TSConfig base for modern TypeScript projects. 🧠",
5
+ "engines": {
6
+ "node": ">=24.0.0"
7
+ },
8
+ "exports": {
9
+ ".": "./tsconfig.json",
10
+ "./base": "./tsconfig.base.json",
11
+ "./node": "./tsconfig.node.json",
12
+ "./browser": "./tsconfig.browser.json"
13
+ },
5
14
  "files": [
6
15
  "tsconfig.base.json",
7
16
  "tsconfig.browser.json",
8
17
  "tsconfig.json",
9
18
  "tsconfig.node.json"
10
19
  ],
11
- "exports": {
12
- ".": "./tsconfig.json",
13
- "./base": "./tsconfig.base.json",
14
- "./node": "./tsconfig.node.json",
15
- "./browser": "./tsconfig.browser.json"
20
+ "peerDependencies": {
21
+ "typescript": ">=6.0.0",
22
+ "@types/node": ">=24.0.0"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "private": false,
28
+ "license": "MIT",
29
+ "author": "Igor Dimitrijević <support@igorskyflyer.me> (https://github.com/igorskyflyer)",
30
+ "funding": "https://ko-fi.com/igorskyflyer",
31
+ "homepage": "https://github.com/igorskyflyer/npm-tsconfig",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/igorskyflyer/npm-tsconfig.git"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/igorskyflyer/npm-tsconfig/issues"
16
38
  },
17
39
  "keywords": [
18
40
  "tsconfig",
@@ -29,23 +51,6 @@
29
51
  "igor dimitrijević",
30
52
  "igorskyflyer"
31
53
  ],
32
- "license": "MIT",
33
- "author": "Igor Dimitrijević <support@igorskyflyer.me> (https://github.com/igorskyflyer)",
34
- "funding": "https://ko-fi.com/igorskyflyer",
35
- "homepage": "https://github.com/igorskyflyer/npm-tsconfig",
36
- "repository": {
37
- "type": "git",
38
- "url": "git+https://github.com/igorskyflyer/npm-tsconfig.git"
39
- },
40
- "bugs": {
41
- "url": "https://github.com/igorskyflyer/npm-tsconfig/issues"
42
- },
43
- "peerDependencies": {
44
- "typescript": ">=5.0.0"
45
- },
46
- "publishConfig": {
47
- "access": "public"
48
- },
49
54
  "scripts": {
50
55
  "pub": "git push origin main --tags"
51
56
  }
@@ -1,13 +1,5 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/tsconfig",
3
- "include": [
4
- "src/**/*"
5
- ],
6
- "exclude": [
7
- "node_modules/**/*",
8
- "test/**/*",
9
- "dist/**/*"
10
- ],
11
3
  "compilerOptions": {
12
4
  "declaration": true,
13
5
  "declarationMap": true,
@@ -20,6 +12,11 @@
20
12
  "noImplicitReturns": true,
21
13
  "skipLibCheck": true,
22
14
  "forceConsistentCasingInFileNames": true,
23
- "noEmitOnError": true
15
+ "noEmitOnError": true,
16
+ "exactOptionalPropertyTypes": true,
17
+ "noFallthroughCasesInSwitch": true,
18
+ "noUncheckedIndexedAccess": true,
19
+ "noPropertyAccessFromIndexSignature": true,
20
+ "isolatedDeclarations": true
24
21
  }
25
22
  }
@@ -9,6 +9,11 @@
9
9
  "DOM.Iterable"
10
10
  ],
11
11
  "module": "ESNext",
12
- "moduleResolution": "Bundler"
12
+ "moduleResolution": "Bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "erasableSyntaxOnly": true,
15
+ "noEmit": true,
16
+ "declaration": false,
17
+ "declarationMap": false
13
18
  }
14
19
  }
@@ -6,6 +6,9 @@
6
6
  "lib": [
7
7
  "ES2024"
8
8
  ],
9
+ "types": [
10
+ "node"
11
+ ],
9
12
  "module": "NodeNext",
10
13
  "moduleResolution": "NodeNext"
11
14
  }