Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

knip

Package Overview
Dependencies
Maintainers
1
Versions
433
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knip

Find unused files, dependencies and exports in your TypeScript and JavaScript projects

  • 5.36.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
799K
increased by9.55%
Maintainers
1
Weekly downloads
 
Created

What is knip?

Knip is a tool for analyzing and managing unused files and dependencies in your JavaScript and TypeScript projects. It helps you keep your codebase clean and efficient by identifying and removing unnecessary code.

What are knip's main functionalities?

Identify Unused Files

This feature allows you to identify files in your project directory that are not being used. The code sample demonstrates how to use Knip to find unused files in the './src' directory.

const knip = require('knip');

knip.findUnusedFiles({
  directory: './src'
}).then(unusedFiles => {
  console.log('Unused files:', unusedFiles);
});

Identify Unused Dependencies

This feature helps you find dependencies listed in your package.json that are not being used in your project. The code sample shows how to use Knip to find unused dependencies in the current directory.

const knip = require('knip');

knip.findUnusedDependencies({
  directory: './'
}).then(unusedDependencies => {
  console.log('Unused dependencies:', unusedDependencies);
});

Remove Unused Files

This feature allows you to automatically remove files that are not being used in your project. The code sample demonstrates how to use Knip to remove unused files in the './src' directory.

const knip = require('knip');

knip.removeUnusedFiles({
  directory: './src'
}).then(() => {
  console.log('Unused files removed');
});

Remove Unused Dependencies

This feature helps you automatically remove dependencies that are not being used in your project. The code sample shows how to use Knip to remove unused dependencies in the current directory.

const knip = require('knip');

knip.removeUnusedDependencies({
  directory: './'
}).then(() => {
  console.log('Unused dependencies removed');
});

Other packages similar to knip

Keywords

FAQs

Package last updated on 11 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc