@sarj/tsconfig 0.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 +111 -0
- package/base.json +42 -0
- package/package.json +43 -0
- package/strict.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# @sarj/tsconfig
|
|
2
|
+
|
|
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`).
|
|
5
|
+
|
|
6
|
+
Strictly a superset of every flag in bulbul's `tsconfig.base.json` and `integration-client/tsconfig.json`.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i -D @sarj/tsconfig typescript
|
|
12
|
+
# or
|
|
13
|
+
yarn add -D @sarj/tsconfig typescript
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Use
|
|
17
|
+
|
|
18
|
+
`tsconfig.json` — the default for new projects:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"extends": "@sarj/tsconfig/strict.json",
|
|
23
|
+
"include": ["src/**/*"]
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For libraries that need to be less strict (e.g. mid-migration), extend the base:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"extends": "@sarj/tsconfig/base.json"
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## What's enabled
|
|
36
|
+
|
|
37
|
+
### `base.json` — modern defaults + bulbul-parity strict-safety
|
|
38
|
+
|
|
39
|
+
**Module / target (TS 6 + Node 24 LTS):**
|
|
40
|
+
|
|
41
|
+
- `target: "ES2025"` / `lib: ["ES2025"]` — Iterator helpers, `Promise.try`, Set methods, `RegExp.escape`, Float16Array
|
|
42
|
+
- `module: "NodeNext"` / `moduleResolution: "NodeNext"` — Node 24 native ESM resolution
|
|
43
|
+
- `moduleDetection: "force"` — every file is a module; no accidental global scripts
|
|
44
|
+
- `verbatimModuleSyntax: true` — `import type` required for type-only imports
|
|
45
|
+
- `isolatedModules: true` — every file is a standalone compilation unit
|
|
46
|
+
- `allowJs: false` — TS-only; no `.js` infiltration
|
|
47
|
+
- `esModuleInterop` / `allowSyntheticDefaultImports`
|
|
48
|
+
- `resolveJsonModule: true`
|
|
49
|
+
|
|
50
|
+
**Type-safety hygiene (matches bulbul base):**
|
|
51
|
+
|
|
52
|
+
- `strict: true`
|
|
53
|
+
- `noUncheckedIndexedAccess: true` — `arr[0]` is `T | undefined`
|
|
54
|
+
- `noUncheckedSideEffectImports: true` (TS 5.6+)
|
|
55
|
+
- `exactOptionalPropertyTypes: true`
|
|
56
|
+
- `noImplicitOverride: true`
|
|
57
|
+
- `noImplicitReturns: true`
|
|
58
|
+
- `noFallthroughCasesInSwitch: true`
|
|
59
|
+
- `noPropertyAccessFromIndexSignature: true` — bracket only for index signatures
|
|
60
|
+
- `noUnusedLocals: true` / `noUnusedParameters: true`
|
|
61
|
+
- `allowUnreachableCode: false` / `allowUnusedLabels: false`
|
|
62
|
+
- `useDefineForClassFields: true`
|
|
63
|
+
|
|
64
|
+
**Emit / publish:**
|
|
65
|
+
|
|
66
|
+
- `declaration: true` / `declarationMap: true` / `sourceMap: true`
|
|
67
|
+
- `newLine: "lf"` — reproducible cross-platform output
|
|
68
|
+
- `stripInternal: true` — `@internal`-tagged declarations don't ship
|
|
69
|
+
- `forceConsistentCasingInFileNames: true`
|
|
70
|
+
- `skipLibCheck: true`
|
|
71
|
+
|
|
72
|
+
**Misc:**
|
|
73
|
+
|
|
74
|
+
- `ignoreDeprecations: "6.0"` — silences TS 6.0 `baseUrl` warnings emitted by tools like tsup
|
|
75
|
+
|
|
76
|
+
### `strict.json` — extends base + the hyper-strict flags
|
|
77
|
+
|
|
78
|
+
- `isolatedDeclarations: true` (TS 5.5+) — forces explicit return types on every exported symbol; enables parallel `.d.ts` emit by `tsgo`/`swc`/`oxc`
|
|
79
|
+
- `erasableSyntaxOnly: true` (TS 5.8+) — bans non-erasable syntax (enums, namespaces with values, parameter properties, `import =`); pairs with Node 24's `--experimental-strip-types`
|
|
80
|
+
- `noErrorTruncation: true` — full type names in errors, no `...`
|
|
81
|
+
- `strictBuiltinIteratorReturn: true` (TS 5.6+) — plugs the `any` leak in built-in iterators
|
|
82
|
+
- All strict-family sub-flags explicitly listed (`alwaysStrict`, `noImplicitAny`, `noImplicitThis`, `strictBindCallApply`, `strictFunctionTypes`, `strictNullChecks`, `strictPropertyInitialization`, `useUnknownInCatchVariables`) — redundant with `strict: true` from base but pinned so future TS default flips can't loosen them
|
|
83
|
+
|
|
84
|
+
## What's NOT in the preset (and why)
|
|
85
|
+
|
|
86
|
+
These were considered and explicitly rejected — they're per-project decisions, not shared-config concerns:
|
|
87
|
+
|
|
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) |
|
|
98
|
+
|
|
99
|
+
## Versioning
|
|
100
|
+
|
|
101
|
+
Semver. Major-bump on TypeScript major releases (currently TS 6.x).
|
|
102
|
+
|
|
103
|
+
## Provenance
|
|
104
|
+
|
|
105
|
+
These configs were authored via a 10-agent hyper-strict audit comparing the draft against:
|
|
106
|
+
|
|
107
|
+
- bulbul's `tsconfig.base.json` (the Next.js + lib monorepo baseline)
|
|
108
|
+
- bulbul's `integration-client/tsconfig.json` (the published SDK strict reference)
|
|
109
|
+
- `@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
|
package/base.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2025",
|
|
5
|
+
"module": "NodeNext",
|
|
6
|
+
"moduleResolution": "NodeNext",
|
|
7
|
+
"lib": ["ES2025"],
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noUncheckedIndexedAccess": true,
|
|
12
|
+
"noUncheckedSideEffectImports": true,
|
|
13
|
+
"exactOptionalPropertyTypes": true,
|
|
14
|
+
"noImplicitOverride": true,
|
|
15
|
+
"noImplicitReturns": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"allowUnreachableCode": false,
|
|
21
|
+
"allowUnusedLabels": false,
|
|
22
|
+
"useDefineForClassFields": true,
|
|
23
|
+
|
|
24
|
+
"esModuleInterop": true,
|
|
25
|
+
"allowSyntheticDefaultImports": true,
|
|
26
|
+
"verbatimModuleSyntax": true,
|
|
27
|
+
"isolatedModules": true,
|
|
28
|
+
"resolveJsonModule": true,
|
|
29
|
+
"allowJs": false,
|
|
30
|
+
|
|
31
|
+
"skipLibCheck": true,
|
|
32
|
+
"forceConsistentCasingInFileNames": true,
|
|
33
|
+
|
|
34
|
+
"declaration": true,
|
|
35
|
+
"declarationMap": true,
|
|
36
|
+
"sourceMap": true,
|
|
37
|
+
"newLine": "lf",
|
|
38
|
+
"stripInternal": true,
|
|
39
|
+
|
|
40
|
+
"ignoreDeprecations": "6.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sarj/tsconfig",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Ultra-strict TypeScript configs for sarj-ai projects — strict.json + base.json",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"strict.json",
|
|
8
|
+
"base.json",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
"./strict.json": "./strict.json",
|
|
13
|
+
"./base.json": "./base.json"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"provenance": true
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/sarj-ai/standards.git",
|
|
22
|
+
"directory": "packages/tsconfig"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/sarj-ai/standards/tree/main/packages/tsconfig",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/sarj-ai/standards/issues"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"typescript",
|
|
30
|
+
"tsconfig",
|
|
31
|
+
"config",
|
|
32
|
+
"strict",
|
|
33
|
+
"sarj"
|
|
34
|
+
],
|
|
35
|
+
"author": "sarj-ai",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"typescript": ">=6.0.0"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=24.0.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/strict.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"isolatedDeclarations": true,
|
|
6
|
+
"erasableSyntaxOnly": true,
|
|
7
|
+
"noErrorTruncation": true,
|
|
8
|
+
"strictBuiltinIteratorReturn": true,
|
|
9
|
+
|
|
10
|
+
"alwaysStrict": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noImplicitThis": true,
|
|
13
|
+
"strictBindCallApply": true,
|
|
14
|
+
"strictFunctionTypes": true,
|
|
15
|
+
"strictNullChecks": true,
|
|
16
|
+
"strictPropertyInitialization": true,
|
|
17
|
+
"useUnknownInCatchVariables": true
|
|
18
|
+
}
|
|
19
|
+
}
|