@zayne-labs/tsconfig 0.0.6
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 +76 -0
- package/bundler/tsconfig.dom.json +36 -0
- package/bundler/tsconfig.next.json +40 -0
- package/bundler/tsconfig.no-dom.json +36 -0
- package/bundler/tsconfig.vite.json +39 -0
- package/package.json +33 -0
- package/tsc/dom/tsconfig.app.json +36 -0
- package/tsc/dom/tsconfig.lib.json +39 -0
- package/tsc/no-dom/tsconfig.app.json +36 -0
- package/tsc/no-dom/tsconfig.lib.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# `@zayne-labs/tsconfig`
|
|
2
|
+
|
|
3
|
+
This package helps set proper presets for most projects. Inspired by Matt Pocock's [TSConfig Cheat Sheet](https://www.totaltypescript.com/tsconfig-cheat-sheet).
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. Install:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Npm
|
|
11
|
+
npm install --save-dev @zayne-labs/tsconfig
|
|
12
|
+
|
|
13
|
+
# Pnpm
|
|
14
|
+
pnpm add -D @zayne-labs/tsconfig
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. Choose which `tsconfig.json` you need from the [list](#list-of-tsconfigs) below.
|
|
18
|
+
|
|
19
|
+
3. Add it to your `tsconfig.json`:
|
|
20
|
+
|
|
21
|
+
```jsonc
|
|
22
|
+
{
|
|
23
|
+
// When building an app that runs in the DOM with an external bundler
|
|
24
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/app",
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## List of TSConfigs
|
|
29
|
+
|
|
30
|
+
### Are You Using `tsc` To Turn Your `.ts` Files Into `.js` Files?
|
|
31
|
+
|
|
32
|
+
#### Yes
|
|
33
|
+
|
|
34
|
+
If yes, use this selection of configs:
|
|
35
|
+
|
|
36
|
+
```jsonc
|
|
37
|
+
{
|
|
38
|
+
// For code that runs in the DOM:
|
|
39
|
+
"extends": "@zayne-labs/tsconfig/tsc/dom/app", // For an app
|
|
40
|
+
"extends": "@zayne-labs/tsconfig/tsc/dom/library", // For a library
|
|
41
|
+
|
|
42
|
+
// For code that doesn't run in the DOM (for instance, in Node.js):
|
|
43
|
+
"extends": "@zayne-labs/tsconfig/tsc/no-dom/app", // For an app
|
|
44
|
+
"extends": "@zayne-labs/tsconfig/tsc/no-dom/library", // For a library
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### No
|
|
49
|
+
|
|
50
|
+
If no, you're probably using an external bundler.
|
|
51
|
+
|
|
52
|
+
```jsonc
|
|
53
|
+
{
|
|
54
|
+
// For code that runs in the DOM:
|
|
55
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/app", // For an app
|
|
56
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/library", // For a library
|
|
57
|
+
|
|
58
|
+
// For code that doesn't run in the DOM (for instance, in Node.js):
|
|
59
|
+
"extends": "@zayne-labs/tsconfig/bundler/no-dom/app", // For an app
|
|
60
|
+
"extends": "@zayne-labs/tsconfig/bundler/no-dom/library", // For a library
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Framework-Specific Options
|
|
65
|
+
|
|
66
|
+
The following are currently supported framework-specific options, will add more if needed in future:
|
|
67
|
+
|
|
68
|
+
```jsonc
|
|
69
|
+
{
|
|
70
|
+
// For a vite app
|
|
71
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/vite",
|
|
72
|
+
|
|
73
|
+
// For a nextjs app
|
|
74
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/next",
|
|
75
|
+
}
|
|
76
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"useDefineForClassFields": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* Bundler Mode: */
|
|
28
|
+
"module": "Preserve",
|
|
29
|
+
"target": "ESNext",
|
|
30
|
+
"noEmit": true,
|
|
31
|
+
"jsx": "preserve",
|
|
32
|
+
|
|
33
|
+
/* If your code runs in the DOM: */
|
|
34
|
+
"lib": ["ESNext", "DOM", "DOM.Iterable"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"useDefineForClassFields": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"verbatimModuleSyntax": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* Bundler mode: */
|
|
28
|
+
"module": "Preserve",
|
|
29
|
+
"target": "ESNext",
|
|
30
|
+
"noEmit": true,
|
|
31
|
+
"jsx": "preserve",
|
|
32
|
+
|
|
33
|
+
/* NextJs Bundler mode: */
|
|
34
|
+
"plugins": [{ "name": "next" }],
|
|
35
|
+
"incremental": true,
|
|
36
|
+
|
|
37
|
+
/* If your code runs in the DOM: */
|
|
38
|
+
"lib": ["ESNext", "DOM", "DOM.Iterable"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"useDefineForClassFields": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* If NOT transpiling with TypeScript: */
|
|
28
|
+
"module": "Preserve",
|
|
29
|
+
"target": "ESNext",
|
|
30
|
+
"noEmit": true,
|
|
31
|
+
"jsx": "preserve",
|
|
32
|
+
|
|
33
|
+
/* If your code doesn't run in the DOM: */
|
|
34
|
+
"lib": ["ESNext"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"useDefineForClassFields": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"verbatimModuleSyntax": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* Bundler mode: */
|
|
28
|
+
"module": "Preserve",
|
|
29
|
+
"target": "ESNext",
|
|
30
|
+
"noEmit": true,
|
|
31
|
+
"jsx": "preserve",
|
|
32
|
+
|
|
33
|
+
/* Vite Bundler mode: */
|
|
34
|
+
"types": ["vite/client"],
|
|
35
|
+
|
|
36
|
+
/* If your code runs in the DOM: */
|
|
37
|
+
"lib": ["ESNext", "DOM", "DOM.Iterable"]
|
|
38
|
+
}
|
|
39
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zayne-labs/tsconfig",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"description": "A collection of TypeScript configurations for various projects, based on Total TypeScript's TSConfig Cheat Sheet, with a few additions.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/ryan-zayne/tsconfig.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/ryan-zayne/tsconfig#readme",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "Ryan Zayne",
|
|
12
|
+
"exports": {
|
|
13
|
+
"./tsc": "./tsc/dom/tsconfig.app.json",
|
|
14
|
+
"./tsc/dom": "./tsc/dom/tsconfig.app.json",
|
|
15
|
+
"./tsc/dom/app": "./tsc/dom/tsconfig.app.json",
|
|
16
|
+
"./tsc/dom/library": "./tsc/dom/tsconfig.lib.json",
|
|
17
|
+
"./tsc/no-dom": "./tsc/no-dom/tsconfig.app.json",
|
|
18
|
+
"./tsc/no-dom/app": "./tsc/no-dom/tsconfig.app.json",
|
|
19
|
+
"./tsc/no-dom/library": "./tsc/no-dom/tsconfig.lib.json",
|
|
20
|
+
"./bundler": "./bundler/tsconfig.dom.json",
|
|
21
|
+
"./bundler/dom": "./bundler/tsconfig.dom.json",
|
|
22
|
+
"./bundler/dom/app": "./bundler/tsconfig.dom.json",
|
|
23
|
+
"./bundler/dom/library": "./bundler/tsconfig.dom.json",
|
|
24
|
+
"./bundler/no-dom": "./bundler/tsconfig.no-dom.json",
|
|
25
|
+
"./bundler/no-dom/app": "./bundler/tsconfig.no-dom.json",
|
|
26
|
+
"./bundler/no-dom/library": "./bundler/tsconfig.no-dom.json",
|
|
27
|
+
"./bundler/vite": "./bundler/tsconfig.vite.json",
|
|
28
|
+
"./bundler/next": "./bundler/tsconfig.next.json"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@changesets/cli": "^2.27.5"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"useDefineForClassFields": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* If transpiling with TypeScript: */
|
|
28
|
+
"module": "NodeNext",
|
|
29
|
+
"sourceMap": true,
|
|
30
|
+
"target": "ES2022",
|
|
31
|
+
"outDir": "dist",
|
|
32
|
+
|
|
33
|
+
/* If your code runs in the DOM: */
|
|
34
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"useDefineForClassFields": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* If transpiling with TypeScript: */
|
|
28
|
+
"module": "NodeNext",
|
|
29
|
+
"sourceMap": true,
|
|
30
|
+
"target": "ES2022",
|
|
31
|
+
"outDir": "dist",
|
|
32
|
+
|
|
33
|
+
/* If you're building for a library: */
|
|
34
|
+
"declaration": true,
|
|
35
|
+
|
|
36
|
+
/* If your code runs in the DOM: */
|
|
37
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"useDefineForClassFields": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* If transpiling with TypeScript: */
|
|
28
|
+
"module": "NodeNext",
|
|
29
|
+
"sourceMap": true,
|
|
30
|
+
"target": "ES2022",
|
|
31
|
+
"outDir": "dist",
|
|
32
|
+
|
|
33
|
+
/* If your code doesn't run in the DOM: */
|
|
34
|
+
"lib": ["ES2022"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"useDefineForClassFields": true,
|
|
11
|
+
|
|
12
|
+
/* Don't allow importing JavaScript files by default, to avoid mistake "any" (burnt me before): */
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
|
|
15
|
+
/* Linting: */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowUnreachableCode": false,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noErrorTruncation": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
|
|
27
|
+
/* If transpiling with TypeScript: */
|
|
28
|
+
"module": "NodeNext",
|
|
29
|
+
"sourceMap": true,
|
|
30
|
+
"target": "ES2022",
|
|
31
|
+
"outDir": "dist",
|
|
32
|
+
|
|
33
|
+
/* If you're building for a library: */
|
|
34
|
+
"declaration": true,
|
|
35
|
+
|
|
36
|
+
/* If your code doesn't run in the DOM: */
|
|
37
|
+
"lib": ["ES2022"]
|
|
38
|
+
}
|
|
39
|
+
}
|