From 5025fa3870ef7b0549c7c506b973b63d16db2ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 28 Sep 2026 21:54:45 +0000 Subject: [PATCH] :wrench: Drop the redundant knip entry pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit knip derives the public entry from package.json `exports` and resolves it to src/index.ts itself, so naming the file in `entry` is redundant: maintain:knip reported it as a configuration hint, and the scan is now silent. Verified the barrel is still treated as the entry — the scope is clean with and without dist/, and with src/index.test.ts removed. Supersedes the workaround recorded in development/tooling.md, which silenced an unused-file report for the barrel that the current entry derivation no longer produces. Rewrite the section to state the behaviour and keep the rejected `paths` mapping. --- development/tooling.md | 23 ++++++++++++----------- knip.json | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/development/tooling.md b/development/tooling.md index ffc2ab8..7aff9bd 100644 --- a/development/tooling.md +++ b/development/tooling.md @@ -196,27 +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 +### `knip` does not list the library entry #### Decision (2026-09) -`knip.json` declares `"entry": ["src/index.ts", "scripts/*.ts"]`. +`knip.json` declares `"entry": ["scripts/*.ts"]`; the library entry +`src/index.ts` is not listed. #### 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. +- knip derives the public entry from `package.json` `exports` and resolves it to + `src/index.ts` itself, so naming the file is a redundant pattern and + `maintain:knip` reports it as a configuration hint. +- Listing `scripts/*.ts` does not switch that derivation off: the scope stays + clean with or without `dist/`, and with the barrel's own test removed. #### Rejected +- `"src/index.ts"` in `entry`: it silenced an `unused files` report for the + barrel, which the derivation above no longer produces; keeping it only adds a + hint. - `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. + relation knip already resolves. ### `maintain:outdated` ignores `@types/node` diff --git a/knip.json b/knip.json index 2b1590a..19b899b 100644 --- a/knip.json +++ b/knip.json @@ -1,5 +1,5 @@ { "$schema": "./node_modules/knip/schema.json", - "entry": ["src/index.ts", "scripts/*.ts"], + "entry": ["scripts/*.ts"], "ignoreDependencies": ["@runwisp/pubv"] }