Find npm packages listed in package.json that your project no longer imports, so you can safely uninstall them.
Identify exported functions that nothing in the codebase calls, marking them as safe to delete.
Surface unused-code warnings directly in VS Code while editing, using the Knip extension.
Add Knip to a CI pipeline to prevent new unused exports from being merged into the main branch.
Requires Node.js, a configuration file is recommended to tell Knip about your project's entry points and structure.
Knip is a tool for finding and removing dead code in JavaScript and TypeScript projects. It scans your codebase and reports three categories of unused items: files that are never imported anywhere, npm packages listed in package.json that your code never actually uses, and exported functions or values that nothing in the project calls. Reducing unused code improves performance, reduces the maintenance burden, and makes refactoring easier. The project offers several ways to use it. The core knip npm package is installed and run from the command line. A companion package called @knip/create-config helps generate a starter configuration file for your project. There is a VS Code extension available on the marketplace and an Open VSX Registry listing for other editors, along with a Language Server Protocol server that can surface unused-code warnings directly in any editor that supports LSP. An MCP package provides integration for AI assistant tools that support the Model Context Protocol. Full documentation is at knip.dev. A contributing guide is linked from the repository, and the project acknowledges contributions from a community of contributors listed on the documentation site. The name comes from the Dutch word for "to cut," reflecting the tool's purpose of helping you trim what your project no longer needs. The maintainer is based in the Netherlands. Knip is free and open source software licensed under the ISC license, a permissive license similar to MIT that allows use for any purpose, including commercial, with minimal requirements. The project also incorporates small portions of code from four other open source packages, all under ISC or MIT licenses.
← webpro-nl on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.