@foxglove/tsconfig 2.0.1-trusted-publishing-test.2 → 3.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/README.md +51 -2
- package/base.json +26 -36
- package/bundler.json +11 -0
- package/node.json +11 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -4,11 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
Base tsconfig for Foxglove projects.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- TypeScript v5.8+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
yarn add -D @foxglove/tsconfig
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Choose the config that matches your environment:
|
|
20
|
+
|
|
21
|
+
### Node.js applications and libraries
|
|
22
|
+
|
|
23
|
+
Uses `module: "NodeNext"` which enforces Node.js ESM rules, where imports must include explicit file extensions (e.g., `import { foo } from "./bar.ts"`).
|
|
8
24
|
|
|
9
25
|
```json
|
|
10
26
|
{
|
|
11
|
-
"extends": "@foxglove/tsconfig/
|
|
27
|
+
"extends": "@foxglove/tsconfig/node.json",
|
|
12
28
|
"include": ["./src/**/*"],
|
|
13
29
|
"compilerOptions": {
|
|
14
30
|
"rootDir": "./src",
|
|
@@ -17,6 +33,39 @@ To use, run `yarn add -D @foxglove/tsconfig`, then extend your `tsconfig.json` l
|
|
|
17
33
|
}
|
|
18
34
|
```
|
|
19
35
|
|
|
36
|
+
> **Note:** Uses `target: "ESNext"`. For older Node.js versions, set a lower target (e.g., `"ES2022"` for Node 18).
|
|
37
|
+
|
|
38
|
+
> **Cross-platform libraries:** Use `node.json` even if your library will be used in bundled apps. Bundlers consume Node-style packages natively, just remember to avoid Node-specific APIs like `fs` or `process`.
|
|
39
|
+
|
|
40
|
+
### Bundled applications (Vite, Webpack, esbuild, etc)
|
|
41
|
+
|
|
42
|
+
Uses `module: "Preserve"` which allows extensionless imports (e.g., `import { foo } from "./bar"`, where the bundler handles resolution.
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"extends": "@foxglove/tsconfig/bundler.json",
|
|
47
|
+
"include": ["./src/**/*"],
|
|
48
|
+
"compilerOptions": {
|
|
49
|
+
"noEmit": true,
|
|
50
|
+
"lib": ["ESNext", "DOM"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Base config
|
|
56
|
+
|
|
57
|
+
Provides strict type-checking and modern defaults, but no `module` or `moduleResolution` settings. Use this when `node.json` and `bundler.json` don't fit your environment:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"extends": "@foxglove/tsconfig/base.json",
|
|
62
|
+
"compilerOptions": {
|
|
63
|
+
"module": "...",
|
|
64
|
+
"moduleResolution": "..."
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
20
69
|
## License
|
|
21
70
|
|
|
22
71
|
[MIT License](/LICENSE.md)
|
package/base.json
CHANGED
|
@@ -1,51 +1,41 @@
|
|
|
1
1
|
// -*- jsonc -*-
|
|
2
2
|
// Base TypeScript configuration
|
|
3
|
+
// You typically shouldn't extend from this file directly
|
|
4
|
+
// See `node.json` and `bundler.json` for environment-specific settings
|
|
3
5
|
{
|
|
4
6
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
5
7
|
"compilerOptions": {
|
|
6
|
-
//
|
|
7
|
-
"
|
|
8
|
-
"target": "es2022",
|
|
9
|
-
"lib": ["es2022"],
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"importHelpers": true,
|
|
8
|
+
// Language
|
|
9
|
+
"target": "ESNext",
|
|
13
10
|
|
|
14
|
-
//
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"composite": false,
|
|
23
|
-
"incremental": false,
|
|
24
|
-
|
|
25
|
-
// produce consistent output across all platforms
|
|
26
|
-
"newLine": "lf",
|
|
11
|
+
// Type checking
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noFallthroughCasesInSwitch": true,
|
|
14
|
+
"noImplicitOverride": true,
|
|
15
|
+
"noImplicitReturns": true,
|
|
16
|
+
"noUncheckedIndexedAccess": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
27
19
|
|
|
28
|
-
//
|
|
20
|
+
// Modules
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true,
|
|
29
23
|
"resolveJsonModule": true,
|
|
24
|
+
"rewriteRelativeImportExtensions": true,
|
|
25
|
+
"verbatimModuleSyntax": true,
|
|
30
26
|
|
|
31
|
-
//
|
|
32
|
-
"
|
|
27
|
+
// Interop
|
|
28
|
+
"forceConsistentCasingInFileNames": true,
|
|
29
|
+
"isolatedModules": true,
|
|
30
|
+
|
|
31
|
+
// Emit
|
|
33
32
|
"declaration": true,
|
|
34
33
|
"declarationMap": true,
|
|
34
|
+
"isolatedDeclarations": true,
|
|
35
|
+
"newLine": "lf",
|
|
35
36
|
"sourceMap": true,
|
|
36
37
|
|
|
37
|
-
//
|
|
38
|
-
"skipLibCheck": true
|
|
39
|
-
|
|
40
|
-
// be as strict as possible, but no stricter
|
|
41
|
-
"strict": true,
|
|
42
|
-
"noFallthroughCasesInSwitch": true,
|
|
43
|
-
"noImplicitAny": true,
|
|
44
|
-
"noImplicitReturns": true,
|
|
45
|
-
"noUncheckedIndexedAccess": true,
|
|
46
|
-
"noUnusedLocals": true,
|
|
47
|
-
"noUnusedParameters": true,
|
|
48
|
-
"noImplicitOverride": true,
|
|
49
|
-
"forceConsistentCasingInFileNames": true
|
|
38
|
+
// Performance
|
|
39
|
+
"skipLibCheck": true
|
|
50
40
|
}
|
|
51
41
|
}
|
package/bundler.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// -*- jsonc -*-
|
|
2
|
+
// TypeScript configuration for frontend/bundled applications (Webpack, esbuild, etc)
|
|
3
|
+
{
|
|
4
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
5
|
+
"extends": "./base.json",
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
// Bundler handles module resolution
|
|
8
|
+
"module": "Preserve",
|
|
9
|
+
"moduleResolution": "Bundler"
|
|
10
|
+
}
|
|
11
|
+
}
|
package/node.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// -*- jsonc -*-
|
|
2
|
+
// TypeScript configuration for Node.js applications and libraries
|
|
3
|
+
{
|
|
4
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
5
|
+
"extends": "./base.json",
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
// Node.js ESM
|
|
8
|
+
"module": "NodeNext",
|
|
9
|
+
"moduleResolution": "NodeNext"
|
|
10
|
+
}
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxglove/tsconfig",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Base TypeScript configuration for Foxglove projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
"url": "https://foxglove.dev/"
|
|
15
15
|
},
|
|
16
16
|
"packageManager": "yarn@4.12.0",
|
|
17
|
+
"type": "module",
|
|
17
18
|
"files": [
|
|
18
|
-
"base.json"
|
|
19
|
+
"base.json",
|
|
20
|
+
"node.json",
|
|
21
|
+
"bundler.json"
|
|
19
22
|
],
|
|
20
23
|
"scripts": {
|
|
21
|
-
"clean": "rm -rf dist",
|
|
22
|
-
"build": "yarn clean && tsc --project base.json --outDir dist",
|
|
23
24
|
"fmt": "prettier --write .",
|
|
24
25
|
"fmt:check": "prettier --check .",
|
|
25
26
|
"lint": "eslint --fix .",
|
|
26
|
-
"lint:check": "eslint ."
|
|
27
|
+
"lint:check": "eslint .",
|
|
28
|
+
"test": "tsc -p test/node.tsconfig.json && tsc -p test/bundler.tsconfig.json"
|
|
27
29
|
},
|
|
28
30
|
"devDependencies": {
|
|
29
31
|
"@foxglove/eslint-plugin": "2.1.0",
|