Socket
Socket
Sign inDemoInstall

knip

Package Overview
Dependencies
22
Maintainers
1
Versions
382
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

knip


Version published
Weekly downloads
346K
decreased by-15.42%
Maintainers
1
Created
Weekly downloads
 

Package description

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

Readme

Source

✂️ 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.

The documentation is available at knip.dev.

This package is part of the Knip monorepo.

Contributors

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

Contributors

Keywords

FAQs

Last updated on 20 Dec 2023

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc