@knip/mcp 0.0.4 → 0.0.6
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/docs/docs/blog/brief-history.md +30 -0
- package/docs/docs/blog/for-editors-and-agents.md +127 -0
- package/docs/docs/blog/knip-v3.mdx +88 -0
- package/docs/docs/blog/knip-v4.mdx +149 -0
- package/docs/docs/blog/knip-v5.mdx +190 -0
- package/docs/docs/blog/migration-to-v1.md +65 -0
- package/docs/docs/blog/release-notes-v2.md +46 -0
- package/docs/docs/blog/slim-down-to-speed-up.md +269 -0
- package/docs/docs/blog/state-of-knip.md +191 -0
- package/docs/docs/blog/two-years.mdx +107 -0
- package/docs/docs/explanations/comparison-and-migration.md +129 -0
- package/docs/docs/explanations/entry-files.md +70 -0
- package/docs/docs/explanations/plugins.md +319 -0
- package/docs/docs/explanations/why-use-knip.md +128 -0
- package/docs/docs/features/auto-fix.mdx +333 -0
- package/docs/docs/features/compilers.md +172 -0
- package/docs/docs/features/integrated-monorepos.md +61 -0
- package/docs/docs/features/monorepos-and-workspaces.md +134 -0
- package/docs/docs/features/production-mode.md +95 -0
- package/docs/docs/features/reporters.md +302 -0
- package/docs/docs/features/rules-and-filters.md +102 -0
- package/docs/docs/features/script-parser.md +156 -0
- package/docs/docs/features/source-mapping.md +100 -0
- package/docs/docs/guides/configuring-project-files.md +205 -0
- package/docs/docs/guides/contributing.md +24 -0
- package/docs/docs/guides/handling-issues.mdx +646 -0
- package/docs/docs/guides/issue-reproduction.md +94 -0
- package/docs/docs/guides/namespace-imports.md +125 -0
- package/docs/docs/guides/performance.md +97 -0
- package/docs/docs/guides/troubleshooting.md +136 -0
- package/docs/docs/guides/using-knip-in-ci.md +54 -0
- package/docs/docs/guides/working-with-commonjs.md +72 -0
- package/docs/docs/index.mdx +160 -0
- package/docs/docs/overview/configuration.md +104 -0
- package/docs/docs/overview/features.md +66 -0
- package/docs/docs/overview/getting-started.mdx +195 -0
- package/docs/docs/overview/screenshots-videos.md +42 -0
- package/docs/docs/playground.mdx +38 -0
- package/docs/docs/reference/cli.md +485 -0
- package/docs/docs/reference/configuration.md +413 -0
- package/docs/docs/reference/dynamic-configuration.mdx +72 -0
- package/docs/docs/reference/faq.md +441 -0
- package/docs/docs/reference/issue-types.md +43 -0
- package/docs/docs/reference/jsdoc-tsdoc-tags.md +122 -0
- package/docs/docs/reference/known-issues.md +64 -0
- package/docs/docs/reference/plugins/.gitkeep +0 -0
- package/docs/docs/reference/plugins.md +238 -0
- package/docs/docs/reference/related-tooling.md +46 -0
- package/docs/docs/sponsors.mdx +65 -0
- package/docs/docs/typescript/unused-dependencies.md +86 -0
- package/docs/docs/typescript/unused-exports.md +87 -0
- package/docs/docs/writing-a-plugin/argument-parsing.md +202 -0
- package/docs/docs/writing-a-plugin/index.md +376 -0
- package/docs/docs/writing-a-plugin/inputs.md +162 -0
- package/package.json +5 -3
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Plugins (114)
|
|
3
|
+
tableOfContents: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
:::section{.columns.min200}
|
|
7
|
+
|
|
8
|
+
- [Angular][1]
|
|
9
|
+
- [Astro][2]
|
|
10
|
+
- [Ava][3]
|
|
11
|
+
- [Babel][4]
|
|
12
|
+
- [Biome][5]
|
|
13
|
+
- [bumpp][6]
|
|
14
|
+
- [Bun][7]
|
|
15
|
+
- [c8][8]
|
|
16
|
+
- [Capacitor][9]
|
|
17
|
+
- [Changelogen][10]
|
|
18
|
+
- [Changelogithub][11]
|
|
19
|
+
- [Changesets][12]
|
|
20
|
+
- [Commitizen][13]
|
|
21
|
+
- [commitlint][14]
|
|
22
|
+
- [Convex][15]
|
|
23
|
+
- [create-typescript-app][16]
|
|
24
|
+
- [CSpell][17]
|
|
25
|
+
- [Cucumber][18]
|
|
26
|
+
- [Cypress][19]
|
|
27
|
+
- [dependency-cruiser][20]
|
|
28
|
+
- [Docusaurus][21]
|
|
29
|
+
- [dotenv][22]
|
|
30
|
+
- [Drizzle][23]
|
|
31
|
+
- [Eleventy][24]
|
|
32
|
+
- [ESLint][25]
|
|
33
|
+
- [Expo][26]
|
|
34
|
+
- [Gatsby][27]
|
|
35
|
+
- [GitHub Action][28]
|
|
36
|
+
- [GitHub Actions][29]
|
|
37
|
+
- [glob][30]
|
|
38
|
+
- [GraphQL Codegen][31]
|
|
39
|
+
- [Hardhat][32]
|
|
40
|
+
- [husky][33]
|
|
41
|
+
- [i18next Parser][34]
|
|
42
|
+
- [Jest][35]
|
|
43
|
+
- [Karma][36]
|
|
44
|
+
- [Ladle][37]
|
|
45
|
+
- [Lefthook][38]
|
|
46
|
+
- [lint-staged][39]
|
|
47
|
+
- [LintHTML][40]
|
|
48
|
+
- [lockfile-lint][41]
|
|
49
|
+
- [Lost Pixel][42]
|
|
50
|
+
- [markdownlint][43]
|
|
51
|
+
- [Metro][44]
|
|
52
|
+
- [Mocha][45]
|
|
53
|
+
- [moonrepo][46]
|
|
54
|
+
- [Mock Service Worker][47]
|
|
55
|
+
- [Nano Staged][48]
|
|
56
|
+
- [Nest][49]
|
|
57
|
+
- [Netlify][50]
|
|
58
|
+
- [Next.js][51]
|
|
59
|
+
- [Node.js][52]
|
|
60
|
+
- [node-modules-inspector][53]
|
|
61
|
+
- [nodemon][54]
|
|
62
|
+
- [npm-package-json-lint][55]
|
|
63
|
+
- [Nuxt][56]
|
|
64
|
+
- [Nx][57]
|
|
65
|
+
- [nyc][58]
|
|
66
|
+
- [oclif][59]
|
|
67
|
+
- [Oxlint][60]
|
|
68
|
+
- [Playwright][61]
|
|
69
|
+
- [Playwright for components][62]
|
|
70
|
+
- [playwright-test][63]
|
|
71
|
+
- [Plop][64]
|
|
72
|
+
- [pnpm][65]
|
|
73
|
+
- [PostCSS][66]
|
|
74
|
+
- [Preconstruct][67]
|
|
75
|
+
- [Prettier][68]
|
|
76
|
+
- [Prisma][69]
|
|
77
|
+
- [React Cosmos][70]
|
|
78
|
+
- [React Router][71]
|
|
79
|
+
- [Relay][72]
|
|
80
|
+
- [Release It!][73]
|
|
81
|
+
- [Remark][74]
|
|
82
|
+
- [Remix][75]
|
|
83
|
+
- [Rollup][76]
|
|
84
|
+
- [Rsbuild][77]
|
|
85
|
+
- [Rslib][78]
|
|
86
|
+
- [Rspack][79]
|
|
87
|
+
- [Rstest][80]
|
|
88
|
+
- [Semantic Release][81]
|
|
89
|
+
- [Sentry][82]
|
|
90
|
+
- [simple-git-hooks][83]
|
|
91
|
+
- [size-limit][84]
|
|
92
|
+
- [SST][85]
|
|
93
|
+
- [Starlight][86]
|
|
94
|
+
- [Storybook][87]
|
|
95
|
+
- [Stryker][88]
|
|
96
|
+
- [Stylelint][89]
|
|
97
|
+
- [Svelte][90]
|
|
98
|
+
- [SVGO][91]
|
|
99
|
+
- [Syncpack][92]
|
|
100
|
+
- [Tailwind][93]
|
|
101
|
+
- [Travis CI][94]
|
|
102
|
+
- [ts-node][95]
|
|
103
|
+
- [tsdown][96]
|
|
104
|
+
- [tsup][97]
|
|
105
|
+
- [tsx][98]
|
|
106
|
+
- [TypeDoc][99]
|
|
107
|
+
- [TypeScript][100]
|
|
108
|
+
- [unbuild][101]
|
|
109
|
+
- [UnoCSS][102]
|
|
110
|
+
- [Vercel OG][103]
|
|
111
|
+
- [Vike][104]
|
|
112
|
+
- [Vite][105]
|
|
113
|
+
- [Vitest][106]
|
|
114
|
+
- [Vue][107]
|
|
115
|
+
- [WebdriverIO][108]
|
|
116
|
+
- [webpack][109]
|
|
117
|
+
- [Wireit][110]
|
|
118
|
+
- [Wrangler][111]
|
|
119
|
+
- [xo][112]
|
|
120
|
+
- [Yarn][113]
|
|
121
|
+
- [yorkie][114]
|
|
122
|
+
|
|
123
|
+
:::
|
|
124
|
+
|
|
125
|
+
[1]: /reference/plugins/angular 'Angular'
|
|
126
|
+
[2]: /reference/plugins/astro 'Astro'
|
|
127
|
+
[3]: /reference/plugins/ava 'Ava'
|
|
128
|
+
[4]: /reference/plugins/babel 'Babel'
|
|
129
|
+
[5]: /reference/plugins/biome 'Biome'
|
|
130
|
+
[6]: /reference/plugins/bumpp 'bumpp'
|
|
131
|
+
[7]: /reference/plugins/bun 'Bun'
|
|
132
|
+
[8]: /reference/plugins/c8 'c8'
|
|
133
|
+
[9]: /reference/plugins/capacitor 'Capacitor'
|
|
134
|
+
[10]: /reference/plugins/changelogen 'Changelogen'
|
|
135
|
+
[11]: /reference/plugins/changelogithub 'Changelogithub'
|
|
136
|
+
[12]: /reference/plugins/changesets 'Changesets'
|
|
137
|
+
[13]: /reference/plugins/commitizen 'Commitizen'
|
|
138
|
+
[14]: /reference/plugins/commitlint 'commitlint'
|
|
139
|
+
[15]: /reference/plugins/convex 'Convex'
|
|
140
|
+
[16]: /reference/plugins/create-typescript-app 'create-typescript-app'
|
|
141
|
+
[17]: /reference/plugins/cspell 'CSpell'
|
|
142
|
+
[18]: /reference/plugins/cucumber 'Cucumber'
|
|
143
|
+
[19]: /reference/plugins/cypress 'Cypress'
|
|
144
|
+
[20]: /reference/plugins/dependency-cruiser 'dependency-cruiser'
|
|
145
|
+
[21]: /reference/plugins/docusaurus 'Docusaurus'
|
|
146
|
+
[22]: /reference/plugins/dotenv 'dotenv'
|
|
147
|
+
[23]: /reference/plugins/drizzle 'Drizzle'
|
|
148
|
+
[24]: /reference/plugins/eleventy 'Eleventy'
|
|
149
|
+
[25]: /reference/plugins/eslint 'ESLint'
|
|
150
|
+
[26]: /reference/plugins/expo 'Expo'
|
|
151
|
+
[27]: /reference/plugins/gatsby 'Gatsby'
|
|
152
|
+
[28]: /reference/plugins/github-action 'GitHub Action'
|
|
153
|
+
[29]: /reference/plugins/github-actions 'GitHub Actions'
|
|
154
|
+
[30]: /reference/plugins/glob 'glob'
|
|
155
|
+
[31]: /reference/plugins/graphql-codegen 'GraphQL Codegen'
|
|
156
|
+
[32]: /reference/plugins/hardhat 'Hardhat'
|
|
157
|
+
[33]: /reference/plugins/husky 'husky'
|
|
158
|
+
[34]: /reference/plugins/i18next-parser 'i18next Parser'
|
|
159
|
+
[35]: /reference/plugins/jest 'Jest'
|
|
160
|
+
[36]: /reference/plugins/karma 'Karma'
|
|
161
|
+
[37]: /reference/plugins/ladle 'Ladle'
|
|
162
|
+
[38]: /reference/plugins/lefthook 'Lefthook'
|
|
163
|
+
[39]: /reference/plugins/lint-staged 'lint-staged'
|
|
164
|
+
[40]: /reference/plugins/linthtml 'LintHTML'
|
|
165
|
+
[41]: /reference/plugins/lockfile-lint 'lockfile-lint'
|
|
166
|
+
[42]: /reference/plugins/lost-pixel 'Lost Pixel'
|
|
167
|
+
[43]: /reference/plugins/markdownlint 'markdownlint'
|
|
168
|
+
[44]: /reference/plugins/metro 'Metro'
|
|
169
|
+
[45]: /reference/plugins/mocha 'Mocha'
|
|
170
|
+
[46]: /reference/plugins/moonrepo 'moonrepo'
|
|
171
|
+
[47]: /reference/plugins/msw 'Mock Service Worker'
|
|
172
|
+
[48]: /reference/plugins/nano-staged 'Nano Staged'
|
|
173
|
+
[49]: /reference/plugins/nest 'Nest'
|
|
174
|
+
[50]: /reference/plugins/netlify 'Netlify'
|
|
175
|
+
[51]: /reference/plugins/next 'Next.js'
|
|
176
|
+
[52]: /reference/plugins/node 'Node.js'
|
|
177
|
+
[53]: /reference/plugins/node-modules-inspector 'node-modules-inspector'
|
|
178
|
+
[54]: /reference/plugins/nodemon 'nodemon'
|
|
179
|
+
[55]: /reference/plugins/npm-package-json-lint 'npm-package-json-lint'
|
|
180
|
+
[56]: /reference/plugins/nuxt 'Nuxt'
|
|
181
|
+
[57]: /reference/plugins/nx 'Nx'
|
|
182
|
+
[58]: /reference/plugins/nyc 'nyc'
|
|
183
|
+
[59]: /reference/plugins/oclif 'oclif'
|
|
184
|
+
[60]: /reference/plugins/oxlint 'Oxlint'
|
|
185
|
+
[61]: /reference/plugins/playwright 'Playwright'
|
|
186
|
+
[62]: /reference/plugins/playwright-ct 'Playwright for components'
|
|
187
|
+
[63]: /reference/plugins/playwright-test 'playwright-test'
|
|
188
|
+
[64]: /reference/plugins/plop 'Plop'
|
|
189
|
+
[65]: /reference/plugins/pnpm 'pnpm'
|
|
190
|
+
[66]: /reference/plugins/postcss 'PostCSS'
|
|
191
|
+
[67]: /reference/plugins/preconstruct 'Preconstruct'
|
|
192
|
+
[68]: /reference/plugins/prettier 'Prettier'
|
|
193
|
+
[69]: /reference/plugins/prisma 'Prisma'
|
|
194
|
+
[70]: /reference/plugins/react-cosmos 'React Cosmos'
|
|
195
|
+
[71]: /reference/plugins/react-router 'React Router'
|
|
196
|
+
[72]: /reference/plugins/relay 'Relay'
|
|
197
|
+
[73]: /reference/plugins/release-it 'Release It!'
|
|
198
|
+
[74]: /reference/plugins/remark 'Remark'
|
|
199
|
+
[75]: /reference/plugins/remix 'Remix'
|
|
200
|
+
[76]: /reference/plugins/rollup 'Rollup'
|
|
201
|
+
[77]: /reference/plugins/rsbuild 'Rsbuild'
|
|
202
|
+
[78]: /reference/plugins/rslib 'Rslib'
|
|
203
|
+
[79]: /reference/plugins/rspack 'Rspack'
|
|
204
|
+
[80]: /reference/plugins/rstest 'Rstest'
|
|
205
|
+
[81]: /reference/plugins/semantic-release 'Semantic Release'
|
|
206
|
+
[82]: /reference/plugins/sentry 'Sentry'
|
|
207
|
+
[83]: /reference/plugins/simple-git-hooks 'simple-git-hooks'
|
|
208
|
+
[84]: /reference/plugins/size-limit 'size-limit'
|
|
209
|
+
[85]: /reference/plugins/sst 'SST'
|
|
210
|
+
[86]: /reference/plugins/starlight 'Starlight'
|
|
211
|
+
[87]: /reference/plugins/storybook 'Storybook'
|
|
212
|
+
[88]: /reference/plugins/stryker 'Stryker'
|
|
213
|
+
[89]: /reference/plugins/stylelint 'Stylelint'
|
|
214
|
+
[90]: /reference/plugins/svelte 'Svelte'
|
|
215
|
+
[91]: /reference/plugins/svgo 'SVGO'
|
|
216
|
+
[92]: /reference/plugins/syncpack 'Syncpack'
|
|
217
|
+
[93]: /reference/plugins/tailwind 'Tailwind'
|
|
218
|
+
[94]: /reference/plugins/travis 'Travis CI'
|
|
219
|
+
[95]: /reference/plugins/ts-node 'ts-node'
|
|
220
|
+
[96]: /reference/plugins/tsdown 'tsdown'
|
|
221
|
+
[97]: /reference/plugins/tsup 'tsup'
|
|
222
|
+
[98]: /reference/plugins/tsx 'tsx'
|
|
223
|
+
[99]: /reference/plugins/typedoc 'TypeDoc'
|
|
224
|
+
[100]: /reference/plugins/typescript 'TypeScript'
|
|
225
|
+
[101]: /reference/plugins/unbuild 'unbuild'
|
|
226
|
+
[102]: /reference/plugins/unocss 'UnoCSS'
|
|
227
|
+
[103]: /reference/plugins/vercel-og 'Vercel OG'
|
|
228
|
+
[104]: /reference/plugins/vike 'Vike'
|
|
229
|
+
[105]: /reference/plugins/vite 'Vite'
|
|
230
|
+
[106]: /reference/plugins/vitest 'Vitest'
|
|
231
|
+
[107]: /reference/plugins/vue 'Vue'
|
|
232
|
+
[108]: /reference/plugins/webdriver-io 'WebdriverIO'
|
|
233
|
+
[109]: /reference/plugins/webpack 'webpack'
|
|
234
|
+
[110]: /reference/plugins/wireit 'Wireit'
|
|
235
|
+
[111]: /reference/plugins/wrangler 'Wrangler'
|
|
236
|
+
[112]: /reference/plugins/xo 'xo'
|
|
237
|
+
[113]: /reference/plugins/yarn 'Yarn'
|
|
238
|
+
[114]: /reference/plugins/yorkie 'yorkie'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Related Tooling
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
This is an overview of related tooling for features Knip does not support.
|
|
6
|
+
|
|
7
|
+
## Unused variables
|
|
8
|
+
|
|
9
|
+
Knip doesn't look for unused variables within a file. The focus is on exported
|
|
10
|
+
and imported values and types across files.
|
|
11
|
+
|
|
12
|
+
Use [ESLint][1], [Biome][2] or [oxlint][3] to find unused variables within
|
|
13
|
+
files.
|
|
14
|
+
|
|
15
|
+
Use [remove-unused-vars][4] to remove unused code within files, but in a more
|
|
16
|
+
valiant way. Using input from any of the above linters, it actually removes a
|
|
17
|
+
lot more unused code. This pairs great with Knip.
|
|
18
|
+
|
|
19
|
+
## Unused properties
|
|
20
|
+
|
|
21
|
+
Knip does not yet support finding unused members of types, interfaces and
|
|
22
|
+
objects. This includes returned objects from exported functions and objects
|
|
23
|
+
passed as React component props.
|
|
24
|
+
|
|
25
|
+
Knip does support finding unused members of enums and classes, and exported
|
|
26
|
+
values and types on imported namespaces.
|
|
27
|
+
|
|
28
|
+
## Circular dependencies
|
|
29
|
+
|
|
30
|
+
Knip has no issues with circular dependencies, and does not report them. Tools
|
|
31
|
+
that do support this include [DPDM][5], [Madge][6] and [skott][7].
|
|
32
|
+
|
|
33
|
+
## Cleanup
|
|
34
|
+
|
|
35
|
+
The [e18e.dev][8] website and in particular the [Cleanup][9] section is a great
|
|
36
|
+
resource when dealing with technical debt.
|
|
37
|
+
|
|
38
|
+
[1]: https://eslint.org
|
|
39
|
+
[2]: https://biomejs.dev/linter/
|
|
40
|
+
[3]: https://oxc.rs/docs/guide/usage/linter.html
|
|
41
|
+
[4]: https://github.com/webpro-nl/remove-unused-vars
|
|
42
|
+
[5]: https://github.com/acrazing/dpdm
|
|
43
|
+
[6]: https://github.com/pahen/madge
|
|
44
|
+
[7]: https://github.com/antoine-coulon/skott
|
|
45
|
+
[8]: https://e18e.dev
|
|
46
|
+
[9]: https://e18e.dev/guide/cleanup.html
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Become a sponsor!'
|
|
3
|
+
template: splash
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
|
|
7
|
+
import Posts from '../../components/Posts.astro';
|
|
8
|
+
import Projects from '../../components/Projects.astro';
|
|
9
|
+
import SponsorsComponent from '../../components/Sponsors.astro';
|
|
10
|
+
import SponsorsChart from '../../components/SponsorsChart.astro';
|
|
11
|
+
import SponsorsPast from '../../components/SponsorsPast.astro';
|
|
12
|
+
|
|
13
|
+
:::article{.prose}
|
|
14
|
+
|
|
15
|
+
Knip is a powerful tool that helps thousands of developers keep their JavaScript
|
|
16
|
+
and TypeScript projects lean and maintainable. Knip saves teams valuable time
|
|
17
|
+
and resources.
|
|
18
|
+
|
|
19
|
+
Building and maintaining Knip has been, and remains, a lot of work. Supportive
|
|
20
|
+
resources allow me to focus on maintenance and development of Knip, which is
|
|
21
|
+
[relied upon][1] [by many][2] in the JavaScript community. Please consider
|
|
22
|
+
supporting the project! The following platforms are available to support Knip:
|
|
23
|
+
|
|
24
|
+
- [GitHub Sponsors][3]
|
|
25
|
+
- [OpenCollective][4]
|
|
26
|
+
|
|
27
|
+
You or your company logo with a backlink to your website will be added to this
|
|
28
|
+
page if you decide to support the project on an ongoing basis. Eternal gratitude
|
|
29
|
+
to the companies and people supporting the project!
|
|
30
|
+
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
<SponsorsComponent showAll={true} />
|
|
34
|
+
|
|
35
|
+
## Monthly Overview
|
|
36
|
+
|
|
37
|
+
Overview of gross GitHub and OpenCollective sponsorships and invoices, starting
|
|
38
|
+
from the moment the project openly asked for support. Actual development started
|
|
39
|
+
one year before that.
|
|
40
|
+
|
|
41
|
+
<SponsorsChart />
|
|
42
|
+
|
|
43
|
+
- The monthly aggregated average over the charted period is $507.
|
|
44
|
+
- The monthly recurring average without one-time payments is $331.
|
|
45
|
+
- GitHub Sponsors is for my GitHub account. This has more repositories, but in
|
|
46
|
+
practice targets mostly Knip (and perhaps some [release-it][5]).
|
|
47
|
+
- [Chart generated][6] using [Venz][7].
|
|
48
|
+
|
|
49
|
+
## Trusted by the world's best software teams
|
|
50
|
+
|
|
51
|
+
<section class="columns min300">
|
|
52
|
+
<Projects />
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
## Don't just take our word for it
|
|
56
|
+
|
|
57
|
+
<Posts />
|
|
58
|
+
|
|
59
|
+
[1]: #trusted-by-the-worlds-best-software-teams
|
|
60
|
+
[2]: https://github.com/webpro-nl/knip/network/dependents
|
|
61
|
+
[3]: https://github.com/sponsors/webpro
|
|
62
|
+
[4]: https://opencollective.com/knip
|
|
63
|
+
[5]: https://github.com/release-it/release-it
|
|
64
|
+
[6]: https://try.venz.dev?type=pivot&lp=tr&br=0&labelX=month&labelY=amount+\($\)&l=GitHub+Sponsors&color=%23fbfbfb&l=Open+Collective&color=%232487ff&label=2023-11&data=9,0&label=2023-12&data=74,0&label=2024-01&data=239,0&label=2024-02&data=489,0&label=2024-03&data=189,0&label=2024-04&data=204,750&label=2024-05&data=304,101&label=2024-06&data=1204,0&label=2024-07&data=204,35&label=2024-08&data=229,25&label=2024-09&data=2729,25&label=2024-10&data=410,45&label=2024-11&data=222,45&label=2024-12&data=222,145&label=2025-01&data=342,145&label=2025-02&data=244,145&label=2025-03&data=222,145&label=2025-04&data=222,145&label=2025-05&data=242,145&label=2025-06&data=247,145&label=2025-07&data=297,145&label=2025-08&data=268,145&label=2025-09&data=350,145&label=2025-10&data=375,145
|
|
65
|
+
[7]: https://try.venz.dev
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Unused dependencies
|
|
3
|
+
description: Find and remove unused dependencies with Knip
|
|
4
|
+
prev: false
|
|
5
|
+
next: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
One of Knip's core features is finding unused dependencies in your JavaScript
|
|
9
|
+
and TypeScript projects. And it comes with many more features to remove clutter
|
|
10
|
+
and keep your projects in great shape.
|
|
11
|
+
|
|
12
|
+
## Why are unused dependencies a problem?
|
|
13
|
+
|
|
14
|
+
Having unused dependencies in your `package.json` is an issue for various
|
|
15
|
+
reasons:
|
|
16
|
+
|
|
17
|
+
- They might end up in the final production bundle, increasing size and load
|
|
18
|
+
times for end users.
|
|
19
|
+
- They waste space in `node_modules` and add to the installation time of the
|
|
20
|
+
project.
|
|
21
|
+
- They slow down tooling such as linters and bundlers that analyze dependencies.
|
|
22
|
+
- They are confusing and noisy in `package.json`.
|
|
23
|
+
- They cause unnecessary extra work when managing and upgrading dependencies.
|
|
24
|
+
- They can cause version conflicts with other dependencies in use.
|
|
25
|
+
- They can cause false security alerts.
|
|
26
|
+
- They might have restrictive licenses and make your project subject to theirs.
|
|
27
|
+
- They usually come with transitive dependencies that have the same issues.
|
|
28
|
+
|
|
29
|
+
## How do I find unused dependencies?
|
|
30
|
+
|
|
31
|
+
Use Knip to find and remove unused dependencies. It also finds dependencies that
|
|
32
|
+
are missing in `package.json` and has a lot more features to keep your
|
|
33
|
+
JavaScript and TypeScript projects tidy.
|
|
34
|
+
|
|
35
|
+
It's easy to [get started][1] and make package management easier and more fun!
|
|
36
|
+
|
|
37
|
+
<div style="display: flex; justify-content: center; margin: 4rem auto;">
|
|
38
|
+
<img src="/logo.svg" alt="Logo of Knip, to find unused dependencies, exports and files" class="logo-border" />
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
## How does Knip identify unused dependencies?
|
|
42
|
+
|
|
43
|
+
Knip works by analyzing `package.json` files, source code and configuration
|
|
44
|
+
files for other tooling in the project to find unused and missing dependencies.
|
|
45
|
+
Knip has many heuristics, [plugins][2] and [compilers][3] to fully automate the
|
|
46
|
+
process.
|
|
47
|
+
|
|
48
|
+
## Can Knip remove unused dependencies?
|
|
49
|
+
|
|
50
|
+
Yes, Knip can automatically remove unused dependencies installed by a package
|
|
51
|
+
manager like npm or pnpm for you. Add the `--fix` argument to [auto-fix][4] and
|
|
52
|
+
remove unused dependencies from `package.json`.
|
|
53
|
+
|
|
54
|
+
## Can Knip detect missing dependencies?
|
|
55
|
+
|
|
56
|
+
Yes, Knip detects missing dependencies. It analyzes `package.json` files, and
|
|
57
|
+
reports packages that are missing. They should be added to `package.json` to
|
|
58
|
+
avoid relying on transitive dependencies that can cause version mismatches and
|
|
59
|
+
breakage.
|
|
60
|
+
|
|
61
|
+
## Does Knip work with monorepos?
|
|
62
|
+
|
|
63
|
+
Yes, Knip has first-class support for [monorepos and workspaces][5]. It analyzes
|
|
64
|
+
all workspaces in the project and understands their relationship.
|
|
65
|
+
|
|
66
|
+
For instance, if a dependency is listed in the root `package.json` it does not
|
|
67
|
+
need to be listed in other workspaces. Except if you enable `--strict` checking.
|
|
68
|
+
|
|
69
|
+
## Does Knip separate dependencies and devDependencies?
|
|
70
|
+
|
|
71
|
+
Yes, Knip understands the difference between dependencies and devDependencies.
|
|
72
|
+
It has a [production mode][6] to focus on production code only and find dead
|
|
73
|
+
code and dependencies that would otherwise only be referenced by tests and other
|
|
74
|
+
tooling. This allows you to remove both unused exported code and their tests.
|
|
75
|
+
|
|
76
|
+
## Does Knip work with my package manager?
|
|
77
|
+
|
|
78
|
+
Yes, Knip works with any package manager: npm, pnpm, Bun and Yarn are all
|
|
79
|
+
supported. It's easy to [get started][1] with any package manager.
|
|
80
|
+
|
|
81
|
+
[1]: ../overview/getting-started.mdx
|
|
82
|
+
[2]: ../reference/plugins.md
|
|
83
|
+
[3]: ../features/compilers.md
|
|
84
|
+
[4]: ../features/auto-fix.mdx
|
|
85
|
+
[5]: ../features/monorepos-and-workspaces.md
|
|
86
|
+
[6]: ../features/production-mode.md
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Unused exports
|
|
3
|
+
description: Find and remove unused exports with Knip
|
|
4
|
+
prev: false
|
|
5
|
+
next: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Finding unused exports in your JavaScript and TypeScript projects is one of
|
|
9
|
+
Knip's core features. And it comes with even more features to identify and
|
|
10
|
+
remove clutter to keep your projects in great shape.
|
|
11
|
+
|
|
12
|
+
## Why are unused exports a problem?
|
|
13
|
+
|
|
14
|
+
Having unused exports in your codebase is problematic for several reasons:
|
|
15
|
+
|
|
16
|
+
- They increase bundle sizes if not properly eliminated by tree-shaking.
|
|
17
|
+
- They clutter the codebase and make it harder to navigate and understand.
|
|
18
|
+
- They mislead developers into thinking certain code is used when it's not.
|
|
19
|
+
- They make refactoring and maintaining the codebase more difficult.
|
|
20
|
+
- They slow down tooling that analyze the codebase, such as bundlers, linters
|
|
21
|
+
and type checkers.
|
|
22
|
+
- They may represent dead code that is no longer needed but hasn't been cleaned
|
|
23
|
+
up.
|
|
24
|
+
|
|
25
|
+
## How do I find unused exports?
|
|
26
|
+
|
|
27
|
+
Knip is a powerful tool that can help you find and remove unused exports in your
|
|
28
|
+
JavaScript and TypeScript projects. It analyzes the codebase, identifies exports
|
|
29
|
+
that are not imported anywhere, and reports them.
|
|
30
|
+
|
|
31
|
+
[Get started and install Knip][1] to run it on your project. Knip will scan your
|
|
32
|
+
files and provide a detailed report of unused exports, and much more.
|
|
33
|
+
|
|
34
|
+
<div style="display: flex; justify-content: center; margin: 4rem auto;">
|
|
35
|
+
<img src="/logo.svg" alt="Logo of Knip, to find unused dependencies, exports and files" class="logo-border" />
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
## How does Knip identify unused exports?
|
|
39
|
+
|
|
40
|
+
Knip performs both static and dynamic analysis to determine which exports are
|
|
41
|
+
actually being used in your codebase. It looks at import statements, export
|
|
42
|
+
usage, and [a lot more code patterns][2] to identify unused exports.
|
|
43
|
+
|
|
44
|
+
Knip supports JavaScript and TypeScript projects, and handles both [CommonJS][3]
|
|
45
|
+
and ES Modules syntax.
|
|
46
|
+
|
|
47
|
+
## Can Knip remove unused exports?
|
|
48
|
+
|
|
49
|
+
Yes, Knip not only finds unused exports but can also remove them for you. Run
|
|
50
|
+
Knip with the `--fix` flag to enable [the auto-fix feature][4], and it will
|
|
51
|
+
modify your source code and remove the unused exports.
|
|
52
|
+
|
|
53
|
+
It's always recommended to review the changes made by Knip before committing
|
|
54
|
+
them to ensure no unintended modifications were made.
|
|
55
|
+
|
|
56
|
+
## Can Knip handle large codebases?
|
|
57
|
+
|
|
58
|
+
Absolutely. Knip supports [monorepos with workspaces][5] and utilizes [workspace
|
|
59
|
+
sharing][6] to efficiently analyze large monorepos. This makes it easier and
|
|
60
|
+
more fun to manage and optimize large multi-package projects.
|
|
61
|
+
|
|
62
|
+
## Does Knip work with my favorite editor or IDE?
|
|
63
|
+
|
|
64
|
+
Knip is a command-line tool that runs independently of your editor or IDE.
|
|
65
|
+
However, if you run Knip inside an integrated IDE terminal, the report contains
|
|
66
|
+
file names and positions in a format IDEs like VS Code and WebStorm understand
|
|
67
|
+
to easily navigate around.
|
|
68
|
+
|
|
69
|
+
## How is Knip different from ESLint for finding unused exports?
|
|
70
|
+
|
|
71
|
+
While linters like ESLint can find unused variables and imports within
|
|
72
|
+
individual files, Knip analyzes the entire project to determine which exports
|
|
73
|
+
are actually unused. By building [a comprehensive module graph][7], Knip
|
|
74
|
+
identifies exports that are not imported or used anywhere in the codebase. This
|
|
75
|
+
allows Knip to catch unused exports and dead code that ESLint and other linters
|
|
76
|
+
would miss.
|
|
77
|
+
|
|
78
|
+
Also see [Why isn't Knip an ESLint plugin?][8]
|
|
79
|
+
|
|
80
|
+
[1]: ../overview/getting-started.mdx
|
|
81
|
+
[2]: ../reference/faq.md#what-does-knip-look-for-in-source-files
|
|
82
|
+
[3]: ../guides/working-with-commonjs.md
|
|
83
|
+
[4]: ../features/auto-fix.mdx
|
|
84
|
+
[5]: ../features/monorepos-and-workspaces.md
|
|
85
|
+
[6]: ../guides/performance.md#workspace-sharing
|
|
86
|
+
[7]: ../reference/faq.md#whats-in-the-graphs
|
|
87
|
+
[8]: ../reference/faq.md#why-isnt-knip-an-eslint-plugin
|