Skip to content

Knip!

Declutter your JavaScript & TypeScript projects

Why?

Knip finds and fixes unused files, exports and dependencies. Use it for enhanced code and dependency management.

Read the full explanation: why should I use Knip?

How?

Deep analysis from fine-grained entry points based on the actual frameworks and tooling in your (mono)repo for accurate and actionable results. Advanced features for maximum coverage:

  • Custom module resolution
  • Configuration file parsers
  • Advanced shell script parser
  • Built-in and custom compilers
  • Auto-fix most issues

Battle-tested

Thousands of projects are already using Knip!

Plugins

Knip comes with over 80 plugins for tools and frameworks like Astro, Cypress, ESLint, Jest, GitHub Actions, Next.js, Nx, Remix, Storybook, Svelte, Vite, Vitest, Webpack and many many more.

/'knɪp/

Knip means “(to) cut” and is pronounced with a hard “K” 🇳🇱

🧡 Projects using Knip

🧡 Introduction video

James Shopland has a great introduction and overview of Knip (thanks James!):

Play

🧡 Sponsors

Eternal gratitude to the companies and people that are already supporting Knip:

Please see Sponsors for the full list. Consider supporting the project too!

🧡 Contributors

Special thanks to the wonderful people who have contributed to this project:

🧡 Articles

Most recent article first:

🧡 Testimonials

Old Man Uzi@daviduzumeri.bsky.social

`knip` is the best code maintenance tool I've used in my 20 years of development, just an absolute work of art

5:33 PM · Jul 29, 2023

replies1
reposts2
likes2
bookmarks0

Tom Hicks@Hicksyfern

knip is great.

A great example of stuff just working. It detects your environment so well and its defaults are almost too good because I didn’t realise it was doing everything automatically.

3:19 AM · Jul 4, 2024

replies1
reposts2
likes12
bookmarks7

Tom Hicks@Hicksyfern

Then was like “this is how tooling should be, this has taken me an hour not a day and it’s faster and more accurate and more future proof”

Five stars ⭐️⭐️⭐️⭐️⭐️

12:20 PM · Jul 4, 2024

replies1
reposts0
likes1
bookmarks0

Jökull Solberg@jokull

Crazy useful tool. Thought it would be a nightmare to setup in my Next.js+Workers repo but it has crazy good automatic detection for code dependencies. In short, Knip creates a graph of code use and highlights dead code for you to snip (knip).

12:35 PM · Jun 18, 2024

replies1
reposts2
likes5
bookmarks0

Dominik 🔮@TkDodo

Lars is singlehandedly building the best tool to keep your code clean and your dependencies minimal. And he's so engaging and helpful. Can't imagine going back to not using knip 👏

9:55 AM · May 24, 2024

replies4
reposts4
likes69
bookmarks11

Quinn Slack@sqs

warning: do not use a tool like https://knip.dev + code search to delete a ton of unused code. It works too well.

I just did this in https://github.com/sourcegraph/cody/pull/2705, and my boss said if I end the week with net negative lines of code committed, I'm in deep trouble. undefined

1:55 AM · Jan 13, 2024

replies6
reposts2
likes28
bookmarks7

Greg Bergé@gregberge_

Ran http://knip.dev in @argos_ci, and boom 💥! Dead code detected instantly. With a good config, it can run on CI to keep projects clean. Installing this tool should be a no-brainer, like Prettier or ESLint.

Kudos, @webprolific! 👏 undefined

11:00 AM · Nov 30, 2023

replies1
reposts5
likes25
bookmarks13

Cory House@housecor

Problem:
🚫 Your project has unused files.
🚫 It has unused npm dependencies.
🚫 It has unused TypeScript exports.

But you haven't noticed, because these things are hard to spot.

Solution: knip

I just used knip to find and resolve dozens of issues.

https://t.co/QmN3sNlmbm

2:44 PM · Aug 15, 2023

replies17
reposts163
likes968
bookmarks754

Piotr Gacek 🐟@pkgacek

Knip helped me get rid of over 41k lines of code in legacy codebase 🥺🥺💕

4:51 PM · Nov 27, 2023

replies1
reposts0
likes1
bookmarks0

Gajus@kuizinas

Big fans of Knip at @Contra. Such an extremely well developed and maintained project

3:18 PM · Nov 27, 2023

replies1
reposts1
likes7
bookmarks1

Fernando@fernandoeeu_dev

I've manage to delete 6k LOC in the last 30 minutes 🫣

Great job here @webprolific 👍🏽

3:38 AM · Nov 21, 2023

replies2
reposts0
likes4
bookmarks0

Dominik 🔮@TkDodo

knip is an amazing tool. Shoutout to @webprolific for building it 🙌.

Not cleaning up correctly has a real maintenance cost. I've deleted lots of dead code - functions that were only used in tests and components that were only used in stories - all thanks to knip 🚀.

8:59 PM · Oct 16, 2023

replies1
reposts3
likes39
bookmarks11

Michael Hoffmann@Mokkapps

🛠️ Knip

👉🏻 Knip finds unused files, dependencies and exports in your JavaScript and TypeScript projects.
👉🏻 Less code and dependencies lead to improved performance, less maintenance and easier refactorings.

https://github.com/webpro-nl/knip

6:00 PM · Aug 28, 2023

replies0
reposts2
likes11
bookmarks3

Nicolas Carlo@nicoespeon

Knip is wonderful at finding out unused code/dependencies in a legacy JavaScript/TypeScript application

Recommend 💯

Here's how Josh used it to remove code bloat in Centered:

11:13 AM · Aug 22, 2023

replies1
reposts1
likes9
bookmarks0

Kailaash@BKailaash

Streamlining React projects with Knip:

Recently, I employed Knip for a project, and it worked wonders!

It efficiently resolved issues with removing
✅ Unused files,
✅ Unused npm dependencies,
✅ Unneeded TypeScript exports.

A real time-saver for maintaining a clean and efficient codebase. 🛠️ #ReactDevelopment

https://t.co/IbJH2fIzsE

5:55 AM · Aug 21, 2023

replies0
reposts1
likes4
bookmarks1

Waldek Mastykarz@waldekm

Found a bunch of unused code, -dependencies, and unnecessary exports. Had just one false positive but overall pretty good. 10/10 would recommend.

If you’ve got a JavaScript package/project use Knip and remove unnecessary code. ✂️

4:52 PM · Aug 19, 2023

replies0
reposts0
likes2
bookmarks0

Read More

ISC License © 2024 Lars Kappert