From cbaed8fabc3232c91cb213b992a4bd24193f2f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 23 Sep 2026 14:55:27 +0000 Subject: [PATCH] :bug: Stop knip reporting the source entry Listing scripts/*.ts in knip's `entry` replaced its default entry detection, which derives the public entry from package.json `exports`. Adding the CLI scripts therefore dropped the library entry, so knip resolved the package through dist/index.js and flagged the unreferenced src/index.ts as unused. Name the source entry alongside the scripts. Record the rationale in development/tooling.md. --- development/tooling.md | 22 ++++++++++++++++++++++ knip.json | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/development/tooling.md b/development/tooling.md index 91bb8b7..ffc2ab8 100644 --- a/development/tooling.md +++ b/development/tooling.md @@ -196,6 +196,28 @@ joining the oxfmt-superseded rules already off. are part of the public API. - The narrower scope keeps the signal high without config-file boilerplate. +### `knip` lists `src/index.ts` as an entry + +#### Decision (2026-09) + +`knip.json` declares `"entry": ["src/index.ts", "scripts/*.ts"]`. + +#### Why + +- Supplying `entry` **replaces** knip's default entry detection, which otherwise + derives the public entry from `package.json` `exports`. Adding `scripts/*.ts` + there therefore dropped the library entry, so knip resolved the package through + its `dist/index.js` output and reported the unreferenced source entry file + `src/index.ts` as an unused file. +- Naming the source entry restores the link between the public API and the + source graph without pointing knip at build output. + +#### Rejected + +- `paths` mapping `dist/index.*` back to `src/index.ts`: more config to model a + relation the explicit entry states directly, and it would break whenever the + build layout changes. + ### `maintain:outdated` ignores `@types/node` #### Decision (2026-09) diff --git a/knip.json b/knip.json index 19b899b..2b1590a 100644 --- a/knip.json +++ b/knip.json @@ -1,5 +1,5 @@ { "$schema": "./node_modules/knip/schema.json", - "entry": ["scripts/*.ts"], + "entry": ["src/index.ts", "scripts/*.ts"], "ignoreDependencies": ["@runwisp/pubv"] }