knip icon indicating copy to clipboard operation
knip copied to clipboard

📘 Example of knip.config.ts?

Open jameshfisher opened this issue 10 months ago • 2 comments

Link

https://knip.dev/overview/configuration

Description of the issue

I read at https://knip.dev/overview/configuration:

By default, Knip will look for a configuration file with the following names: ... knip.config.ts

But the page doesn't give any example of what that file should look like, or where to find the types of things that it should export. Is there an example somewhere?

jameshfisher avatar Jan 25 '25 12:01 jameshfisher

I'm now wondering whether the docs are correct; when running the tool I see:

pnpm knip --help
  -c, --config [file]      Configuration file path (default: [.]knip.json[c], knip.js, knip.ts or package.json#knip)

pnpm knip --version
5.43.3

No mention of knip.config.ts

jameshfisher avatar Jan 25 '25 13:01 jameshfisher

You're right, the path is currently very cumbersome: https://knip.dev/overview/configuration#configuration-options → https://knip.dev/reference/configuration#typescript → https://knip.dev/reference/dynamic-configuration

I'll fix that up soon (or feel free to open a PR!)

webpro avatar Jan 25 '25 13:01 webpro

:rocket: This issue has been resolved in v5.46.1. See Release 5.46.1 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

webpro avatar Mar 25 '25 20:03 webpro