@sarj/tsconfig 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -27
  3. package/base.json +1 -3
  4. package/package.json +4 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sarj-ai
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 CHANGED
@@ -1,16 +1,19 @@
1
1
  # @sarj/tsconfig
2
2
 
3
3
  Hyper-modern, maximally-strict TypeScript configs for sarj-ai projects.
4
- Audited against bulbul's production tsconfigs + community presets (`@tsconfig/strictest`, `@total-typescript/tsconfig`, `sindresorhus/tsconfig`).
4
+ Covers every type-safety flag in bulbul's `tsconfig.base.json` and `integration-client/tsconfig.json`. Per-project flags (`composite`, `noEmit`, `outDir`, `jsx`, `types`) and bundler-specific module resolution are intentionally omitted — see [What's NOT in the preset](#whats-not-in-the-preset-and-why) below.
5
5
 
6
- Strictly a superset of every flag in bulbul's `tsconfig.base.json` and `integration-client/tsconfig.json`.
6
+ ## Requires
7
+
8
+ - **TypeScript ≥ 6.0** — the configs use `target: "ES2025"`, `lib: ["ES2025"]`, `isolatedDeclarations`, `erasableSyntaxOnly`, and `strictBuiltinIteratorReturn`, all of which need TS 5.5+ at minimum and ES2025 needs TS 6.
7
9
 
8
10
  ## Install
9
11
 
10
12
  ```bash
11
- npm i -D @sarj/tsconfig typescript
12
- # or
13
- yarn add -D @sarj/tsconfig typescript
13
+ npm i -D @sarj/tsconfig typescript@^6
14
+ pnpm add -D @sarj/tsconfig typescript@^6
15
+ yarn add -D @sarj/tsconfig typescript@^6
16
+ bun add -d @sarj/tsconfig typescript@^6
14
17
  ```
15
18
 
16
19
  ## Use
@@ -39,7 +42,7 @@ For libraries that need to be less strict (e.g. mid-migration), extend the base:
39
42
  **Module / target (TS 6 + Node 24 LTS):**
40
43
 
41
44
  - `target: "ES2025"` / `lib: ["ES2025"]` — Iterator helpers, `Promise.try`, Set methods, `RegExp.escape`, Float16Array
42
- - `module: "NodeNext"` / `moduleResolution: "NodeNext"` — Node 24 native ESM resolution
45
+ - `module: "NodeNext"` / `moduleResolution: "NodeNext"` — Node 24 native ESM resolution. **Override to `"preserve"` / `"bundler"` for Next.js / Vite / Vitest / esbuild consumers** (see rejection table)
43
46
  - `moduleDetection: "force"` — every file is a module; no accidental global scripts
44
47
  - `verbatimModuleSyntax: true` — `import type` required for type-only imports
45
48
  - `isolatedModules: true` — every file is a standalone compilation unit
@@ -69,10 +72,6 @@ For libraries that need to be less strict (e.g. mid-migration), extend the base:
69
72
  - `forceConsistentCasingInFileNames: true`
70
73
  - `skipLibCheck: true`
71
74
 
72
- **Misc:**
73
-
74
- - `ignoreDeprecations: "6.0"` — silences TS 6.0 `baseUrl` warnings emitted by tools like tsup
75
-
76
75
  ### `strict.json` — extends base + the hyper-strict flags
77
76
 
78
77
  - `isolatedDeclarations: true` (TS 5.5+) — forces explicit return types on every exported symbol; enables parallel `.d.ts` emit by `tsgo`/`swc`/`oxc`
@@ -85,27 +84,45 @@ For libraries that need to be less strict (e.g. mid-migration), extend the base:
85
84
 
86
85
  These were considered and explicitly rejected — they're per-project decisions, not shared-config concerns:
87
86
 
88
- | Flag | Why not in @sarj/tsconfig |
89
- |------|---------------------------|
90
- | `composite` / `incremental` | Per-project; depends on whether you use project references |
91
- | `noEmit` | App-vs-lib; apps want `true`, libs want `false` |
92
- | `outDir` / `rootDir` / `paths` / `include` / `exclude` | Per-project layout |
93
- | `jsx` | Framework-specific (`preserve` for Next, `react-jsx` for plain React) |
94
- | `DOM` / `DOM.Iterable` in `lib` | Base is Node-safe; browser packages add DOM in their own tsconfig |
95
- | `types` / `typeRoots` | Forces every consumer to enumerate ambient types — high friction |
96
- | `noEmitOnError` | Breaks dev/editor partial-emit workflows; gate via separate `tsc --noEmit` in CI |
97
- | `rewriteRelativeImportExtensions` / `allowImportingTsExtensions` | Per-runtime decision (depends on whether you run `.ts` directly) |
87
+ | Flag | Why not in @sarj/tsconfig | What to set in your own tsconfig |
88
+ |------|---------------------------|----------------------------------|
89
+ | `composite` / `incremental` | Per-project; depends on whether you use project references | Add to your tsconfig if you use `tsc -b` |
90
+ | `noEmit` | App-vs-lib; apps want `true`, libs want `false` | `true` for Next.js / Vite apps; omit for libs |
91
+ | `outDir` / `rootDir` / `paths` | Per-project layout | Set per package |
92
+ | `jsx` | Framework-specific | `"preserve"` for Next.js; `"react-jsx"` for plain React |
93
+ | `DOM` / `DOM.Iterable` / `DOM.AsyncIterable` in `lib` | Base is Node-safe; browser packages add DOM in their own tsconfig. **`lib` is a REPLACE field, not merge — you must include `ES2025` too.** | `"lib": ["ES2025", "DOM", "DOM.Iterable", "DOM.AsyncIterable"]` |
94
+ | `types` / `typeRoots` | Forces every consumer to enumerate ambient types — high friction | Add `["node", "vitest/globals"]` etc. per project |
95
+ | Bundler module resolution | NodeNext is correct for libraries; Next.js / Vite / esbuild prefer bundler | `"module": "preserve", "moduleResolution": "bundler"` |
96
+ | `noEmitOnError` | Breaks dev/editor partial-emit workflows; gate via separate `tsc --noEmit` in CI | — |
97
+ | `rewriteRelativeImportExtensions` / `allowImportingTsExtensions` | Per-runtime decision (depends on whether you run `.ts` directly) | Set if using `tsx` / Bun / Deno |
98
+
99
+ ## Migration notes
100
+
101
+ Adopting `strict.json` on a brownfield codebase typically surfaces hundreds of errors. The three flags that produce the bulk:
102
+
103
+ - **`isolatedDeclarations`** (TS9007) — every exported function, class, and `const` needs an explicit return type. A multi-day sweep. Run `tsc --noEmit --isolatedDeclarations` first to see the scope.
104
+ - **`erasableSyntaxOnly`** — bans `enum`, `namespace { ... value ... }`, parameter properties (`constructor(private x: T)`), `import =`. Convert enums to `as const` literal unions; rewrite parameter properties as explicit field assignment.
105
+ - **`exactOptionalPropertyTypes`** — `{ x?: T }` no longer accepts `{ x: undefined }`. Either tighten the call sites to omit the key, or widen the type to `{ x?: T | undefined }`.
106
+
107
+ To opt out of a single flag from your tsconfig, just set it to `false` (it overrides the extended preset):
108
+
109
+ ```json
110
+ {
111
+ "extends": "@sarj/tsconfig/strict.json",
112
+ "compilerOptions": {
113
+ "isolatedDeclarations": false
114
+ }
115
+ }
116
+ ```
98
117
 
99
118
  ## Versioning
100
119
 
101
- Semver. Major-bump on TypeScript major releases (currently TS 6.x).
120
+ Semver. Major-bump on TypeScript major releases (currently TS 6.x). The package ships with sigstore provenance (npm-attested).
102
121
 
103
- ## Provenance
122
+ ## Influences
104
123
 
105
- These configs were authored via a 10-agent hyper-strict audit comparing the draft against:
124
+ These configs were authored by comparing against:
106
125
 
107
- - bulbul's `tsconfig.base.json` (the Next.js + lib monorepo baseline)
108
- - bulbul's `integration-client/tsconfig.json` (the published SDK strict reference)
126
+ - bulbul's `tsconfig.base.json` (Next.js + lib monorepo baseline) and `integration-client/tsconfig.json` (published SDK)
109
127
  - `@tsconfig/strictest`, `@total-typescript/tsconfig`, `sindresorhus/tsconfig`, `@swan-io/tsconfig`, `vercel/style-guide`
110
- - TypeScript handbook strict-mode reference
111
- - Every strict-related flag introduced from TS 5.0 → 6.0
128
+ - TypeScript handbook strict-mode reference and the full TS 5.0 → 6.0 changelog
package/base.json CHANGED
@@ -35,8 +35,6 @@
35
35
  "declarationMap": true,
36
36
  "sourceMap": true,
37
37
  "newLine": "lf",
38
- "stripInternal": true,
39
-
40
- "ignoreDeprecations": "6.0"
38
+ "stripInternal": true
41
39
  }
42
40
  }
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@sarj/tsconfig",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Ultra-strict TypeScript configs for sarj-ai projects — strict.json + base.json",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "strict.json",
8
8
  "base.json",
9
+ "LICENSE",
9
10
  "README.md"
10
11
  ],
11
12
  "exports": {
12
13
  "./strict.json": "./strict.json",
13
- "./base.json": "./base.json"
14
+ "./base.json": "./base.json",
15
+ "./package.json": "./package.json"
14
16
  },
15
17
  "publishConfig": {
16
18
  "access": "public",
@@ -36,8 +38,5 @@
36
38
  "license": "MIT",
37
39
  "peerDependencies": {
38
40
  "typescript": ">=6.0.0"
39
- },
40
- "engines": {
41
- "node": ">=24.0.0"
42
41
  }
43
42
  }