Skip to content



Knip has good defaults and aims for “zero config”. But sometimes Knip will need some help to not report incorrect things.

Here’s a simplified version of the default configuration:

"entry": ["index.{js,ts}", "src/index.{js,ts}"],
"project": ["**/*.{js,ts}"]

Entry files are the starting point for Knip to find more source files and external dependencies. The resulting set of used files is matched against the set of project files to determine which files are unused.


This is where Knip looks for a configuration file:

  • knip.json
  • knip.jsonc
  • .knip.json
  • .knip.jsonc
  • knip.ts
  • knip.js
  • knip.config.ts
  • knip.config.js
  • "knip" property in package.json

Use --config path/to/knip.json for a different file path.


Maybe your project structure does not match the default entry and project files. Here’s an example custom configuration to include .js files in the scripts folder:

"$schema": "",
"entry": ["src/index.ts", "scripts/{build,create}.js"],
"project": ["src/**/*.ts", "scripts/**/*.js"]

If you override the entry file patterns, you may also want to override project file patterns. The set of project files is used to determine what files are unused.

The values you set override the default values, they are not merged.

Knip looks in many places for entry files. Learn more about this in the next page about entry files.

What’s next?

The best way to understand Knip and what it can do for you is to read the pages in the “Understanding Knip” sections, starting with entry files.

Want to learn more about some of the main features?

Having troubles configuring Knip?

This website can be searched using the search bar at the top (Ctrl+/ or Ctrl+K)

ISC License © 2024 Lars Kappert