@knip/mcp 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knip/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Knip MCP Server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
30
30
|
"zod": "^4.1.11",
|
|
31
|
-
"knip": "^5.
|
|
31
|
+
"knip": "^5.82.0"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=18.18.0"
|
|
@@ -91,9 +91,9 @@ configuration in your project.
|
|
|
91
91
|
|
|
92
92
|
### 2. Unused variables
|
|
93
93
|
|
|
94
|
-
Use a tool like ESLint or Biome to find and remove unused variables
|
|
95
|
-
files. Even better, try [remove-unused-vars][3] to remove unused
|
|
96
|
-
within files.
|
|
94
|
+
Use a tool like ESLint or Biome to find and remove unused imports and variables
|
|
95
|
+
inside files. Even better, try [remove-unused-vars][3] to remove unused
|
|
96
|
+
variables within files.
|
|
97
97
|
|
|
98
98
|
This may result in more deleted code, and Knip may then find more unused code.
|
|
99
99
|
Rinse and repeat!
|
|
@@ -316,6 +316,20 @@ component are unused and will remove those.
|
|
|
316
316
|
|
|
317
317
|
Note that [`classMembers` aren't included by default][4].
|
|
318
318
|
|
|
319
|
+
### Catalog entries
|
|
320
|
+
|
|
321
|
+
Unused [catalog][5] entries are removed from `pnpm-workspace.yaml`:
|
|
322
|
+
|
|
323
|
+
```diff title="pnpm-workspace.yaml"
|
|
324
|
+
packages:
|
|
325
|
+
- 'packages/*'
|
|
326
|
+
catalog:
|
|
327
|
+
react: ^18.0.0
|
|
328
|
+
- unused-package: ^1.0.0
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Catalogs in `package.json` are supported as well.
|
|
332
|
+
|
|
319
333
|
## What's not included
|
|
320
334
|
|
|
321
335
|
Operations that auto-fix does not (yet) perform and why:
|
|
@@ -331,3 +345,4 @@ Operations that auto-fix does not (yet) perform and why:
|
|
|
331
345
|
[2]: https://github.com/JoshuaKGoldberg/formatly
|
|
332
346
|
[3]: https://github.com/webpro-nl/remove-unused-vars
|
|
333
347
|
[4]: ../guides/handling-issues.mdx#class-members
|
|
348
|
+
[5]: https://pnpm.io/catalogs
|
|
@@ -23,7 +23,10 @@ the cause of the issue with more details.
|
|
|
23
23
|
Potential workarounds:
|
|
24
24
|
|
|
25
25
|
- [Set path aliases][2] for "Cannot find module" errors
|
|
26
|
-
- Set missing environment variable(s)
|
|
26
|
+
- Set missing environment variable(s), potential solutions:
|
|
27
|
+
- Use a helper package like [dotenvx][3]
|
|
28
|
+
- `KEY=VAL knip`
|
|
29
|
+
- `node --env-file .env $(which knip)`
|
|
27
30
|
- Disable loading the file by overriding the default `config` for that plugin.
|
|
28
31
|
- Example: `vite: { config: [] }`
|
|
29
32
|
- In a monorepo, be more specific like so:
|
|
@@ -58,8 +61,8 @@ Potential workarounds:
|
|
|
58
61
|
- Rewrite the import in the configuration file to a relative import.
|
|
59
62
|
- Inject support with a module like `tsx`: `NODE_OPTIONS="--import tsx" knip`
|
|
60
63
|
- Or `tsconfig-paths`: `NODE_OPTIONS="--import tsconfig-paths/register.js" knip`
|
|
61
|
-
- Use Bun with [knip-bun][
|
|
62
|
-
- See [exceptions from config files][
|
|
64
|
+
- Use Bun with [knip-bun][4].
|
|
65
|
+
- See [exceptions from config files][5] for more potential workarounds.
|
|
63
66
|
|
|
64
67
|
## Nx Daemon
|
|
65
68
|
|
|
@@ -69,7 +72,7 @@ In Nx projects you might encounter this error:
|
|
|
69
72
|
NX Daemon process terminated and closed the connection
|
|
70
73
|
```
|
|
71
74
|
|
|
72
|
-
The solution is to [disable the Nx Daemon][
|
|
75
|
+
The solution is to [disable the Nx Daemon][6]:
|
|
73
76
|
|
|
74
77
|
```sh
|
|
75
78
|
NX_DAEMON=false knip
|
|
@@ -77,6 +80,7 @@ NX_DAEMON=false knip
|
|
|
77
80
|
|
|
78
81
|
[1]: ../guides/handling-issues.mdx
|
|
79
82
|
[2]: #path-aliases-in-config-files
|
|
80
|
-
[3]:
|
|
81
|
-
[4]: #
|
|
82
|
-
[5]:
|
|
83
|
+
[3]: https://dotenvx.com/
|
|
84
|
+
[4]: ./cli.md#knip-bun
|
|
85
|
+
[5]: #exceptions-from-config-files
|
|
86
|
+
[6]: https://nx.dev/concepts/nx-daemon#turning-it-off
|
|
@@ -4,10 +4,10 @@ title: Related Tooling
|
|
|
4
4
|
|
|
5
5
|
This is an overview of related tooling for features Knip does not support.
|
|
6
6
|
|
|
7
|
-
## Unused variables
|
|
7
|
+
## Unused imports & variables
|
|
8
8
|
|
|
9
|
-
Knip doesn't look for unused variables within a file. The focus is
|
|
10
|
-
|
|
9
|
+
Knip doesn't look for unused imports and variables within a file. The focus is
|
|
10
|
+
on exported values and types across files.
|
|
11
11
|
|
|
12
12
|
Use [ESLint][1], [Biome][2] or [oxlint][3] to find unused variables within
|
|
13
13
|
files.
|
|
@@ -68,7 +68,7 @@ to easily navigate around.
|
|
|
68
68
|
|
|
69
69
|
## How is Knip different from ESLint for finding unused exports?
|
|
70
70
|
|
|
71
|
-
While linters like ESLint can find unused
|
|
71
|
+
While linters like ESLint can find unused imports and variables within
|
|
72
72
|
individual files, Knip analyzes the entire project to determine which exports
|
|
73
73
|
are actually unused. By building [a comprehensive module graph][7], Knip
|
|
74
74
|
identifies exports that are not imported or used anywhere in the codebase. This
|