@benhigham/tsconfig 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.md +21 -0
- package/README.md +138 -0
- package/package.json +63 -0
- package/src/astro.json +7 -0
- package/src/base.json +37 -0
- package/src/browser.json +10 -0
- package/src/next.json +7 -0
- package/src/react-app.json +14 -0
- package/src/react-library.json +7 -0
- package/src/vite.json +11 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Benjamin Higham
|
|
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
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# @benhigham/tsconfig
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@benhigham/tsconfig)
|
|
4
|
+
[](https://www.npmjs.com/package/@benhigham/tsconfig)
|
|
5
|
+
[](LICENSE.md)
|
|
6
|
+
|
|
7
|
+
My personal [TypeScript configurations](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) designed to provide consistent, strict, and production-ready settings across different project types. These opinionated configs balance type safety with developer experience, helping you avoid common pitfalls while maintaining compatibility with modern frameworks and libraries.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Ready-to-use TypeScript configurations:
|
|
12
|
+
- `@benhigham/tsconfig`: Base configuration for TypeScript projects
|
|
13
|
+
- `@benhigham/tsconfig/browser`: Configuration optimized for browser environments
|
|
14
|
+
- `@benhigham/tsconfig/astro`: Configuration for Astro framework projects
|
|
15
|
+
- `@benhigham/tsconfig/next`: Configuration for Next.js projects
|
|
16
|
+
- `@benhigham/tsconfig/react-app`: Configuration for React applications
|
|
17
|
+
- `@benhigham/tsconfig/react-library`: Configuration for React libraries
|
|
18
|
+
- `@benhigham/tsconfig/vite`: Configuration for Vite-based projects
|
|
19
|
+
- Sensible defaults to ensure type safety and consistent code quality
|
|
20
|
+
- Regularly updated to support the latest TypeScript features
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# npm
|
|
26
|
+
npm install --save-dev @benhigham/tsconfig
|
|
27
|
+
|
|
28
|
+
# yarn
|
|
29
|
+
yarn add --dev @benhigham/tsconfig
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add --save-dev @benhigham/tsconfig
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Basic Usage
|
|
38
|
+
|
|
39
|
+
Use in `tsconfig.json` by extending the desired configuration:
|
|
40
|
+
|
|
41
|
+
```jsonc
|
|
42
|
+
{
|
|
43
|
+
"extends": "@benhigham/tsconfig",
|
|
44
|
+
"compilerOptions": {
|
|
45
|
+
"outDir": "dist",
|
|
46
|
+
// your overrides here
|
|
47
|
+
},
|
|
48
|
+
"include": ["src"],
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Configuration Examples
|
|
53
|
+
|
|
54
|
+
#### Base Configuration
|
|
55
|
+
|
|
56
|
+
```jsonc
|
|
57
|
+
{
|
|
58
|
+
"extends": "@benhigham/tsconfig",
|
|
59
|
+
"compilerOptions": {
|
|
60
|
+
"outDir": "dist",
|
|
61
|
+
},
|
|
62
|
+
"include": ["src"],
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### Browser Projects
|
|
67
|
+
|
|
68
|
+
```jsonc
|
|
69
|
+
{
|
|
70
|
+
"extends": "@benhigham/tsconfig/browser",
|
|
71
|
+
"compilerOptions": {
|
|
72
|
+
"outDir": "dist",
|
|
73
|
+
},
|
|
74
|
+
"include": ["src"],
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Astro Projects
|
|
79
|
+
|
|
80
|
+
```jsonc
|
|
81
|
+
{
|
|
82
|
+
"extends": "@benhigham/tsconfig/astro",
|
|
83
|
+
"include": ["src", ".astro/types.d.ts"],
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Next.js Projects
|
|
88
|
+
|
|
89
|
+
```jsonc
|
|
90
|
+
{
|
|
91
|
+
"extends": "@benhigham/tsconfig/next",
|
|
92
|
+
"include": ["src", "next-env.d.ts"],
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### React Applications
|
|
97
|
+
|
|
98
|
+
```jsonc
|
|
99
|
+
{
|
|
100
|
+
"extends": "@benhigham/tsconfig/react-app",
|
|
101
|
+
"compilerOptions": {
|
|
102
|
+
"outDir": "dist",
|
|
103
|
+
},
|
|
104
|
+
"include": ["src"],
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### React Libraries
|
|
109
|
+
|
|
110
|
+
```jsonc
|
|
111
|
+
{
|
|
112
|
+
"extends": "@benhigham/tsconfig/react-library",
|
|
113
|
+
"compilerOptions": {
|
|
114
|
+
"outDir": "dist",
|
|
115
|
+
},
|
|
116
|
+
"include": ["src"],
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Vite Projects
|
|
121
|
+
|
|
122
|
+
```jsonc
|
|
123
|
+
{
|
|
124
|
+
"extends": "@benhigham/tsconfig/vite",
|
|
125
|
+
"compilerOptions": {
|
|
126
|
+
"types": ["vite/client"],
|
|
127
|
+
},
|
|
128
|
+
"include": ["src"],
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Requirements
|
|
133
|
+
|
|
134
|
+
- TypeScript 5.5.x or higher
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@benhigham/tsconfig",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "My personal TypeScript configurations.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/benhigham/tsconfig#readme",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/benhigham/tsconfig/issues/new"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/benhigham/tsconfig.git"
|
|
13
|
+
},
|
|
14
|
+
"funding": "https://github.com/sponsors/benhigham",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Ben Higham",
|
|
17
|
+
"url": "https://benhigham.com"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./src/base.json",
|
|
22
|
+
"./astro.json": "./src/astro.json",
|
|
23
|
+
"./browser.json": "./src/browser.json",
|
|
24
|
+
"./next.json": "./src/next.json",
|
|
25
|
+
"./react-app.json": "./src/react-app.json",
|
|
26
|
+
"./react-library.json": "./src/react-library.json",
|
|
27
|
+
"./vite.json": "./src/vite.json"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"src"
|
|
35
|
+
],
|
|
36
|
+
"keywords": [
|
|
37
|
+
"tsconfig",
|
|
38
|
+
"typescript",
|
|
39
|
+
"ts",
|
|
40
|
+
"config",
|
|
41
|
+
"configuration"
|
|
42
|
+
],
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@benhigham/commitlint-config": "^0.1.0",
|
|
45
|
+
"@benhigham/prettier-config": "^0.1.0",
|
|
46
|
+
"@changesets/changelog-github": "^0.5.1",
|
|
47
|
+
"@changesets/cli": "^2.28.1",
|
|
48
|
+
"@commitlint/cli": "^19.8.0",
|
|
49
|
+
"lefthook": "^1.11.6",
|
|
50
|
+
"prettier": "^3.5.3"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"typescript": ">=5.5"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"format": "prettier --write .",
|
|
57
|
+
"format:check": "prettier --check .",
|
|
58
|
+
"changeset": "changeset",
|
|
59
|
+
"changeset:status": "changeset status",
|
|
60
|
+
"version": "changeset version",
|
|
61
|
+
"release": "changeset publish"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/astro.json
ADDED
package/src/base.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
6
|
+
"moduleDetection": "force",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"lib": ["ES2023"],
|
|
11
|
+
"target": "ES2022",
|
|
12
|
+
"composite": false,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"incremental": false,
|
|
16
|
+
"newLine": "lf",
|
|
17
|
+
"stripInternal": true,
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noEmitOnError": true,
|
|
20
|
+
"noImplicitReturns": true,
|
|
21
|
+
"noImplicitOverride": true,
|
|
22
|
+
"noUnusedLocals": true,
|
|
23
|
+
"noUnusedParameters": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
27
|
+
"noUncheckedSideEffectImports": true,
|
|
28
|
+
"preserveWatchOutput": true,
|
|
29
|
+
"useDefineForClassFields": true,
|
|
30
|
+
"forceConsistentCasingInFileNames": true,
|
|
31
|
+
"strictNullChecks": true,
|
|
32
|
+
"inlineSources": false,
|
|
33
|
+
"removeComments": true,
|
|
34
|
+
"sourceMap": true,
|
|
35
|
+
"skipLibCheck": true
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/browser.json
ADDED
package/src/next.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./browser.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"allowImportingTsExtensions": true,
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"declarationMap": false,
|
|
10
|
+
"incremental": true,
|
|
11
|
+
"jsx": "preserve",
|
|
12
|
+
"noEmit": true
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/vite.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./react-app.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"lib": ["DOM", "DOM.Iterable", "ES2020"],
|
|
6
|
+
"target": "ES2020",
|
|
7
|
+
"composite": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"jsx": "react-jsx"
|
|
10
|
+
}
|
|
11
|
+
}
|