@williamthorsen/tsconfig 0.5.0 → 0.6.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.
- package/.readyup/kits/default.js +40 -36
- package/.readyup/manifest.json +41 -3
- package/README.md +5 -9
- package/package.json +11 -3
package/.readyup/kits/default.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @noformat
|
|
1
|
+
/** @noformat -- @generated. Do not edit. Compiled by rdy. */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export const __readyupVersion = "0.
|
|
3
|
+
export const __readyupVersion = "0.34.0";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
// .readyup/kits/default.ts
|
|
@@ -76,7 +76,7 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
76
76
|
function findRedundantOptions(entries, baseIndex) {
|
|
77
77
|
const baseOptions = entries[baseIndex]?.compilerOptions;
|
|
78
78
|
if (baseOptions === void 0) return [];
|
|
79
|
-
const exempt =
|
|
79
|
+
const exempt = collectDependencyDeclaredKeys(entries, baseIndex);
|
|
80
80
|
const redundant = [];
|
|
81
81
|
for (const entry of entries.slice(0, baseIndex)) {
|
|
82
82
|
if (!isConsumerOwnedConfig(entry.path)) continue;
|
|
@@ -87,7 +87,7 @@ function findRedundantOptions(entries, baseIndex) {
|
|
|
87
87
|
}
|
|
88
88
|
return redundant;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function collectDependencyDeclaredKeys(entries, baseIndex) {
|
|
91
91
|
const keys = /* @__PURE__ */ new Set();
|
|
92
92
|
for (const [index, entry] of entries.entries()) {
|
|
93
93
|
if (index === baseIndex || isConsumerOwnedConfig(entry.path)) continue;
|
|
@@ -96,6 +96,11 @@ function dependencyDeclaredKeys(entries, baseIndex) {
|
|
|
96
96
|
return keys;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// src/readiness/listSearchDirs.ts
|
|
100
|
+
function listSearchDirs(workspaceDirs) {
|
|
101
|
+
return [.../* @__PURE__ */ new Set([".", ...workspaceDirs])];
|
|
102
|
+
}
|
|
103
|
+
|
|
99
104
|
// src/readiness/node-floor.ts
|
|
100
105
|
var NODE_MAJOR = /^v?(\d+)(?:[.\s]|$)/;
|
|
101
106
|
var NODE_MAJOR_CEILING = 99;
|
|
@@ -107,7 +112,7 @@ function classifyNodeEsYear(major, esYearForMajor) {
|
|
|
107
112
|
const lowestEsYear = esYearForMajor(lowestKnown);
|
|
108
113
|
return lowestEsYear === void 0 ? { kind: "unknown" } : { esYear: lowestEsYear, kind: "under" };
|
|
109
114
|
}
|
|
110
|
-
function
|
|
115
|
+
function findLowestNodeMajor(floors) {
|
|
111
116
|
const majors = floors.flatMap((floor) => {
|
|
112
117
|
const major = readNodeMajor(floor);
|
|
113
118
|
return major === void 0 ? [] : [major];
|
|
@@ -175,9 +180,6 @@ var default_default = defineRdyKit({
|
|
|
175
180
|
}
|
|
176
181
|
]
|
|
177
182
|
});
|
|
178
|
-
function adoptedTsconfigs() {
|
|
179
|
-
return classifyAdoptions().filter((adoption) => adoption.kind === "adopted");
|
|
180
|
-
}
|
|
181
183
|
function classifyAdoptions() {
|
|
182
184
|
cache.adoptions ??= findTsconfigs().map((path) => classifyTsconfig(path));
|
|
183
185
|
return cache.adoptions;
|
|
@@ -188,28 +190,14 @@ function classifyTsconfig(path) {
|
|
|
188
190
|
const classification = classifyChain(chain);
|
|
189
191
|
return classification.kind === "adopted" ? { baseIndex: classification.baseIndex, chain, kind: "adopted", path } : { kind: classification.kind, path };
|
|
190
192
|
}
|
|
191
|
-
function declaredNodeFloors() {
|
|
192
|
-
const engineFloors = tsconfigSearchDirs().flatMap((dir) => {
|
|
193
|
-
const manifest = readJsonFile(dirPath(dir, "package.json"));
|
|
194
|
-
if (manifest === void 0) return [];
|
|
195
|
-
const floor = readEnginesNodeFloor(manifest);
|
|
196
|
-
return floor.kind === "found" ? [floor.floor] : [];
|
|
197
|
-
});
|
|
198
|
-
if (engineFloors.length > 0) return engineFloors;
|
|
199
|
-
const toolVersionsFloor = readToolVersionsNode();
|
|
200
|
-
return toolVersionsFloor === void 0 ? [] : [toolVersionsFloor];
|
|
201
|
-
}
|
|
202
193
|
function dedupe(values) {
|
|
203
194
|
return [...new Set(values)];
|
|
204
195
|
}
|
|
205
|
-
function dirPath(dir, basename) {
|
|
206
|
-
return dir === "." ? basename : `${dir}/${basename}`;
|
|
207
|
-
}
|
|
208
196
|
function everyEsYearMatchesTheBase() {
|
|
209
197
|
const baseEsYear = readBaseEsYear();
|
|
210
198
|
if (baseEsYear === void 0) return true;
|
|
211
199
|
const offenders = [];
|
|
212
|
-
for (const adoption of
|
|
200
|
+
for (const adoption of listAdoptedTsconfigs()) {
|
|
213
201
|
for (const entry of adoption.chain.entries.slice(0, adoption.baseIndex)) {
|
|
214
202
|
if (!isConsumerOwnedConfig(entry.path)) continue;
|
|
215
203
|
const declared = readDeclaredEsYear(entry.compilerOptions);
|
|
@@ -226,8 +214,8 @@ function everyTsconfigAdoptsTheBase() {
|
|
|
226
214
|
const accountable = classifyAdoptions().filter((adoption) => adoption.kind !== "external-base");
|
|
227
215
|
const adopted = accountable.filter((adoption) => adoption.kind === "adopted");
|
|
228
216
|
const progress = { type: "fraction", passedCount: adopted.length, count: accountable.length };
|
|
229
|
-
const uninstalled =
|
|
230
|
-
const unadopted =
|
|
217
|
+
const uninstalled = listPathsOfKind(accountable, "uninstalled");
|
|
218
|
+
const unadopted = listPathsOfKind(accountable, "unadopted");
|
|
231
219
|
if (uninstalled.length === 0 && unadopted.length === 0) return { ok: true, progress };
|
|
232
220
|
const details = [
|
|
233
221
|
uninstalled.length > 0 ? `${PACKAGE_NAME} is named but not installed in: ${uninstalled.join(", ")}` : void 0,
|
|
@@ -236,7 +224,7 @@ function everyTsconfigAdoptsTheBase() {
|
|
|
236
224
|
return { ok: false, detail: details.join("; "), progress };
|
|
237
225
|
}
|
|
238
226
|
function findTsconfigs() {
|
|
239
|
-
return
|
|
227
|
+
return listTsconfigSearchDirs().map((dir) => resolveDirPath(dir, "tsconfig.json")).filter((path) => fileExists(path));
|
|
240
228
|
}
|
|
241
229
|
function judgeNodeFloor() {
|
|
242
230
|
const baseEsYear = readBaseEsYear();
|
|
@@ -255,12 +243,32 @@ function judgeNodeFloor() {
|
|
|
255
243
|
kind: "fail"
|
|
256
244
|
};
|
|
257
245
|
}
|
|
246
|
+
function listAdoptedTsconfigs() {
|
|
247
|
+
return classifyAdoptions().filter((adoption) => adoption.kind === "adopted");
|
|
248
|
+
}
|
|
249
|
+
function listDeclaredNodeFloors() {
|
|
250
|
+
const engineFloors = listTsconfigSearchDirs().flatMap((dir) => {
|
|
251
|
+
const manifest = readJsonFile(resolveDirPath(dir, "package.json"));
|
|
252
|
+
if (manifest === void 0) return [];
|
|
253
|
+
const floor = readEnginesNodeFloor(manifest);
|
|
254
|
+
return floor.kind === "found" ? [floor.floor] : [];
|
|
255
|
+
});
|
|
256
|
+
if (engineFloors.length > 0) return engineFloors;
|
|
257
|
+
const toolVersionsFloor = readToolVersionsNode();
|
|
258
|
+
return toolVersionsFloor === void 0 ? [] : [toolVersionsFloor];
|
|
259
|
+
}
|
|
260
|
+
function listPathsOfKind(classified, kind) {
|
|
261
|
+
return classified.filter((adoption) => adoption.kind === kind).map((adoption) => adoption.path);
|
|
262
|
+
}
|
|
263
|
+
function listTsconfigSearchDirs() {
|
|
264
|
+
return listSearchDirs(discoverWorkspaces().map((workspace) => workspace.dir));
|
|
265
|
+
}
|
|
258
266
|
function nodeFloorSupportsBaseEsYear() {
|
|
259
267
|
const verdict = judgeNodeFloor();
|
|
260
268
|
return verdict.kind === "skip" ? true : { ok: verdict.kind === "pass", detail: verdict.detail };
|
|
261
269
|
}
|
|
262
270
|
function noRedundantOptions() {
|
|
263
|
-
const offenders =
|
|
271
|
+
const offenders = listAdoptedTsconfigs().flatMap(
|
|
264
272
|
(adoption) => findRedundantOptions(adoption.chain.entries, adoption.baseIndex).map(
|
|
265
273
|
(redundant) => `${redundant.path} (${redundant.key})`
|
|
266
274
|
)
|
|
@@ -268,11 +276,8 @@ function noRedundantOptions() {
|
|
|
268
276
|
if (offenders.length === 0) return true;
|
|
269
277
|
return { ok: false, detail: `the base already supplies: ${dedupe(offenders).join(", ")}` };
|
|
270
278
|
}
|
|
271
|
-
function pathsOfKind(classified, kind) {
|
|
272
|
-
return classified.filter((adoption) => adoption.kind === kind).map((adoption) => adoption.path);
|
|
273
|
-
}
|
|
274
279
|
function readBaseEsYear() {
|
|
275
|
-
for (const adoption of
|
|
280
|
+
for (const adoption of listAdoptedTsconfigs()) {
|
|
276
281
|
const baseOptions = adoption.chain.entries[adoption.baseIndex]?.compilerOptions;
|
|
277
282
|
const esYear = baseOptions === void 0 ? void 0 : readDeclaredEsYear(baseOptions);
|
|
278
283
|
if (esYear !== void 0) return esYear;
|
|
@@ -284,9 +289,12 @@ function readChain(path) {
|
|
|
284
289
|
return cache.chains.get(path);
|
|
285
290
|
}
|
|
286
291
|
function readNodeEsYear() {
|
|
287
|
-
const major =
|
|
292
|
+
const major = findLowestNodeMajor(listDeclaredNodeFloors());
|
|
288
293
|
return major === void 0 ? void 0 : classifyNodeEsYear(major, esYearForNodeMajor);
|
|
289
294
|
}
|
|
295
|
+
function resolveDirPath(dir, basename) {
|
|
296
|
+
return dir === "." ? basename : `${dir}/${basename}`;
|
|
297
|
+
}
|
|
290
298
|
function skipUnlessBaseEsYearKnown() {
|
|
291
299
|
return readBaseEsYear() === void 0 ? NO_BASE_ES_YEAR : false;
|
|
292
300
|
}
|
|
@@ -299,10 +307,6 @@ function skipUnlessSomeTsconfigIsAccountable() {
|
|
|
299
307
|
if (classified.length === 0) return "no workspace tsconfig was found";
|
|
300
308
|
return classified.some((adoption) => adoption.kind !== "external-base") ? false : "every workspace tsconfig extends a base belonging to another package";
|
|
301
309
|
}
|
|
302
|
-
function tsconfigSearchDirs() {
|
|
303
|
-
cache.searchDirs ??= [.../* @__PURE__ */ new Set([".", ...discoverWorkspaces().map((workspace) => workspace.dir)])];
|
|
304
|
-
return cache.searchDirs;
|
|
305
|
-
}
|
|
306
310
|
export {
|
|
307
311
|
default_default as default
|
|
308
312
|
};
|
package/.readyup/manifest.json
CHANGED
|
@@ -7,12 +7,50 @@
|
|
|
7
7
|
"alignment"
|
|
8
8
|
],
|
|
9
9
|
"description": "Adoption and alignment checks for a project consuming @williamthorsen/tsconfig",
|
|
10
|
+
"esbuildVersion": "0.28.2",
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"hash": "defbbe48",
|
|
14
|
+
"kind": "module",
|
|
15
|
+
"path": "kits/default.ts"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"hash": "7e083072",
|
|
19
|
+
"kind": "module",
|
|
20
|
+
"path": "../src/readiness/base-chain.ts"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"hash": "86555b6e",
|
|
24
|
+
"kind": "module",
|
|
25
|
+
"path": "../src/readiness/classifyChain.ts"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"hash": "723d4694",
|
|
29
|
+
"kind": "module",
|
|
30
|
+
"path": "../src/readiness/es-year.ts"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"hash": "acd6ba2b",
|
|
34
|
+
"kind": "module",
|
|
35
|
+
"path": "../src/readiness/findRedundantOptions.ts"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"hash": "30178e5c",
|
|
39
|
+
"kind": "module",
|
|
40
|
+
"path": "../src/readiness/listSearchDirs.ts"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"hash": "31b0fbf5",
|
|
44
|
+
"kind": "module",
|
|
45
|
+
"path": "../src/readiness/node-floor.ts"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
10
48
|
"name": "default",
|
|
11
49
|
"path": "kits/default.js",
|
|
12
|
-
"readyupVersion": "0.
|
|
50
|
+
"readyupVersion": "0.34.0",
|
|
13
51
|
"source": "kits/default.ts",
|
|
14
|
-
"sourceHash": "
|
|
15
|
-
"targetHash": "
|
|
52
|
+
"sourceHash": "defbbe48",
|
|
53
|
+
"targetHash": "20355baf"
|
|
16
54
|
}
|
|
17
55
|
]
|
|
18
56
|
}
|
package/README.md
CHANGED
|
@@ -3,19 +3,13 @@
|
|
|
3
3
|
Shared TypeScript base config for Node-only projects. Inlines the settings of [`@tsconfig/strictest`](https://www.npmjs.com/package/@tsconfig/strictest) and adds the Node and build options it leaves out, so a consuming repo declares only what is genuinely its own.
|
|
4
4
|
|
|
5
5
|
<!-- section:release-notes -->
|
|
6
|
-
## Release notes — v0.
|
|
7
|
-
|
|
8
|
-
### 🎉 Features
|
|
9
|
-
|
|
10
|
-
- 🚨 **Breaking:** Require author, engines, and publish metadata in package.json (#162)
|
|
11
|
-
|
|
12
|
-
Adds six `package-json` rules to `@williamthorsen/eslint-config-typescript` and removes three overrides that suppressed rules the plugin's `recommended` preset supplies. Every `package.json` must now declare `author` and `engines` and carry no empty field; one that publishes must also declare `bugs`, `homepage`, `keywords`, `repository`, and `sideEffects`, and may not take a dependency on a local path. `specify-peers-locally` is the only rule the config still disables.
|
|
6
|
+
## Release notes — v0.6.1 (2026-08-27)
|
|
13
7
|
|
|
14
8
|
### 🐛 Bug fixes
|
|
15
9
|
|
|
16
|
-
-
|
|
10
|
+
- Restore the repo root to both readiness kits' search directories (#187)
|
|
17
11
|
|
|
18
|
-
Fixes an issue where the readiness
|
|
12
|
+
Fixes an issue where the readiness kits in `@williamthorsen/tsconfig` and `@williamthorsen/eslint-config-typescript` skipped the repo root in a monorepo running readyup below 0.33.0. Each kit now supplies the root itself, so the sweep is whole under any readyup version.
|
|
19
13
|
<!-- /section:release-notes -->
|
|
20
14
|
|
|
21
15
|
## Installation
|
|
@@ -104,6 +98,8 @@ export default defineRdyConfig({
|
|
|
104
98
|
});
|
|
105
99
|
```
|
|
106
100
|
|
|
101
|
+
The `readyup >=0.33.0` optional peer names the version the kit is developed and tested against. Below 0.33.0, readyup does not report the repo root among a monorepo's workspaces, so the kit supplies the root itself and sweeps every member package alongside it.
|
|
102
|
+
|
|
107
103
|
The kit walks each workspace tsconfig's `extends` chain and reports four things:
|
|
108
104
|
|
|
109
105
|
- **Adoption**: a tsconfig reaching neither this base nor a framework base. A tsconfig naming this base through a specifier that does not resolve is reported separately, as declared but not installed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@williamthorsen/tsconfig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Shared TypeScript base config for Node-only projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tsconfig",
|
|
@@ -30,8 +30,16 @@
|
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@tsconfig/strictest": "2.0.8",
|
|
33
|
-
"esbuild": "0.28.
|
|
34
|
-
"readyup": "0.
|
|
33
|
+
"esbuild": "0.28.2",
|
|
34
|
+
"readyup": "0.34.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"readyup": ">=0.33.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"readyup": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
35
43
|
},
|
|
36
44
|
"engines": {
|
|
37
45
|
"node": ">=24"
|