Socket
Socket
Sign inDemoInstall

knip

Package Overview
Dependencies
Maintainers
1
Versions
407
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knip - npm Package Compare versions

Comparing version 1.0.0-alpha.8 to 1.0.0-beta.0

1

dist/plugins/cypress/index.d.ts
import type { IsPluginEnabledCallback } from '../../types/plugins.js';
export declare const isEnabled: IsPluginEnabledCallback;
export declare const CONFIG_FILE_PATTERNS: never[];
export declare const ENTRY_FILE_PATTERNS: string[];
export const isEnabled = ({ dependencies }) => dependencies.has('cypress');
export const CONFIG_FILE_PATTERNS = [];
export const ENTRY_FILE_PATTERNS = [

@@ -4,0 +3,0 @@ 'cypress.config.{js,ts,mjs,cjs}',

16

dist/plugins/remark/index.js

@@ -0,10 +1,16 @@

import { load } from 'js-yaml';
import { timerify } from '../../util/performance.js';
export const isEnabled = ({ dependencies }) => dependencies.has('remark-cli');
export const CONFIG_FILE_PATTERNS = ['package.json'];
export const CONFIG_FILE_PATTERNS = [
'package.json',
'.remarkrc',
'.remarkrc.json',
'.remarkrc.{js,cjs,mjs}',
'.remarkrc.{yml,yaml}',
];
const findRemarkDependencies = async (configFilePath, { manifest }) => {
if (configFilePath.endsWith('package.json')) {
return manifest?.remarkConfig?.plugins?.map(plugin => `remark-${plugin}`) ?? [];
}
return [];
const config = configFilePath.endsWith('package.json') ? manifest.remarkConfig : await load(configFilePath);
const plugins = config?.plugins?.map(plugin => `remark-${plugin}`) ?? [];
return [...plugins];
};
export const findDependencies = timerify(findRemarkDependencies);

@@ -8,5 +8,8 @@ export const printHelp = () => {

--production Analyze only production source files (e.g. no tests, devDependencies, exported types)
--strict Consider only direct dependencies of workspaces. Not devDependencies, not ancestor workspaces.
--workspace Analyze a single workspace (default: analyze all configured workspaces)
--include Report only listed issue type(s), can be comma-separated or repeated
--exclude Exclude issue type(s) from report, can be comma-separated or repeated
--ignore Ignore files matching this glob pattern, can be repeated
--no-gitignore Don't use .gitignore
--no-progress Don't show dynamic progress updates

@@ -13,0 +16,0 @@ --no-exit-code Always exit with code zero (0)

{
"name": "knip",
"version": "1.0.0-alpha.8",
"version": "1.0.0-beta.0",
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript project",

@@ -5,0 +5,0 @@ "keywords": [

# ✂️ Knip
Knip finds **unused files, dependencies and exports** in your JavaScript and TypeScript projects. Less code leads to
improved performance, less maintenance and easier refactorings.
Knip finds **unused files, dependencies and exports** in your JavaScript and TypeScript projects. Less code and
dependencies leads to improved performance, less maintenance and easier refactorings.

@@ -10,5 +10,4 @@ ```ts

ESLint handles files in isolation, so the `export` keyword "blocks" further analysis. Unused files and dependencies will
also not be detected. You could think of Knip as going (far!) beyond the `no-unused-vars` rule of ESLint. Knip lints the
project as a whole (or parts of it).
ESLint handles files in isolation, so it does not know whether `myVar` is actually used somewhere else. Knip lints the
project as a whole, and finds unused exports, files and dependencies

@@ -20,7 +19,7 @@ It's only human to forget removing things that you no longer use. But how do you find out? Where to even start finding

- [x] Finds **unused files, dependencies and exports**.
- [x] Finds used dependencies not listed in `package.json`.
- [x] Finds duplicate exports.
- [x] Finds **unused files, dependencies and exports**
- [x] Finds used dependencies not listed in `package.json`
- [x] Finds duplicate exports
- [x] Finds unused members of classes and enums
- [x] Built-in support for monorepos (workspaces)
- [x] Built-in support for monorepos/workspaces
- [x] Growing list of [built-in plugins][1]

@@ -32,4 +31,4 @@ - [x] Checks npm scripts for used and unlisted dependencies

Knip really shines in larger projects. A little bit of configuration will pay off, I promise. A comparison with similar
tools answers the question [why another unused file/dependency/export finder?][4]
Knip shines in both small and large projects. A comparison with similar tools answers the question [why another unused
file/dependency/export finder?][4]

@@ -41,14 +40,17 @@ Knip is a fresh take on keeping your projects clean & tidy!

## Roadmap
## Migrating to v1.0.0
Please report any false positives by [opening an issue in this repo][7]. Bonus points for adding a public repository or
opening a pull request with a directory and example files in `test/fixtures`. Correctness and bug fixes have priority
over new features:
When coming from version v0.13.3 or before, here are the breaking changes:
### Upcoming Features
- The `entryFiles` and `projectFiles` options have been renamed to `entry` and `project`.
- The `--dev` argument and `dev: true` option are gone, this is now the default mode (see [production mode][7]).
- Workspaces have been moved from the root of the config to the `workspaces` key (see [workspaces][8]).
- The `--dir` argument has been renamed to `--workspace`.
- [ ] Smart default configurations and more fine-grained configuration options.
- [ ] Fix issues: remove `export` keyword, uninstall unused dependencies, delete files (like `--fix` of ESLint).
- [ ] Add more reporters and report customization options (#3).
## Issues
Please report any false positives by [opening an issue in this repo][9]. Bonus points for linking to a public repository
using Knip, or even opening a pull request with a directory and example files in `test/fixtures`. Correctness and bug
fixes have priority over performance and new features.
## Installation

@@ -66,9 +68,10 @@

{
"entryFiles": ["src/index.ts"],
"projectFiles": ["src/**/*.ts"]
"$schema": "https://unpkg.com/knip@alpha/schema.json",
"entry": ["src/index.ts"],
"project": ["src/**/*.ts"]
}
```
The `entryFiles` target the starting point(s) to resolve code dependencies. The `projectFiles` should contain all files
it should match them against, including potentially unused files.
The `entry` files target the starting point(s) to resolve code dependencies. The `project` files should contain all
files it should match them against, including potentially unused files.

@@ -79,15 +82,4 @@ Then run the checks:

This will analyze the project and output unused files, exports, types and duplicate exports.
This will analyze the project and output unused files, dependencies and exports.
## How It Works
Knip works by creating two sets of files:
1. The set of files resolved from the `entryFiles`. In other words, the files that the entry files depend upon.
2. The set of `projectFiles`.
3. The project files that are part of entry files and its dependencies will be reported as unused files (in red).
4. Then everything else (in blue) will be analyzed for unused exports and dependencies.
![How it works][8]
## Options

@@ -104,4 +96,6 @@

--workspace Analyze a single workspace (default: analyze all configured workspaces)
--include Report only listed issue type(s), can be repeated
--exclude Exclude issue type(s) from report, can be repeated
--include Report only listed issue type(s), can be comma-separated or repeated
--exclude Exclude issue type(s) from report, can be comma-separated or repeated
--ignore Ignore files matching this glob pattern, can be repeated
--no-gitignore Don't use .gitignore
--no-progress Don't show dynamic progress updates

@@ -113,2 +107,3 @@ --no-exit-code Always exit with code zero (0)

--debug Show debug output
--debug-file-filter Filter for files in debug output (regex as string)
--performance Measure running time of expensive functions and display stats table

@@ -122,58 +117,39 @@

$ knip --production
$ knip --workspace packages/client --include files
$ knip -c ./knip.js --reporter compact
$ knip --workspace packages/client --include files,dependencies
$ knip -c ./config/knip.json --reporter compact
$ knip --reporter codeowners --reporter-options '{"path":".github/CODEOWNERS"}'
$ knip --debug --debug-file-filter '(specific|particular)-module'
More info: https://github.com/webpro/knip
## Reading the report
## Screenshots
After analyzing all the files resolved from the `entryFiles` against the `projectFiles`, the report contains the
following types of issues:
Here's an example run using the default reporter:
- `files` - Unused files: did not find references to this file
- Dependencies (`package.json`)
- `dependencies` - Unused dependencies: did not find references to this dependency
- `unlisted` - Unlisted dependencies: used dependencies, but not listed in package.json (1)
- Values (JavaScript)
- `exports` - Unused exports: did not find references to this exported variable
- `nsExports` - Unused exports in namespaces: did not find direct references to this exported variable (2)
- `classMembers` - Unused class members: did not find references to this member of the exported class
- Types (TypeSscript)
- `types` - Unused types: did not find references to this exported type
- `nsTypes` - Unused types in namespaces: did not find direct references to this exported variable (2)
- `enumMembers` - Unused enum members: did not find references to this member of the exported enum
- `duplicates` - Duplicate exports: the same thing is exported more than once
<img src="./assets/screenshot-basic.png" alt="example output of dependencies" width="578">
Notes:
This example shows more output related to unused and unlisted dependencies:
1. This includes dependencies that could not be resolved. For instance, what does `unresolved/dir/module` mean?
- To target something in the (missing) `node_modules/unresolved` package?
- Target a local module that should have a relative path?
- It does not match any `paths` entry in `tsconfig.json#compilerOptions`.
2. The variable or type is not referenced directly, and has become a member of a namespace. That's why Knip is not sure
whether this export can be removed, so please look into it.
<img src="./assets/screenshot-dependencies.png" alt="example output of dependencies" width="578">
You can `--include` or `--exclude` any of the types to slice & dice the report to your needs. Alternatively, they can be
added to the configuration (e.g. `"exclude": ["dependencies"]`).
## Reading the report
## Now what?
The report contains the following types of issues:
As always, make sure to backup files or use Git before deleting files or making changes. Run tests to verify results.
- **Unused files**: did not find references to this file
- **Unused dependencies**: did not find references to this dependency
- **Unlisted or unresolved dependencies**: used dependencies, but not listed in package.json _(1)_
- **Unused exports**: did not find references to this exported variable
- **Unused exports in namespaces**: did not find direct references to this exported variable _(2)_
- **Unused exported types**: did not find references to this exported type
- **Unused exported types in namespaces**: did not find direct references to this exported variable _(2)_
- **Unused exported enum members**: did not find references to this member of the exported enum
- **Unused exported class members**: did not find references to this member of the exported class
- **Duplicate exports**: the same thing is exported more than once
- Unused files can be removed.
- Unused dependencies can be removed from `package.json`.
- Unlisted dependencies should be added to `package.json`.
- Unused exports and types: remove the `export` keyword in front of unused exports. Then you (or tools such as
TypeScript language services in VS Code and/or ESLint) can see whether the variable or type is used within the same
file. If this is not the case, it can be removed.
- Duplicate exports can be removed to export only once, make sure to import that everywhere.
You can `--include` or `--exclude` any of the types to slice & dice the report to your needs. Alternatively, they can be
added to the configuration (e.g. `"exclude": ["dependencies"]`). Knip finds issues of type `files`, `dependencies`,
`unlisted` and `duplicates` very fast. Finding unused exports requires deeper analysis (`exports`, `nsExports`,
`classMembers`, `types`, `nsTypes`, `enumMembers`).
🔁 Repeat the process to reveal new unused files and exports. Sometimes it's so liberating to remove things!
## Performance
🚀 Knip finds issues of type `files`, `dependencies`, `unlisted` and `duplicates` very fast. Finding unused exports
requires deeper analysis (`exports`, `nsExports`, `classMembers`, `types`, `nsTypes`, `enumMembers`).
Use `--include` to report only specific issue types (the following example commands do the same):

@@ -188,4 +164,26 @@

Use `--performance` to see where most of the time is spent.
_(1)_ This includes dependencies that could not be resolved. For instance, what does `unresolved/dir/module` mean?
- It might target a missing `unresolved` package in `node_modules/unresolved`.
- It might incorrectly target a local module that should have a relative path.
- It does not match any `paths` entry in `tsconfig.json#compilerOptions`.
_(2)_ The variable or type is not referenced directly, and has become a member of a namespace. That's why Knip is not
sure whether this export can be removed, so please look into it.
## Now what?
This is the fun part! Knip, knip, knip ✂️
As always, make sure to backup files or use Git before deleting files or making changes. Run tests to verify results.
- Unused files can be removed.
- Unused dependencies can be removed from `package.json`.
- Unlisted dependencies should be added to `package.json`.
- Unused exports and types: remove the `export` keyword in front of unused exports. Then you can see whether the
variable or type is used within the same file. If this is not the case, it can be removed.
- Duplicate exports can be removed so they're exported only once.
🔁 Repeat the process to reveal new unused files and exports. Sometimes it's so liberating to remove things!
## Workspaces & Monorepos

@@ -198,3 +196,3 @@

{
"ignoreFiles": "**/fixtures/**",
"ignore": "**/fixtures/**",
"ignoreBinaries": ["deno", "git"],

@@ -204,11 +202,11 @@ "ignoreWorkspaces": ["packages/ignore-me"],

"packages/*": {
"entryFiles": "{index,cli}.ts!",
"projectFiles": "**/*.ts"
"entry": "{index,cli}.ts!",
"project": "**/*.ts"
},
"packages/exception": {
"entryFiles": "something/different.js"
"entry": "something/different.js"
},
"not-a-workspace/in-package.json/but-has-package.json": {
"entryFiles": ["src/index.ts"],
"projectFiles": "src/**/*.ts"
"entry": ["src/index.ts"],
"project": "src/**/*.ts"
}

@@ -222,5 +220,9 @@ }

Extra "workspaces" not cnfigured as a workspace in the root `package.json` can be configured as well, Knip is happy to
Extra "workspaces" not configured as a workspace in the root `package.json` can be configured as well, Knip is happy to
analyze unused dependencies and exports from any directory with a `package.json`.
Here's a small output example when running Knip in a workspace:
<img src="./assets/screenshot-workspaces.png" alt="example output in workspaces" width="578">
## Plugins

@@ -230,19 +232,25 @@

- [Babel][9]
- [Capacitor][10]
- [Changesets][11]
- [Cypress][12]
- [ESLint][13]
- [Gatsby][14]
- [Jest][15]
- [Mocha][16]
- [Next.js][17]
- [Nx][18]
- [Playwright][19]
- [PostCSS][20]
- [Remark][21]
- [Remix][22]
- [Rollup][23]
- [Storybook][24]
- [Stryker][25]
- [Babel][10]
- [Capacitor][11]
- [Changesets][12]
- [commitlint][13]
- [Cypress][14]
- [ESLint][15]
- [Gatsby][16]
- [Jest][17]
- [Mocha][18]
- [Next.js][19]
- [Nx][20]
- [nyc][21]
- [Playwright][22]
- [PostCSS][23]
- [Prettier][24]
- [Remark][25]
- [Remix][26]
- [Rollup][27]
- [Sentry][28]
- [Storybook][29]
- [Stryker][30]
- [TypeScript][31]
- [Webpack][32]

@@ -255,12 +263,13 @@ Plugins are automatically activated, no need to enable anything. Each plugin is automatically enabled based on simple

- `config` - custom dependency resolvers are applied to these files
- `entryFiles` - files to include with the analysis of the rest of the source code
- `config` - custom dependency resolvers are applied to the [config files][33]
- `entry` - files to include with the analysis of the rest of the source code
Many configuration files use `require` or `import` statements to use dependencies, so they can be analyzed like the rest
of the source files. These configuration files are also `entryFiles`.
### `config`
Many plugins also include `config` files. They are parsed by custom dependency resolvers.
Plugins may include `config` files. They are parsed by custom dependency resolvers. Here are some examples to get an
idea of how they work and why they are needed:
- The `eslint` plugin tells Knip that an `"prettier"` entry in the array of plugins means that the
`eslint-plugin-prettier` dependency should be installed.
- The `eslint` plugin tells Knip that the `"prettier"` entry in the array of `plugins` means that the
`eslint-plugin-prettier` dependency should be installed. Or that the `"airbnb"` entry in `extends` requires the
`eslint-config-airbnb` dependency.
- The `storybook` plugin understands that `core.builder: 'webpack5'` in `main.js` means that the

@@ -270,5 +279,10 @@ `@storybook/builder-webpack5` and `@storybook/manager-webpack5` dependencies are required.

The only thing that a custom dependency resolver function does is return all referenced dependencies for the
configuration files it is given.
Custom dependency resolvers return all referenced dependencies for the configuration files it is given. Knip handles the
rest.
### `entry`
Other configuration files use `require` or `import` statements to use dependencies, so they can be analyzed like the
rest of the source files. These configuration files are also considered `entry` files.
## Configuration

@@ -296,19 +310,16 @@

The default mode for Knip is holistic and targets all project code. For instance test files usually import production
files. This prevents the production files or its exports from being reported as unused, while both of them can be
removed. This is why Knip has a production mode.
The default mode for Knip is holistic and targets all project code, including configuration files and tests. Test files
usually import production files. This prevents the production files or its exports from being reported as unused, while
sometimes both of them can be removed. This is why Knip has a "production mode".
To analyze only production code, add an exclamation mark behind the patterns that are meant for production and use the
`--production` flag to analyze (only) them. Here's an example:
To tell Knip what is production code, add an exclamation mark behind each `pattern!` that is meant for production and
use the `--production` flag. Here's an example:
```json
{
"entryFiles": ["build/script.js", "src/index.ts!"],
"projectFiles": ["src/**/*.ts!"]
"entry": ["src/index.ts!", "build/script.js"],
"project": ["src/**/*.ts!", "build/*.js"]
}
```
Configuration files, test files and build scripts should not be included. Knip looks for unused files, dependencies and
export values in production code only.
#### Strict

@@ -333,7 +344,11 @@

- [`json`][26]
- [`symbol`][27] (default)
- [`compact`][28]
- [`codeowners`][29]
- [`codeowners`][34]
- [`compact`][35]
- [`json`][36]
- [`symbol`][37] (default)
The `compact` reporter shows the sorted files first, and then a list of symbols:
<img src="./assets/screenshot-basic-compact.png" alt="example output of dependencies" width="578">
### Custom Reporters

@@ -358,145 +373,6 @@

The data can then be used to write issues to `stdout`, a JSON or CSV file, or sent to a service, anything really!
The data can then be used to write issues to `stdout`, a JSON or CSV file, or sent to a service.
### JSON
Find more details and ideas in [custom reporters][38].
The `json` reporter output is meant to be consumed by other tools. It reports in JSON format as an array with one object
per file like this:
```json
[
{
"file": "package.json",
"owners": ["@org/admin"],
"files": false,
"dependencies": ["jquery", "moment"],
"devDependencies": [],
"unlisted": [],
"exports": [],
"types": [],
"duplicates": []
},
{
"file": "src/Registration.tsx",
"owners": ["@org/owner"],
"files": true,
"dependencies": [],
"devDependencies": [],
"unlisted": ["react"],
"exports": ["lowercaseFirstLetter", "RegistrationBox"],
"types": ["RegistrationServices", "RegistrationAction"],
"duplicates": ["Registration", "default"]
}
]
```
The keys match the [known issue types][30].
#### Usage Ideas
Use tools like [miller][31] or [jtbl][32] to consume the JSON and render a table in the terminal.
##### Table
$ npx knip --reporter json | mlr --ijson --opprint --no-auto-flatten cat
file owners files unlisted exports types duplicates
src/Registration.tsx @org/owner true react lowercaseFirstLetter, RegistrationBox RegistrationServices, RegistrationAction Registration, default
src/ProductsList.tsx @org/team false - - ProductDetail -
##### Markdown Table
$ npx knip --reporter json | mlr --ijson --omd --no-auto-flatten cat
| file | owners | files | duplicates |
| --- | --- | --- | --- |
| src/Registration.tsx | @org/owner | true | Registration, default |
| src/ProductsList.tsx | @org/team | false | |
Include specific issue types and/or replace the `cat` command with `put` for clean output:
npx knip --include files,duplicates --reporter json | mlr --ijson --opprint --no-auto-flatten put 'for (e in $*) { if(is_array($[e])) { $[e] = joinv($[e], ", ") } }'
npx knip --reporter json | mlr --ijson --omd --no-auto-flatten put 'for (e in $*) { if(is_array($[e])) { $[e] = joinv($[e], ", ") } }'
### More Output Examples
#### Symbol (default)
The default reporter shows the sorted symbols first:
$ knip
--- UNUSED FILES (2)
src/chat/helpers.ts
src/components/SideBar.tsx
--- UNUSED DEPENDENCIES (1)
moment
--- UNLISTED DEPENDENCIES (1)
react
--- UNUSED EXPORTS (5)
lowercaseFirstLetter src/common/src/string/index.ts
RegistrationBox src/components/Registration.tsx
clamp src/css.ts
restoreSession src/services/authentication.ts
PREFIX src/services/authentication.ts
--- UNUSED TYPES (4)
enum RegistrationServices src/components/Registration/registrationMachine.ts
type RegistrationAction src/components/Registration/registrationMachine.ts
type ComponentProps src/components/Registration.tsx
interface ProductDetail src/types/Product.ts
--- DUPLICATE EXPORTS (2)
Registration, default src/components/Registration.tsx
ProductsList, default src/components/Products.tsx
#### Compact
The compact reporter shows the sorted files first, and then a list of symbols:
$ knip --reporter compact
--- UNUSED FILES (2)
src/chat/helpers.ts
src/components/SideBar.tsx
--- UNUSED DEPENDENCIES (1)
moment
--- UNLISTED DEPENDENCIES (1)
react
--- UNUSED EXPORTS (4)
src/common/src/string/index.ts: lowercaseFirstLetter
src/components/Registration.tsx: RegistrationBox
src/css.ts: clamp
src/services/authentication.ts: restoreSession, PREFIX
--- UNUSED TYPES (3)
src/components/Registration/registrationMachine.ts: RegistrationServices, RegistrationAction
src/components/Registration.tsx: ComponentProps
src/types/Product.ts: ProductDetail
--- DUPLICATE EXPORTS (2)
src/components/Registration.tsx: Registration, default
src/components/Products.tsx: ProductsList, default
#### Code Owners
The `codeowners` reporter is like `compact`, but shows the sorted code owners (according to `.github/CODEOWNERS`) first:
$ knip --reporter codeowners
--- UNUSED FILES (2)
@org/team src/chat/helpers.ts
@org/owner src/components/SideBar.tsx
--- UNUSED DEPENDENCIES (1)
@org/admin moment
--- UNLISTED DEPENDENCIES (1)
@org/owner src/components/Registration.tsx react
--- UNUSED EXPORTS (4)
@org/team src/common/src/string/index.ts: lowercaseFirstLetter
@org/owner src/components/Registration.tsx: RegistrationBox
@org/owner src/css.ts: clamp
@org/owner src/services/authentication.ts: restoreSession, PREFIX
--- UNUSED TYPES (3)
@org/owner src/components/Registration/registrationMachine.ts: RegistrationServices, RegistrationAction
@org/owner src/components/Registration.tsx: ComponentProps
@org/owner src/types/Product.ts: ProductDetail
--- DUPLICATE EXPORTS (2)
@org/owner src/components/Registration.tsx: Registration, default
@org/owner src/components/Products.tsx: ProductsList, default
The owner of `package.json` is considered the owner of unused (dev) dependencies.
Use `--reporter-options '{"path":".github/CODEOWNERS"}'` to pass another location for the code owners file.
## Really, another unused file/dependency/export finder?

@@ -506,11 +382,11 @@

Although I love the Unix philosophy, here I believe it's efficient to handle multiple concerns in a single tool. When
building a dependency graph of the project, an abstract syntax tree for each file, and traversing all of this, why not
collect the various issues in one go?
I love the Unix philosophy ("do one thing well"). But in this case I believe it's efficient to handle multiple concerns
in a single tool. When building a dependency graph of the project, an abstract syntax tree for each file, and traversing
all of this, why not collect the various issues in one go?
## Comparison
This table is a work in progress, but here's a first impression. Based on their docs (please report any mistakes):
This table is an ongoing comparison. Based on their docs (please report any mistakes):
| Feature | **knip** | [depcheck][33] | [unimported][34] | [ts-unused-exports][35] | [ts-prune][36] | [find-unused-exports][37] |
| Feature | **knip** | [depcheck][39] | [unimported][40] | [ts-unused-exports][41] | [ts-prune][42] | [find-unused-exports][43] |
| :-------------------------------- | :------: | :------------: | :--------------: | :---------------------: | :------------: | :-----------------------: |

@@ -520,3 +396,3 @@ | Unused files | ✅ | - | ✅ | - | - | - |

| Unlisted dependencies | ✅ | ✅ | ✅ | - | - | - |
| [Custom dependency resolvers][38] | ✅ | ✅ | ❌ | - | - | - |
| [Custom dependency resolvers][44] | ✅ | ✅ | ❌ | - | - | - |
| Unused exports | ✅ | - | - | ✅ | ✅ | ✅ |

@@ -530,3 +406,3 @@ | Unused class members | ✅ | - | - | - | - | - |

| Configure entry files | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
| [Support monorepos][39] | ✅ | - | - | - | - | - |
| [Support monorepos][45] | ✅ | - | - | - | - | - |
| ESLint plugin available | - | - | - | ✅ | - | - |

@@ -554,34 +430,40 @@

[6]: ./assets/cow-with-orange-scissors-van-gogh-style.webp
[7]: https://github.com/webpro/knip/issues
[8]: ./assets/how-it-works.drawio.svg
[9]: ./src/plugins/babel
[10]: ./src/plugins/capacitor
[11]: ./src/plugins/changesets
[12]: ./src/plugins/cypress
[13]: ./src/plugins/eslint
[14]: ./src/plugins/gatsby
[15]: ./src/plugins/jest
[16]: ./src/plugins/mocha
[17]: ./src/plugins/next
[18]: ./src/plugins/nx
[19]: ./src/plugins/playwright
[20]: ./src/plugins/postcss
[21]: ./src/plugins/remark
[22]: ./src/plugins/remix
[23]: ./src/plugins/rollup
[24]: ./src/plugins/storybook
[25]: ./src/plugins/stryker
[26]: #json
[27]: #symbol-default
[28]: #compact
[29]: #code-owners
[30]: #reading-the-report
[31]: https://github.com/johnkerl/miller
[32]: https://github.com/kellyjonbrazil/jtbl
[33]: https://github.com/depcheck/depcheck
[34]: https://github.com/smeijer/unimported
[35]: https://github.com/pzavolinsky/ts-unused-exports
[36]: https://github.com/nadeesha/ts-prune
[37]: https://github.com/jaydenseric/find-unused-exports
[38]: #custom-dependency-resolvers
[39]: #monorepos-1
[7]: #production-mode
[8]: #workspaces--monorepos
[9]: https://github.com/webpro/knip/issues
[10]: ./src/plugins/babel
[11]: ./src/plugins/capacitor
[12]: ./src/plugins/changesets
[13]: ./src/plugins/commitlint
[14]: ./src/plugins/cypress
[15]: ./src/plugins/eslint
[16]: ./src/plugins/gatsby
[17]: ./src/plugins/jest
[18]: ./src/plugins/mocha
[19]: ./src/plugins/next
[20]: ./src/plugins/nx
[21]: ./src/plugins/nyc
[22]: ./src/plugins/playwright
[23]: ./src/plugins/postcss
[24]: ./src/plugins/prettier
[25]: ./src/plugins/remark
[26]: ./src/plugins/remix
[27]: ./src/plugins/rollup
[28]: ./src/plugins/sentry
[29]: ./src/plugins/storybook
[30]: ./src/plugins/stryker
[31]: ./src/plugins/typescript
[32]: ./src/plugins/webpack
[33]: #config
[34]: #code-owners
[35]: #compact
[36]: #json
[37]: #symbol-default
[38]: ./docs/custom-reporters.md
[39]: https://github.com/depcheck/depcheck
[40]: https://github.com/smeijer/unimported
[41]: https://github.com/pzavolinsky/ts-unused-exports
[42]: https://github.com/nadeesha/ts-prune
[43]: https://github.com/jaydenseric/find-unused-exports
[44]: #custom-dependency-resolvers
[45]: #monorepos-1
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