@foxglove/tsconfig 2.0.1-trusted-publishing-test.2 → 3.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/README.md CHANGED
@@ -4,11 +4,25 @@
4
4
 
5
5
  Base tsconfig for Foxglove projects.
6
6
 
7
- To use, run `yarn add -D @foxglove/tsconfig`, then extend your `tsconfig.json` like so:
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
8
22
 
9
23
  ```json
10
24
  {
11
- "extends": "@foxglove/tsconfig/base",
25
+ "extends": "@foxglove/tsconfig/node.json",
12
26
  "include": ["./src/**/*"],
13
27
  "compilerOptions": {
14
28
  "rootDir": "./src",
@@ -17,6 +31,36 @@ To use, run `yarn add -D @foxglove/tsconfig`, then extend your `tsconfig.json` l
17
31
  }
18
32
  ```
19
33
 
34
+ > **Note:** Uses `target: "ESNext"`. For older Node.js versions, set a lower target (e.g., `"ES2022"` for Node 18).
35
+
36
+ > **Cross-platform libraries:** Use `node.json` even if your library will be used in frontend apps. Bundlers consume Node-style packages natively—just avoid Node-specific APIs like `fs` or `process`.
37
+
38
+ ### Frontend applications (Vite, Webpack, esbuild, etc)
39
+
40
+ For bundled apps that run in the browser (not published as packages):
41
+
42
+ ```json
43
+ {
44
+ "extends": "@foxglove/tsconfig/bundler.json",
45
+ "include": ["./src/**/*"]
46
+ }
47
+ ```
48
+
49
+ ### Base config
50
+
51
+ Provides strict type-checking and modern defaults, but no `module`, `moduleResolution`, or `target` settings. Use this when `node.json` and `bundler.json` don't fit your environment:
52
+
53
+ ```json
54
+ {
55
+ "extends": "@foxglove/tsconfig/base.json",
56
+ "compilerOptions": {
57
+ "target": "...",
58
+ "module": "...",
59
+ "moduleResolution": "..."
60
+ }
61
+ }
62
+ ```
63
+
20
64
  ## License
21
65
 
22
66
  [MIT License](/LICENSE.md)
package/base.json CHANGED
@@ -1,51 +1,38 @@
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
- // build es2022 modules by default
7
- "module": "es2022",
8
- "target": "es2022",
9
- "lib": ["es2022"],
10
- "moduleResolution": "node",
11
- "esModuleInterop": true,
12
- "importHelpers": true,
8
+ // Type checking
9
+ "strict": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "noImplicitOverride": true,
12
+ "noImplicitReturns": true,
13
+ "noUncheckedIndexedAccess": true,
14
+ "noUnusedLocals": true,
15
+ "noUnusedParameters": true,
13
16
 
14
- // enable JS only as needed on per-project basis
15
- "allowJs": false,
17
+ // Modules
18
+ "erasableSyntaxOnly": true,
19
+ "noUncheckedSideEffectImports": true,
20
+ "resolveJsonModule": true,
21
+ "rewriteRelativeImportExtensions": true,
22
+ "verbatimModuleSyntax": true,
16
23
 
17
- // required to support esbuild, babel, and similar transpilers
24
+ // Interop
25
+ "forceConsistentCasingInFileNames": true,
18
26
  "isolatedModules": true,
19
27
 
20
- // disable composite/incremental builds by default to prevent .tsbuildinfo files from being
21
- // accidentally included in package archives
22
- "composite": false,
23
- "incremental": false,
24
-
25
- // produce consistent output across all platforms
26
- "newLine": "lf",
27
-
28
- // allow typed JSON imports
29
- "resolveJsonModule": true,
30
-
31
- // produce .js.map, .d.ts and .d.ts.map files when emit is enabled
32
- "noEmit": false,
28
+ // Emit
33
29
  "declaration": true,
34
30
  "declarationMap": true,
31
+ "isolatedDeclarations": true,
32
+ "newLine": "lf",
35
33
  "sourceMap": true,
36
34
 
37
- // recommended for faster compilation
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
35
+ // Performance
36
+ "skipLibCheck": true
50
37
  }
51
38
  }
package/bundler.json ADDED
@@ -0,0 +1,13 @@
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
+ "target": "ESNext",
11
+ "lib": ["ESNext", "DOM", "DOM.AsyncIterable", "DOM.Iterable"]
12
+ }
13
+ }
package/node.json ADDED
@@ -0,0 +1,12 @@
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
+ "target": "ESNext"
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxglove/tsconfig",
3
- "version": "2.0.1-trusted-publishing-test.2",
3
+ "version": "3.0.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",