@kitschpatrol/typescript-config 5.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/bin/cli.js +6189 -0
- package/init/.vscode/settings.json +4 -0
- package/init/tsconfig.build.json +7 -0
- package/init/tsconfig.json +7 -0
- package/license.txt +21 -0
- package/package.json +57 -0
- package/readme.md +197 -0
- package/tsconfigs/base.json +23 -0
package/license.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Eric Mika
|
|
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/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kitschpatrol/typescript-config",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "TypeScript configuration for @kitschpatrol/shared-config.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"shared-config",
|
|
7
|
+
"typescript",
|
|
8
|
+
"tsconfig",
|
|
9
|
+
"cli",
|
|
10
|
+
"kpi",
|
|
11
|
+
"kpi-typescript"
|
|
12
|
+
],
|
|
13
|
+
"bugs": "https://github.com/kitschpatrol/shared-config/issues",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/kitschpatrol/shared-config/cli.git",
|
|
17
|
+
"directory": "packages/typescript-config"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Eric Mika",
|
|
22
|
+
"email": "eric@ericmika.com",
|
|
23
|
+
"url": "https://ericmika.com"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": "./tsconfigs/base.json"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"kpi-typescript": "bin/cli.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"tsconfigs/*",
|
|
34
|
+
"bin/*",
|
|
35
|
+
"init/*"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@pinojs/json-colorizer": "^4.0.0",
|
|
39
|
+
"cosmiconfig": "^9.0.0",
|
|
40
|
+
"execa": "^9.5.2",
|
|
41
|
+
"fs-extra": "^11.3.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"typescript": "~5.7.3"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=22.0.0",
|
|
48
|
+
"pnpm": ">=10.0.0"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "../../scripts/build.ts",
|
|
55
|
+
"cli": "node ./bin/cli.js"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<!--+ Warning: Content inside HTML comment blocks was generated by mdat and may be overwritten. +-->
|
|
2
|
+
|
|
3
|
+
<!-- title -->
|
|
4
|
+
|
|
5
|
+
# @kitschpatrol/typescript-config
|
|
6
|
+
|
|
7
|
+
<!-- /title -->
|
|
8
|
+
|
|
9
|
+
<!-- badges -->
|
|
10
|
+
|
|
11
|
+
[](https://npmjs.com/package/@kitschpatrol/typescript-config)
|
|
12
|
+
[](https://opensource.org/licenses/MIT)
|
|
13
|
+
|
|
14
|
+
<!-- /badges -->
|
|
15
|
+
|
|
16
|
+
<!-- description -->
|
|
17
|
+
|
|
18
|
+
**TypeScript configuration for @kitschpatrol/shared-config.**
|
|
19
|
+
|
|
20
|
+
<!-- /description -->
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
It's a shared [TypeScript](https://www.typescriptlang.org/) `tsconfig.json` config, plus a command-line tool `kpi-typescript` to perform TypeScript-related validation and linting.
|
|
25
|
+
|
|
26
|
+
<!-- recommendation -->
|
|
27
|
+
|
|
28
|
+
> [!Important]
|
|
29
|
+
>
|
|
30
|
+
> **You can use this package on its own, but it's recommended to use [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) instead for a single-dependency and single-package approach to linting and fixing your project.**
|
|
31
|
+
>
|
|
32
|
+
> This package is included as a dependency in [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config), which also automatically invokes the command line functionality in this package via its `kpi` command
|
|
33
|
+
|
|
34
|
+
<!-- /recommendation -->
|
|
35
|
+
|
|
36
|
+
## Setup
|
|
37
|
+
|
|
38
|
+
> [!Note]
|
|
39
|
+
>
|
|
40
|
+
> The package treats `typescript` as a peer dependency — it expects you to have `typescript` installed in your project.
|
|
41
|
+
|
|
42
|
+
To use just this TypeScript config in isolation:
|
|
43
|
+
|
|
44
|
+
1. Install the `.npmrc` in your project root. This is required for correct PNPM behavior:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pnpm dlx @kitschpatrol/repo-config init
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. Add the package:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
pnpm add -D @kitschpatrol/typescript-config
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
3. Add the starter `tsconfig.json` and `tsconfig.build.json` files to your project root, and add any customizations you'd like:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
pnpm exec kpi-typescript init
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
You can call `kpi-typescript` directly, or use the script bundled with the config.
|
|
65
|
+
|
|
66
|
+
Integrate with your `package.json` scripts as you see fit, for example:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"scripts": {
|
|
71
|
+
"lint": "kpi-typescript lint"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Ignoring files
|
|
77
|
+
|
|
78
|
+
See the `tsconfig.json` [`exclude`](https://www.typescriptlang.org/tsconfig/#exclude) key.
|
|
79
|
+
|
|
80
|
+
`.gitignore` files are not ignored.
|
|
81
|
+
|
|
82
|
+
### Ignoring code
|
|
83
|
+
|
|
84
|
+
See [the TypeScript directive comments documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#improved-checking-for-js-files) for more details.
|
|
85
|
+
|
|
86
|
+
Entire files (at top):
|
|
87
|
+
|
|
88
|
+
`/* @ts-nocheck */`
|
|
89
|
+
|
|
90
|
+
Next line:
|
|
91
|
+
|
|
92
|
+
`/* @ts-ignore */`
|
|
93
|
+
|
|
94
|
+
or
|
|
95
|
+
|
|
96
|
+
`/* @ts-expect-error - reason */`
|
|
97
|
+
|
|
98
|
+
### CLI
|
|
99
|
+
|
|
100
|
+
<!-- cli-help -->
|
|
101
|
+
|
|
102
|
+
#### Command: `kpi-typescript`
|
|
103
|
+
|
|
104
|
+
Kitschpatrol's TypeScript shared configuration tools.
|
|
105
|
+
|
|
106
|
+
This section lists top-level commands for `kpi-typescript`.
|
|
107
|
+
|
|
108
|
+
Usage:
|
|
109
|
+
|
|
110
|
+
```txt
|
|
111
|
+
kpi-typescript <command>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `init` | Initialize by copying starter config files to your project root. |
|
|
117
|
+
| `lint` | Run type checking on your project. Package-scoped. In a monorepo, it will also run in all packages below the current working directory. |
|
|
118
|
+
| `print-config` | Print the TypeScript configuration for the project. Package-scoped. Searches up to the root of a monorepo if necessary. |
|
|
119
|
+
|
|
120
|
+
| Option | Description | Type |
|
|
121
|
+
| ------------------- | ------------------- | --------- |
|
|
122
|
+
| `--help`<br>`-h` | Show help | `boolean` |
|
|
123
|
+
| `--version`<br>`-v` | Show version number | `boolean` |
|
|
124
|
+
|
|
125
|
+
_See the sections below for more information on each subcommand._
|
|
126
|
+
|
|
127
|
+
#### Subcommand: `kpi-typescript init`
|
|
128
|
+
|
|
129
|
+
Initialize by copying starter config files to your project root.
|
|
130
|
+
|
|
131
|
+
Usage:
|
|
132
|
+
|
|
133
|
+
```txt
|
|
134
|
+
kpi-typescript init
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| Option | Description | Type |
|
|
138
|
+
| ------------------- | ------------------- | --------- |
|
|
139
|
+
| `--help`<br>`-h` | Show help | `boolean` |
|
|
140
|
+
| `--version`<br>`-v` | Show version number | `boolean` |
|
|
141
|
+
|
|
142
|
+
#### Subcommand: `kpi-typescript lint`
|
|
143
|
+
|
|
144
|
+
Run type checking on your project. Package-scoped. In a monorepo, it will also run in all packages below the current working directory.
|
|
145
|
+
|
|
146
|
+
Usage:
|
|
147
|
+
|
|
148
|
+
```txt
|
|
149
|
+
kpi-typescript lint
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
| Option | Description | Type |
|
|
153
|
+
| ------------------- | ------------------- | --------- |
|
|
154
|
+
| `--help`<br>`-h` | Show help | `boolean` |
|
|
155
|
+
| `--version`<br>`-v` | Show version number | `boolean` |
|
|
156
|
+
|
|
157
|
+
#### Subcommand: `kpi-typescript print-config`
|
|
158
|
+
|
|
159
|
+
Print the TypeScript configuration for the project. Package-scoped. Searches up to the root of a monorepo if necessary.
|
|
160
|
+
|
|
161
|
+
Usage:
|
|
162
|
+
|
|
163
|
+
```txt
|
|
164
|
+
kpi-typescript print-config
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| Option | Description | Type |
|
|
168
|
+
| ------------------- | ------------------- | --------- |
|
|
169
|
+
| `--help`<br>`-h` | Show help | `boolean` |
|
|
170
|
+
| `--version`<br>`-v` | Show version number | `boolean` |
|
|
171
|
+
|
|
172
|
+
<!-- /cli-help -->
|
|
173
|
+
|
|
174
|
+
## Notes
|
|
175
|
+
|
|
176
|
+
### General
|
|
177
|
+
|
|
178
|
+
- [tsconfig Cheat Sheet](https://www.totaltypescript.com/tsconfig-cheat-sheet)
|
|
179
|
+
|
|
180
|
+
### Other shared tsconfig projects
|
|
181
|
+
|
|
182
|
+
- [tsconfig/bases](https://github.com/tsconfig/bases)
|
|
183
|
+
- [sindresorhus/tsconfig](https://github.com/sindresorhus/tsconfig)
|
|
184
|
+
- [total-typescript/tsconfig](https://github.com/total-typescript/tsconfig)
|
|
185
|
+
|
|
186
|
+
### Future integrations
|
|
187
|
+
|
|
188
|
+
- [Are The Types Wrong](https://github.com/arethetypeswrong/arethetypeswrong.github.io),\
|
|
189
|
+
e.g. `attw --format ascii --no-summary --profile esm-only --pack .`
|
|
190
|
+
|
|
191
|
+
<!-- license -->
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
[MIT](license.txt) © Eric Mika
|
|
196
|
+
|
|
197
|
+
<!-- /license -->
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"jsx": "react",
|
|
5
|
+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
11
|
+
"allowJs": true,
|
|
12
|
+
"checkJs": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"allowUnreachableCode": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"noErrorTruncation": true
|
|
22
|
+
}
|
|
23
|
+
}
|