@tractorbeam/typescript-config 0.3.0 → 0.5.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 +36 -17
- package/browser.json +20 -0
- package/bundler.json +20 -0
- package/cloudflare-workers.json +11 -10
- package/effect.json +6 -0
- package/node-bundler.json +20 -0
- package/node.json +1 -7
- package/package.json +30 -16
- package/presets.ts +25 -0
- package/vitest.d.ts +1 -0
- package/vitest.json +4 -0
- package/react.json +0 -23
- package/vite.json +0 -11
package/README.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# @tractorbeam/typescript-config
|
|
2
2
|
|
|
3
|
-
Shared `tsconfig` presets for Tractorbeam projects.
|
|
3
|
+
Shared `tsconfig` presets for Tractorbeam projects. A package's `tsconfig.json` extends one base preset, adds any add-ons, and lists only the files it checks:
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"extends": [
|
|
8
|
+
"@tractorbeam/typescript-config/cloudflare-workers",
|
|
9
|
+
"@tractorbeam/typescript-config/effect",
|
|
10
|
+
"@tractorbeam/typescript-config/vitest"
|
|
11
|
+
],
|
|
12
|
+
"include": ["src", "tests", "vitest.config.ts"]
|
|
13
|
+
}
|
|
14
|
+
```
|
|
4
15
|
|
|
5
16
|
## Install
|
|
6
17
|
|
|
@@ -8,23 +19,31 @@ Shared `tsconfig` presets for Tractorbeam projects.
|
|
|
8
19
|
pnpm add -D @tractorbeam/typescript-config
|
|
9
20
|
```
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
Install the packages a preset names in `types`, such as `@types/node`, too.
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
## Base presets
|
|
14
25
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
Extend exactly one.
|
|
27
|
+
|
|
28
|
+
The four bundler presets type-check code that a bundler or a type-stripping runner resolves. They emit nothing, preserve import syntax, allow `.ts` extensions in imports, and report unused locals and parameters. They share one `lib`, ES2023 with the DOM library for web-standard APIs such as `fetch` and `URL`, and differ only in the ambient `types` each environment needs:
|
|
29
|
+
|
|
30
|
+
| Preset | For | `types` |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `bundler` | Runtime-neutral libraries | none |
|
|
33
|
+
| `browser` | Browser code built with Vite, with its `vite.config.ts` | `node`, `vite/client` |
|
|
34
|
+
| `node-bundler` | Node code that a bundler builds | `node` |
|
|
35
|
+
| `cloudflare-workers` | Cloudflare Workers with `nodejs_compat` | `@cloudflare/workers-types`, `node` |
|
|
36
|
+
|
|
37
|
+
The other bases keep their own conventions:
|
|
38
|
+
|
|
39
|
+
- `node` and `node22`: Node code that `tsc` resolves with `nodenext`.
|
|
40
|
+
- `next`: Next.js.
|
|
41
|
+
- `tanstack-start`: TanStack Start.
|
|
42
|
+
|
|
43
|
+
## Add-ons
|
|
20
44
|
|
|
21
|
-
|
|
45
|
+
Add-ons go after the base in `extends` and set nothing a base sets, so they combine freely:
|
|
22
46
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- `@tractorbeam/typescript-config/react.json`
|
|
27
|
-
- `@tractorbeam/typescript-config/next.json`
|
|
28
|
-
- `@tractorbeam/typescript-config/tanstack-start.json`
|
|
29
|
-
- `@tractorbeam/typescript-config/vite.json`
|
|
30
|
-
- `@tractorbeam/typescript-config/cloudflare-workers.json`
|
|
47
|
+
- `effect`: the Effect language service, with its diagnostics off.
|
|
48
|
+
- `vitest`: `import.meta.vitest` for in-source tests. It loads the types from a file, because a later preset's `types` would replace the base's instead of adding to them. Install `vitest` alongside it.
|
|
49
|
+
- `strictest`: the strictest checking flags.
|
package/browser.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["es2023", "esnext.disposable", "dom", "dom.iterable"],
|
|
5
|
+
"types": ["node", "vite/client"],
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"module": "preserve",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"skipLibCheck": true
|
|
19
|
+
}
|
|
20
|
+
}
|
package/bundler.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["es2023", "esnext.disposable", "dom", "dom.iterable"],
|
|
5
|
+
"types": [],
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"module": "preserve",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"skipLibCheck": true
|
|
19
|
+
}
|
|
20
|
+
}
|
package/cloudflare-workers.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"lib": ["es2023", "esnext.disposable", "dom", "dom.iterable"],
|
|
5
|
+
"types": ["@cloudflare/workers-types", "node"],
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"module": "preserve",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
6
9
|
"jsx": "react-jsx",
|
|
7
|
-
"
|
|
8
|
-
"moduleResolution": "Bundler",
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"allowJs": true,
|
|
11
|
-
"checkJs": false,
|
|
10
|
+
"strict": true,
|
|
12
11
|
"noEmit": true,
|
|
13
12
|
"isolatedModules": true,
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
17
18
|
"skipLibCheck": true
|
|
18
19
|
}
|
|
19
20
|
}
|
package/effect.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["es2023", "esnext.disposable", "dom", "dom.iterable"],
|
|
5
|
+
"types": ["node"],
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"module": "preserve",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"skipLibCheck": true
|
|
19
|
+
}
|
|
20
|
+
}
|
package/node.json
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"lib": [
|
|
5
|
-
"es2024",
|
|
6
|
-
"ESNext.Array",
|
|
7
|
-
"ESNext.Collection",
|
|
8
|
-
"ESNext.Iterator",
|
|
9
|
-
"ESNext.Promise"
|
|
10
|
-
],
|
|
4
|
+
"lib": ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator", "ESNext.Promise"],
|
|
11
5
|
"module": "nodenext",
|
|
12
6
|
"target": "es2024",
|
|
13
7
|
"strict": true,
|
package/package.json
CHANGED
|
@@ -1,46 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tractorbeam/typescript-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Shared tsconfig presets for Tractorbeam projects",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"cloudflare-workers",
|
|
7
|
+
"effect",
|
|
8
|
+
"nextjs",
|
|
9
|
+
"tanstack",
|
|
6
10
|
"tractorbeam",
|
|
7
11
|
"tractorbeamai",
|
|
8
|
-
"typescript",
|
|
9
12
|
"tsconfig",
|
|
10
13
|
"tsconfig-bases",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"vite",
|
|
14
|
-
"tanstack"
|
|
14
|
+
"typescript",
|
|
15
|
+
"vitest"
|
|
15
16
|
],
|
|
16
17
|
"homepage": "https://github.com/tractorbeamai/reusables/tree/main/packages/typescript-config#readme",
|
|
17
18
|
"bugs": {
|
|
18
19
|
"url": "https://github.com/tractorbeamai/reusables/issues"
|
|
19
20
|
},
|
|
21
|
+
"license": "MIT",
|
|
20
22
|
"repository": {
|
|
21
23
|
"type": "git",
|
|
22
24
|
"url": "git+https://github.com/tractorbeamai/reusables.git",
|
|
23
25
|
"directory": "packages/typescript-config"
|
|
24
26
|
},
|
|
25
|
-
"
|
|
27
|
+
"files": [
|
|
28
|
+
"*.json",
|
|
29
|
+
"*.ts",
|
|
30
|
+
"package.json",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
26
33
|
"type": "module",
|
|
27
34
|
"exports": {
|
|
35
|
+
"./bundler": "./bundler.json",
|
|
36
|
+
"./browser": "./browser.json",
|
|
37
|
+
"./node-bundler": "./node-bundler.json",
|
|
38
|
+
"./cloudflare-workers": "./cloudflare-workers.json",
|
|
28
39
|
"./node": "./node.json",
|
|
29
40
|
"./node22": "./node22.json",
|
|
30
|
-
"./strictest": "./strictest.json",
|
|
31
|
-
"./react": "./react.json",
|
|
32
41
|
"./next": "./next.json",
|
|
33
42
|
"./tanstack-start": "./tanstack-start.json",
|
|
34
|
-
"./
|
|
35
|
-
"./
|
|
43
|
+
"./effect": "./effect.json",
|
|
44
|
+
"./vitest": "./vitest.json",
|
|
45
|
+
"./strictest": "./strictest.json",
|
|
46
|
+
"./presets": "./presets.ts"
|
|
36
47
|
},
|
|
37
|
-
"files": [
|
|
38
|
-
"*.json",
|
|
39
|
-
"package.json",
|
|
40
|
-
"README.md"
|
|
41
|
-
],
|
|
42
48
|
"publishConfig": {
|
|
43
49
|
"access": "public",
|
|
44
50
|
"provenance": true
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"vitest": "*"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"vitest": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
45
59
|
}
|
|
46
60
|
}
|
package/presets.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import browser from "./browser.json" with { type: "json" };
|
|
2
|
+
import bundler from "./bundler.json" with { type: "json" };
|
|
3
|
+
import cloudflareWorkers from "./cloudflare-workers.json" with { type: "json" };
|
|
4
|
+
import effect from "./effect.json" with { type: "json" };
|
|
5
|
+
import next from "./next.json" with { type: "json" };
|
|
6
|
+
import node from "./node.json" with { type: "json" };
|
|
7
|
+
import nodeBundler from "./node-bundler.json" with { type: "json" };
|
|
8
|
+
import node22 from "./node22.json" with { type: "json" };
|
|
9
|
+
import strictest from "./strictest.json" with { type: "json" };
|
|
10
|
+
import tanstackStart from "./tanstack-start.json" with { type: "json" };
|
|
11
|
+
import vitest from "./vitest.json" with { type: "json" };
|
|
12
|
+
|
|
13
|
+
export const presets = {
|
|
14
|
+
browser,
|
|
15
|
+
bundler,
|
|
16
|
+
"cloudflare-workers": cloudflareWorkers,
|
|
17
|
+
effect,
|
|
18
|
+
next,
|
|
19
|
+
node,
|
|
20
|
+
"node-bundler": nodeBundler,
|
|
21
|
+
node22,
|
|
22
|
+
strictest,
|
|
23
|
+
"tanstack-start": tanstackStart,
|
|
24
|
+
vitest,
|
|
25
|
+
};
|
package/vitest.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vitest/importMeta" />
|
package/vitest.json
ADDED
package/react.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
-
"target": "ES2022",
|
|
6
|
-
"useDefineForClassFields": true,
|
|
7
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
8
|
-
"module": "ESNext",
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
"moduleDetection": "force",
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"jsx": "react-jsx",
|
|
16
|
-
"strict": true,
|
|
17
|
-
"noUnusedLocals": true,
|
|
18
|
-
"noUnusedParameters": true,
|
|
19
|
-
"erasableSyntaxOnly": true,
|
|
20
|
-
"noFallthroughCasesInSwitch": true,
|
|
21
|
-
"noUncheckedSideEffectImports": true
|
|
22
|
-
}
|
|
23
|
-
}
|
package/vite.json
DELETED