@knip/mcp 0.0.18 → 0.0.20

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.
Files changed (343) hide show
  1. package/package.json +17 -17
  2. package/src/docs/blog/for-editors-and-agents.md +47 -43
  3. package/src/docs/blog/knip-v3.mdx +1 -1
  4. package/src/docs/blog/knip-v4.mdx +2 -2
  5. package/src/docs/blog/two-years.mdx +1 -1
  6. package/src/docs/explanations/comparison-and-migration.md +4 -0
  7. package/src/docs/explanations/plugins.md +38 -10
  8. package/src/docs/features/auto-fix.mdx +22 -7
  9. package/src/docs/features/monorepos-and-workspaces.md +19 -4
  10. package/src/docs/features/production-mode.md +1 -1
  11. package/src/docs/features/reporters.md +9 -7
  12. package/src/docs/guides/configuring-project-files.md +13 -13
  13. package/src/docs/guides/contributing.md +1 -1
  14. package/src/docs/guides/handling-issues.mdx +183 -121
  15. package/src/docs/guides/issue-reproduction.md +21 -12
  16. package/src/docs/guides/performance.md +19 -8
  17. package/src/docs/guides/troubleshooting.md +7 -10
  18. package/src/docs/guides/using-knip-in-ci.md +16 -20
  19. package/src/docs/index.mdx +3 -3
  20. package/src/docs/overview/configuration.md +6 -6
  21. package/src/docs/overview/features.md +5 -5
  22. package/src/docs/overview/getting-started.mdx +15 -5
  23. package/src/docs/reference/cli.md +269 -243
  24. package/src/docs/reference/configuration.md +24 -7
  25. package/src/docs/reference/faq.md +111 -59
  26. package/src/docs/reference/jsdoc-tsdoc-tags.md +12 -1
  27. package/src/docs/reference/known-issues.md +43 -21
  28. package/src/docs/reference/plugins.md +15 -1
  29. package/src/docs/reference/related-tooling.md +3 -3
  30. package/src/docs/sponsors.mdx +3 -4
  31. package/src/docs/typescript/unused-exports.md +1 -1
  32. package/src/docs/writing-a-plugin/index.md +17 -4
  33. package/src/tools.js +3 -9
  34. package/src/docs/docs/blog/brief-history.md +0 -30
  35. package/src/docs/docs/blog/for-editors-and-agents.md +0 -131
  36. package/src/docs/docs/blog/knip-v3.mdx +0 -88
  37. package/src/docs/docs/blog/knip-v4.mdx +0 -149
  38. package/src/docs/docs/blog/knip-v5.mdx +0 -190
  39. package/src/docs/docs/blog/migration-to-v1.md +0 -65
  40. package/src/docs/docs/blog/release-notes-v2.md +0 -46
  41. package/src/docs/docs/blog/slim-down-to-speed-up.md +0 -269
  42. package/src/docs/docs/blog/state-of-knip.md +0 -191
  43. package/src/docs/docs/blog/two-years.mdx +0 -107
  44. package/src/docs/docs/explanations/comparison-and-migration.md +0 -129
  45. package/src/docs/docs/explanations/entry-files.md +0 -70
  46. package/src/docs/docs/explanations/plugins.md +0 -329
  47. package/src/docs/docs/explanations/why-use-knip.md +0 -128
  48. package/src/docs/docs/features/auto-fix.mdx +0 -348
  49. package/src/docs/docs/features/compilers.md +0 -172
  50. package/src/docs/docs/features/integrated-monorepos.md +0 -61
  51. package/src/docs/docs/features/monorepos-and-workspaces.md +0 -149
  52. package/src/docs/docs/features/production-mode.md +0 -95
  53. package/src/docs/docs/features/reporters.md +0 -304
  54. package/src/docs/docs/features/rules-and-filters.md +0 -102
  55. package/src/docs/docs/features/script-parser.md +0 -156
  56. package/src/docs/docs/features/source-mapping.md +0 -100
  57. package/src/docs/docs/guides/configuring-project-files.md +0 -205
  58. package/src/docs/docs/guides/contributing.md +0 -24
  59. package/src/docs/docs/guides/handling-issues.mdx +0 -708
  60. package/src/docs/docs/guides/issue-reproduction.md +0 -102
  61. package/src/docs/docs/guides/namespace-imports.md +0 -125
  62. package/src/docs/docs/guides/performance.md +0 -108
  63. package/src/docs/docs/guides/troubleshooting.md +0 -133
  64. package/src/docs/docs/guides/using-knip-in-ci.md +0 -50
  65. package/src/docs/docs/guides/working-with-commonjs.md +0 -72
  66. package/src/docs/docs/index.mdx +0 -160
  67. package/src/docs/docs/overview/configuration.md +0 -104
  68. package/src/docs/docs/overview/features.md +0 -66
  69. package/src/docs/docs/overview/getting-started.mdx +0 -205
  70. package/src/docs/docs/overview/screenshots-videos.md +0 -42
  71. package/src/docs/docs/playground.mdx +0 -38
  72. package/src/docs/docs/reference/cli.md +0 -511
  73. package/src/docs/docs/reference/configuration.md +0 -430
  74. package/src/docs/docs/reference/dynamic-configuration.mdx +0 -72
  75. package/src/docs/docs/reference/faq.md +0 -432
  76. package/src/docs/docs/reference/issue-types.md +0 -43
  77. package/src/docs/docs/reference/jsdoc-tsdoc-tags.md +0 -122
  78. package/src/docs/docs/reference/known-issues.md +0 -86
  79. package/src/docs/docs/reference/plugins/.gitkeep +0 -0
  80. package/src/docs/docs/reference/plugins/angular.md +0 -33
  81. package/src/docs/docs/reference/plugins/astro-db.md +0 -34
  82. package/src/docs/docs/reference/plugins/astro-og-canvas.md +0 -13
  83. package/src/docs/docs/reference/plugins/astro.md +0 -43
  84. package/src/docs/docs/reference/plugins/ava.md +0 -46
  85. package/src/docs/docs/reference/plugins/babel.md +0 -38
  86. package/src/docs/docs/reference/plugins/biome.md +0 -34
  87. package/src/docs/docs/reference/plugins/bumpp.md +0 -38
  88. package/src/docs/docs/reference/plugins/bun.md +0 -13
  89. package/src/docs/docs/reference/plugins/c8.md +0 -26
  90. package/src/docs/docs/reference/plugins/capacitor.md +0 -35
  91. package/src/docs/docs/reference/plugins/changelogen.md +0 -38
  92. package/src/docs/docs/reference/plugins/changelogithub.md +0 -38
  93. package/src/docs/docs/reference/plugins/changesets.md +0 -33
  94. package/src/docs/docs/reference/plugins/commitizen.md +0 -35
  95. package/src/docs/docs/reference/plugins/commitlint.md +0 -39
  96. package/src/docs/docs/reference/plugins/convex.md +0 -34
  97. package/src/docs/docs/reference/plugins/create-typescript-app.md +0 -33
  98. package/src/docs/docs/reference/plugins/cspell.md +0 -36
  99. package/src/docs/docs/reference/plugins/cucumber.md +0 -36
  100. package/src/docs/docs/reference/plugins/cypress.md +0 -40
  101. package/src/docs/docs/reference/plugins/danger.md +0 -33
  102. package/src/docs/docs/reference/plugins/dependency-cruiser.md +0 -44
  103. package/src/docs/docs/reference/plugins/docusaurus.md +0 -39
  104. package/src/docs/docs/reference/plugins/dotenv.md +0 -24
  105. package/src/docs/docs/reference/plugins/drizzle.md +0 -33
  106. package/src/docs/docs/reference/plugins/eleventy.md +0 -38
  107. package/src/docs/docs/reference/plugins/eslint.md +0 -74
  108. package/src/docs/docs/reference/plugins/expo.md +0 -38
  109. package/src/docs/docs/reference/plugins/expressive-code.md +0 -39
  110. package/src/docs/docs/reference/plugins/gatsby.md +0 -46
  111. package/src/docs/docs/reference/plugins/github-action.md +0 -33
  112. package/src/docs/docs/reference/plugins/github-actions.md +0 -34
  113. package/src/docs/docs/reference/plugins/glob.md +0 -26
  114. package/src/docs/docs/reference/plugins/graphql-codegen.md +0 -43
  115. package/src/docs/docs/reference/plugins/hardhat.md +0 -33
  116. package/src/docs/docs/reference/plugins/husky.md +0 -37
  117. package/src/docs/docs/reference/plugins/i18next-parser.md +0 -44
  118. package/src/docs/docs/reference/plugins/jest.md +0 -50
  119. package/src/docs/docs/reference/plugins/karma.md +0 -36
  120. package/src/docs/docs/reference/plugins/knex.md +0 -33
  121. package/src/docs/docs/reference/plugins/ladle.md +0 -40
  122. package/src/docs/docs/reference/plugins/lefthook.md +0 -43
  123. package/src/docs/docs/reference/plugins/lint-staged.md +0 -45
  124. package/src/docs/docs/reference/plugins/linthtml.md +0 -38
  125. package/src/docs/docs/reference/plugins/lockfile-lint.md +0 -38
  126. package/src/docs/docs/reference/plugins/lost-pixel.md +0 -33
  127. package/src/docs/docs/reference/plugins/markdownlint.md +0 -34
  128. package/src/docs/docs/reference/plugins/mdx.md +0 -37
  129. package/src/docs/docs/reference/plugins/mdxlint.md +0 -35
  130. package/src/docs/docs/reference/plugins/metro.md +0 -46
  131. package/src/docs/docs/reference/plugins/mocha.md +0 -48
  132. package/src/docs/docs/reference/plugins/moonrepo.md +0 -35
  133. package/src/docs/docs/reference/plugins/msw.md +0 -36
  134. package/src/docs/docs/reference/plugins/nano-staged.md +0 -36
  135. package/src/docs/docs/reference/plugins/nest.md +0 -38
  136. package/src/docs/docs/reference/plugins/netlify.md +0 -42
  137. package/src/docs/docs/reference/plugins/next-intl.md +0 -33
  138. package/src/docs/docs/reference/plugins/next-mdx.md +0 -36
  139. package/src/docs/docs/reference/plugins/next.md +0 -53
  140. package/src/docs/docs/reference/plugins/nitro.md +0 -50
  141. package/src/docs/docs/reference/plugins/node-modules-inspector.md +0 -45
  142. package/src/docs/docs/reference/plugins/node.md +0 -48
  143. package/src/docs/docs/reference/plugins/nodemon.md +0 -27
  144. package/src/docs/docs/reference/plugins/npm-package-json-lint.md +0 -38
  145. package/src/docs/docs/reference/plugins/nuxt.md +0 -49
  146. package/src/docs/docs/reference/plugins/nx.md +0 -57
  147. package/src/docs/docs/reference/plugins/nyc.md +0 -36
  148. package/src/docs/docs/reference/plugins/oclif.md +0 -33
  149. package/src/docs/docs/reference/plugins/oxlint.md +0 -44
  150. package/src/docs/docs/reference/plugins/parcel.md +0 -37
  151. package/src/docs/docs/reference/plugins/playwright-ct.md +0 -39
  152. package/src/docs/docs/reference/plugins/playwright-test.md +0 -26
  153. package/src/docs/docs/reference/plugins/playwright.md +0 -49
  154. package/src/docs/docs/reference/plugins/plop.md +0 -33
  155. package/src/docs/docs/reference/plugins/pnpm.md +0 -33
  156. package/src/docs/docs/reference/plugins/postcss.md +0 -43
  157. package/src/docs/docs/reference/plugins/preconstruct.md +0 -33
  158. package/src/docs/docs/reference/plugins/prettier.md +0 -36
  159. package/src/docs/docs/reference/plugins/prisma.md +0 -55
  160. package/src/docs/docs/reference/plugins/react-cosmos.md +0 -39
  161. package/src/docs/docs/reference/plugins/react-router.md +0 -34
  162. package/src/docs/docs/reference/plugins/relay.md +0 -52
  163. package/src/docs/docs/reference/plugins/release-it.md +0 -34
  164. package/src/docs/docs/reference/plugins/remark.md +0 -37
  165. package/src/docs/docs/reference/plugins/remix.md +0 -40
  166. package/src/docs/docs/reference/plugins/rollup.md +0 -47
  167. package/src/docs/docs/reference/plugins/rsbuild.md +0 -33
  168. package/src/docs/docs/reference/plugins/rslib.md +0 -33
  169. package/src/docs/docs/reference/plugins/rspack.md +0 -33
  170. package/src/docs/docs/reference/plugins/rstest.md +0 -33
  171. package/src/docs/docs/reference/plugins/semantic-release.md +0 -38
  172. package/src/docs/docs/reference/plugins/sentry.md +0 -35
  173. package/src/docs/docs/reference/plugins/simple-git-hooks.md +0 -35
  174. package/src/docs/docs/reference/plugins/size-limit.md +0 -35
  175. package/src/docs/docs/reference/plugins/sst.md +0 -33
  176. package/src/docs/docs/reference/plugins/starlight.md +0 -33
  177. package/src/docs/docs/reference/plugins/storybook.md +0 -44
  178. package/src/docs/docs/reference/plugins/stryker.md +0 -33
  179. package/src/docs/docs/reference/plugins/stylelint.md +0 -38
  180. package/src/docs/docs/reference/plugins/svelte.md +0 -34
  181. package/src/docs/docs/reference/plugins/sveltekit.md +0 -33
  182. package/src/docs/docs/reference/plugins/svgo.md +0 -37
  183. package/src/docs/docs/reference/plugins/svgr.md +0 -40
  184. package/src/docs/docs/reference/plugins/swc.md +0 -33
  185. package/src/docs/docs/reference/plugins/syncpack.md +0 -38
  186. package/src/docs/docs/reference/plugins/tailwind.md +0 -33
  187. package/src/docs/docs/reference/plugins/tanstack-router.md +0 -48
  188. package/src/docs/docs/reference/plugins/taskfile.md +0 -40
  189. package/src/docs/docs/reference/plugins/travis.md +0 -33
  190. package/src/docs/docs/reference/plugins/ts-node.md +0 -27
  191. package/src/docs/docs/reference/plugins/tsdown.md +0 -45
  192. package/src/docs/docs/reference/plugins/tsup.md +0 -45
  193. package/src/docs/docs/reference/plugins/tsx.md +0 -46
  194. package/src/docs/docs/reference/plugins/typedoc.md +0 -49
  195. package/src/docs/docs/reference/plugins/typescript.md +0 -50
  196. package/src/docs/docs/reference/plugins/unbuild.md +0 -33
  197. package/src/docs/docs/reference/plugins/unocss.md +0 -36
  198. package/src/docs/docs/reference/plugins/vercel-og.md +0 -38
  199. package/src/docs/docs/reference/plugins/vike.md +0 -34
  200. package/src/docs/docs/reference/plugins/vite.md +0 -48
  201. package/src/docs/docs/reference/plugins/vitepress.md +0 -34
  202. package/src/docs/docs/reference/plugins/vitest.md +0 -50
  203. package/src/docs/docs/reference/plugins/vue.md +0 -33
  204. package/src/docs/docs/reference/plugins/webdriver-io.md +0 -33
  205. package/src/docs/docs/reference/plugins/webpack.md +0 -48
  206. package/src/docs/docs/reference/plugins/wireit.md +0 -33
  207. package/src/docs/docs/reference/plugins/wrangler.md +0 -33
  208. package/src/docs/docs/reference/plugins/xo.md +0 -40
  209. package/src/docs/docs/reference/plugins/yarn.md +0 -33
  210. package/src/docs/docs/reference/plugins/yorkie.md +0 -33
  211. package/src/docs/docs/reference/plugins.md +0 -140
  212. package/src/docs/docs/reference/related-tooling.md +0 -46
  213. package/src/docs/docs/sponsors.mdx +0 -64
  214. package/src/docs/docs/typescript/unused-dependencies.md +0 -86
  215. package/src/docs/docs/typescript/unused-exports.md +0 -87
  216. package/src/docs/docs/writing-a-plugin/argument-parsing.md +0 -202
  217. package/src/docs/docs/writing-a-plugin/index.md +0 -392
  218. package/src/docs/docs/writing-a-plugin/inputs.md +0 -162
  219. package/src/docs/reference/plugins/angular.md +0 -33
  220. package/src/docs/reference/plugins/astro-db.md +0 -34
  221. package/src/docs/reference/plugins/astro.md +0 -43
  222. package/src/docs/reference/plugins/ava.md +0 -46
  223. package/src/docs/reference/plugins/babel.md +0 -38
  224. package/src/docs/reference/plugins/biome.md +0 -34
  225. package/src/docs/reference/plugins/bumpp.md +0 -38
  226. package/src/docs/reference/plugins/bun.md +0 -33
  227. package/src/docs/reference/plugins/c8.md +0 -26
  228. package/src/docs/reference/plugins/capacitor.md +0 -35
  229. package/src/docs/reference/plugins/changelogen.md +0 -38
  230. package/src/docs/reference/plugins/changelogithub.md +0 -38
  231. package/src/docs/reference/plugins/changesets.md +0 -33
  232. package/src/docs/reference/plugins/commitizen.md +0 -35
  233. package/src/docs/reference/plugins/commitlint.md +0 -39
  234. package/src/docs/reference/plugins/convex.md +0 -34
  235. package/src/docs/reference/plugins/create-typescript-app.md +0 -33
  236. package/src/docs/reference/plugins/cspell.md +0 -36
  237. package/src/docs/reference/plugins/cucumber.md +0 -36
  238. package/src/docs/reference/plugins/cypress.md +0 -40
  239. package/src/docs/reference/plugins/danger.md +0 -33
  240. package/src/docs/reference/plugins/dependency-cruiser.md +0 -44
  241. package/src/docs/reference/plugins/docusaurus.md +0 -39
  242. package/src/docs/reference/plugins/dotenv.md +0 -24
  243. package/src/docs/reference/plugins/drizzle.md +0 -33
  244. package/src/docs/reference/plugins/eleventy.md +0 -38
  245. package/src/docs/reference/plugins/eslint.md +0 -74
  246. package/src/docs/reference/plugins/expo.md +0 -38
  247. package/src/docs/reference/plugins/gatsby.md +0 -46
  248. package/src/docs/reference/plugins/github-action.md +0 -33
  249. package/src/docs/reference/plugins/github-actions.md +0 -34
  250. package/src/docs/reference/plugins/glob.md +0 -26
  251. package/src/docs/reference/plugins/graphql-codegen.md +0 -43
  252. package/src/docs/reference/plugins/hardhat.md +0 -33
  253. package/src/docs/reference/plugins/husky.md +0 -37
  254. package/src/docs/reference/plugins/i18next-parser.md +0 -44
  255. package/src/docs/reference/plugins/jest.md +0 -50
  256. package/src/docs/reference/plugins/karma.md +0 -36
  257. package/src/docs/reference/plugins/ladle.md +0 -40
  258. package/src/docs/reference/plugins/lefthook.md +0 -43
  259. package/src/docs/reference/plugins/lint-staged.md +0 -45
  260. package/src/docs/reference/plugins/linthtml.md +0 -38
  261. package/src/docs/reference/plugins/lockfile-lint.md +0 -38
  262. package/src/docs/reference/plugins/lost-pixel.md +0 -33
  263. package/src/docs/reference/plugins/markdownlint.md +0 -34
  264. package/src/docs/reference/plugins/mdx.md +0 -37
  265. package/src/docs/reference/plugins/mdxlint.md +0 -35
  266. package/src/docs/reference/plugins/metro.md +0 -46
  267. package/src/docs/reference/plugins/mocha.md +0 -48
  268. package/src/docs/reference/plugins/moonrepo.md +0 -35
  269. package/src/docs/reference/plugins/msw.md +0 -36
  270. package/src/docs/reference/plugins/nano-staged.md +0 -36
  271. package/src/docs/reference/plugins/nest.md +0 -38
  272. package/src/docs/reference/plugins/netlify.md +0 -42
  273. package/src/docs/reference/plugins/next-intl.md +0 -33
  274. package/src/docs/reference/plugins/next-mdx.md +0 -36
  275. package/src/docs/reference/plugins/next.md +0 -53
  276. package/src/docs/reference/plugins/node-modules-inspector.md +0 -45
  277. package/src/docs/reference/plugins/node.md +0 -48
  278. package/src/docs/reference/plugins/nodemon.md +0 -27
  279. package/src/docs/reference/plugins/npm-package-json-lint.md +0 -38
  280. package/src/docs/reference/plugins/nuxt.md +0 -49
  281. package/src/docs/reference/plugins/nx.md +0 -57
  282. package/src/docs/reference/plugins/nyc.md +0 -36
  283. package/src/docs/reference/plugins/oclif.md +0 -33
  284. package/src/docs/reference/plugins/oxlint.md +0 -44
  285. package/src/docs/reference/plugins/playwright-ct.md +0 -39
  286. package/src/docs/reference/plugins/playwright-test.md +0 -26
  287. package/src/docs/reference/plugins/playwright.md +0 -49
  288. package/src/docs/reference/plugins/plop.md +0 -33
  289. package/src/docs/reference/plugins/pnpm.md +0 -33
  290. package/src/docs/reference/plugins/postcss.md +0 -43
  291. package/src/docs/reference/plugins/preconstruct.md +0 -33
  292. package/src/docs/reference/plugins/prettier.md +0 -36
  293. package/src/docs/reference/plugins/prisma.md +0 -55
  294. package/src/docs/reference/plugins/react-cosmos.md +0 -39
  295. package/src/docs/reference/plugins/react-router.md +0 -34
  296. package/src/docs/reference/plugins/relay.md +0 -52
  297. package/src/docs/reference/plugins/release-it.md +0 -34
  298. package/src/docs/reference/plugins/remark.md +0 -37
  299. package/src/docs/reference/plugins/remix.md +0 -40
  300. package/src/docs/reference/plugins/rollup.md +0 -47
  301. package/src/docs/reference/plugins/rsbuild.md +0 -33
  302. package/src/docs/reference/plugins/rslib.md +0 -33
  303. package/src/docs/reference/plugins/rspack.md +0 -33
  304. package/src/docs/reference/plugins/rstest.md +0 -33
  305. package/src/docs/reference/plugins/semantic-release.md +0 -38
  306. package/src/docs/reference/plugins/sentry.md +0 -35
  307. package/src/docs/reference/plugins/simple-git-hooks.md +0 -35
  308. package/src/docs/reference/plugins/size-limit.md +0 -36
  309. package/src/docs/reference/plugins/sst.md +0 -33
  310. package/src/docs/reference/plugins/starlight.md +0 -33
  311. package/src/docs/reference/plugins/storybook.md +0 -44
  312. package/src/docs/reference/plugins/stryker.md +0 -33
  313. package/src/docs/reference/plugins/stylelint.md +0 -38
  314. package/src/docs/reference/plugins/svelte.md +0 -37
  315. package/src/docs/reference/plugins/svgo.md +0 -37
  316. package/src/docs/reference/plugins/svgr.md +0 -40
  317. package/src/docs/reference/plugins/swc.md +0 -33
  318. package/src/docs/reference/plugins/syncpack.md +0 -38
  319. package/src/docs/reference/plugins/tailwind.md +0 -33
  320. package/src/docs/reference/plugins/taskfile.md +0 -34
  321. package/src/docs/reference/plugins/travis.md +0 -33
  322. package/src/docs/reference/plugins/ts-node.md +0 -27
  323. package/src/docs/reference/plugins/tsdown.md +0 -45
  324. package/src/docs/reference/plugins/tsup.md +0 -45
  325. package/src/docs/reference/plugins/tsx.md +0 -46
  326. package/src/docs/reference/plugins/typedoc.md +0 -49
  327. package/src/docs/reference/plugins/typescript.md +0 -50
  328. package/src/docs/reference/plugins/unbuild.md +0 -33
  329. package/src/docs/reference/plugins/unocss.md +0 -36
  330. package/src/docs/reference/plugins/vercel-og.md +0 -38
  331. package/src/docs/reference/plugins/vike.md +0 -34
  332. package/src/docs/reference/plugins/vite.md +0 -48
  333. package/src/docs/reference/plugins/vitest.md +0 -50
  334. package/src/docs/reference/plugins/vue.md +0 -33
  335. package/src/docs/reference/plugins/webdriver-io.md +0 -33
  336. package/src/docs/reference/plugins/webpack.md +0 -48
  337. package/src/docs/reference/plugins/wireit.md +0 -33
  338. package/src/docs/reference/plugins/wrangler.md +0 -33
  339. package/src/docs/reference/plugins/xo.md +0 -40
  340. package/src/docs/reference/plugins/yarn.md +0 -33
  341. package/src/docs/reference/plugins/yorkie.md +0 -33
  342. /package/src/docs/{docs/reference → reference}/configuration-hints.md +0 -0
  343. /package/src/docs/{docs/reference → reference}/integrations.md +0 -0
@@ -248,7 +248,7 @@ const resolveConfig: ResolveConfig<AstroConfig> = async config => {
248
248
 
249
249
  This is why plugins can implement the `resolveFromAST` function.
250
250
 
251
- ### 7. resolveFromAST
251
+ ### 8. resolveFromAST
252
252
 
253
253
  Let's take a look at the Astro plugin implementation. This example assumes some
254
254
  familiarity with Abstract Syntax Trees (AST) and the TypeScript compiler API.
@@ -317,6 +317,19 @@ const plugin: Plugin {
317
317
  export default plugin;
318
318
  ```
319
319
 
320
+ ## None Of The Above
321
+
322
+ ### 9. `resolve`
323
+
324
+ If there is no configuration file to parse or there is a need for customization,
325
+ use `resolve`:
326
+
327
+ ```ts
328
+ const resolve: Resolve = async options => {
329
+ return toDependency('troublesome', { optional: true });
330
+ };
331
+ ```
332
+
320
333
  ## Inputs
321
334
 
322
335
  You may have noticed functions like `toDeferResolve` and `toEntry`. They're a
@@ -352,7 +365,7 @@ The script adds the plugin to the JSON Schema and type definitions.
352
365
  Run the test for your new plugin using one of the following commands:
353
366
 
354
367
  ```sh
355
- pnpm tsx --test test/plugins/tool.test.ts
368
+ node --test test/plugins/tool.test.ts
356
369
  bun test test/plugins/tool.test.ts
357
370
  ```
358
371
 
@@ -374,6 +387,6 @@ plugin, this might be the right time to open a pull request!
374
387
  [3]: ../explanations/plugins.md#entry-files-from-config-files
375
388
  [4]:
376
389
  https://github.com/webpro-nl/knip/blob/6a6954386b33ee8a2919005230a4bc094e11bc03/knip.json#L12
377
- [5]: ./writing-a-plugin/inputs.md
390
+ [5]: ./inputs.md
378
391
  [6]: ../features/script-parser.md
379
- [7]: ./writing-a-plugin/argument-parsing.md
392
+ [7]: ./argument-parsing.md
package/src/tools.js CHANGED
@@ -46,15 +46,9 @@ export function buildResults(results, options) {
46
46
  * @param {string} cwd
47
47
  */
48
48
  export async function getResults(cwd) {
49
- const originalCwd = process.cwd();
50
- try {
51
- process.chdir(cwd);
52
- const options = await createOptions({ cwd, isSession: true, isUseTscFiles: false });
53
- const session = await createSession(options);
54
- return buildResults(session.getResults(), options);
55
- } finally {
56
- process.chdir(originalCwd);
57
- }
49
+ const options = await createOptions({ cwd, isSession: true, isUseTscFiles: false });
50
+ const session = await createSession(options);
51
+ return buildResults(session.getResults(), options);
58
52
  }
59
53
 
60
54
  /** @param {string} filePath */
@@ -1,30 +0,0 @@
1
- ---
2
- title: A Brief History Of Knip
3
- date: 2023-10-15
4
- sidebar:
5
- order: 7
6
- ---
7
-
8
- _Published: 2023-10-15_
9
-
10
- If you are fond of short lists and brief histories, then this page was written
11
- just for you!
12
-
13
- - 2022-10-04: The [initial commit][1]. Still so tiny at that point, but the seed
14
- was planted. Starting out with finding unused files and exports, the name was
15
- Exportman! 🦸
16
- - 2022-10-09: Big plans and a rename 5 days later, the first published version
17
- of Knip was [v0.1.2][2].
18
- - 2022-11-22: Unused dependencies and support for workspaces and plugins in the
19
- [first alpha of v1][3].
20
- - 2023-01-10: Lots of testing and fixes led to [Knip v1][4].
21
- - 2023-03-22: [Knip v2][5] saw a full rewrite of the TypeScript backend.
22
- - 2023-10-15: [Introduction of Knip v3][6].
23
-
24
- [1]:
25
- https://github.com/webpro-nl/knip/commit/9589dfe22608da7d89f2613383da6db5826226d2
26
- [2]: https://github.com/webpro-nl/knip/tree/0.1.2
27
- [3]: https://github.com/webpro-nl/knip/releases/tag/1.0.0-alpha.0
28
- [4]: https://github.com/webpro-nl/knip/tree/1.0.0
29
- [5]: https://github.com/webpro-nl/knip/issues/73
30
- [6]: ./knip-v3.mdx
@@ -1,131 +0,0 @@
1
- ---
2
- title: Knip for Editors & Agents
3
- date: 2025-12-17
4
- sidebar:
5
- order: 1
6
- ---
7
-
8
- _Published: 2025-12-17_
9
-
10
- Three years in, Knip has found its place in [over 10.000 projects][1] and is
11
- downloaded [over 18M times/month][2]. A long period of steady growth in usage
12
- and stability allows Knip to become more accessible to more people. That's why
13
- I'm excited and proud to introduce the brand new [Editor Extension][3] **and**
14
- MCP Server. For humans and coding agents alike, Knip will help keep your
15
- codebases tidy.
16
-
17
- Don't forget... Knip it before you ship it!
18
-
19
- ## Editor Extension
20
-
21
- This one is for you.
22
-
23
- [The usual suspects][4] like red squiggles for unused exports are there. What
24
- really moves the needle for DX with Knip's module graph is **navigation**. A
25
- completely unique way to view & fly through codebases. Connect the dots during
26
- development and refactors, while keeping things in check. We're starting out
27
- with [3 key features][5]:
28
-
29
- 1. **Hover over Export** for import & usage locations
30
- 2. **Imports Tree View** for direct links to implementations
31
- 3. **Exports Tree View** for direct links to import & usage locations
32
-
33
- The extension has a [built-in MCP Server][6] with a command and resources to
34
- configure Knip for you, _completely automated_.
35
-
36
- Find [Knip on the VS Code Marketplace][7] and find [Knip in the Open VSX
37
- Registry][8].
38
-
39
- ## MCP Server
40
-
41
- Configuring Knip has always been a major headache to many. No more. Tell your
42
- coding agent to "configure knip" and it will RTFM so you don't have to. Using a
43
- newer model like Opus 4.5 or GPT 5.2 results in an optimized `knip.json` file
44
- and an uncluttered codebase.
45
-
46
- The [MCP Server is available][9] separately and built into the VS Code
47
- Extension.
48
-
49
- ## Language Server
50
-
51
- The VS Code Extension and the MCP Server are powered by the new Language Server.
52
- It's a custom server that builds the full module graph of your project, and
53
- provides a session with a graph explorer to request all sorts of interesting
54
- information. Queries like "where is an export imported" or "is this import part
55
- of a circular dependency" are just scratching the surface here.
56
-
57
- Extensions for other IDEs can be built on top. See
58
- [language-server/README.md][10]
59
-
60
- ## Screenshots
61
-
62
- - [Lint Findings][4]
63
- - [Imports & Exports][5]
64
- - [Contention][11]
65
- - [Circular Dependencies][12]
66
- - [Conflicts][13]
67
- - [Branching][14]
68
- - [VS Code Extension Settings][15]
69
-
70
- ### Lint Findings
71
-
72
- ![Lint Findings][16]
73
-
74
- ### Imports & Exports
75
-
76
- ![hover][17]
77
-
78
- ### Contention
79
-
80
- The IDE extension shows extra issues in the tree views like circular
81
- dependencies. We're starting out with some extra novelties like conflicting and
82
- branched/diamond-shaped import chains.
83
-
84
- #### Circular Dependencies
85
-
86
- If an import is part of a circular dependency, Knip will display:
87
-
88
- ![Circular Dependencies][18]
89
-
90
- #### Conflicts
91
-
92
- TypeScript shows direct conflicts when importing or re-exporting the same named
93
- export from different files. Except when the problem is more subtle and the
94
- chain spans more than one file. Knip warns:
95
-
96
- ![Conflicts][19]
97
-
98
- #### Branching
99
-
100
- Branched or diamond-shaped imports chains indicate unnecessary re-exports and
101
- complexity. They help to untangle large codebases and shrink or get rid of
102
- barrel files. Knip warns:
103
-
104
- ![Branching][20]
105
-
106
- ### VS Code Extension Settings
107
-
108
- ![VS Code Extension Settings][21]
109
-
110
- [1]: https://github.com/webpro-nl/knip/network/dependents
111
- [2]: https://www.npmjs.com/package/knip
112
- [3]: #editor-extension
113
- [4]: #lint-findings
114
- [5]: #imports--exports
115
- [6]: #mcp-server
116
- [7]: https://marketplace.visualstudio.com/items?itemName=webpro.vscode-knip
117
- [8]: https://open-vsx.org/extension/webpro/vscode-knip
118
- [9]: https://www.npmjs.com/package/@knip/mcp
119
- [10]:
120
- https://github.com/webpro-nl/knip/blob/main/packages/language-server/README.md
121
- [11]: #contention
122
- [12]: #circular-dependencies
123
- [13]: #conflicts
124
- [14]: #branching
125
- [15]: #vs-code-extension-settings
126
- [16]: /screenshots/editors-and-agents/diagnostics.webp
127
- [17]: /screenshots/editors-and-agents/imports-exports.webp
128
- [18]: /screenshots/editors-and-agents/circular-dependency.webp
129
- [19]: /screenshots/editors-and-agents/conflict.webp
130
- [20]: /screenshots/editors-and-agents/branch.webp
131
- [21]: /screenshots/editors-and-agents/vscode-extension-settings.webp
@@ -1,88 +0,0 @@
1
- ---
2
- title: Announcing Knip v3
3
- date: 2023-10-15
4
- sidebar:
5
- order: 8
6
- ---
7
-
8
- import { Tabs, TabItem } from '@astrojs/starlight/components';
9
-
10
- _Published: 2023-10-15_
11
-
12
- Lots of new users got introduced to Knip, coming with clear bug reports, helpful
13
- insights, superb reproductions and great suggestions this year. You're all a
14
- friendly and helpful bunch! Recently I've opened a Discord channel where more
15
- communication, collaboration, ideas and updates are happening: feel free to join
16
- [The Knip Barn][1]!
17
-
18
- Today, Knip has [over 140k weekly downloads on npm][2], [almost 4000 stars on
19
- GitHub][3], and [over 500 repositories][4] using it. While numbers are just
20
- numbers, they do add to the positive feedback I'm receiving daily. Everything
21
- combined makes me think I'm on the right track which is very motivating to keep
22
- working on Knip.
23
-
24
- ## So... What's Been Cooking Lately?
25
-
26
- - Migration to a monorepo setup
27
- - This very website built with Starlight 🌟
28
- - Extended documentation for just about everything
29
- - Improved JSON reporter for external integrations (e.g. [GitHub Action][5])
30
- - Some breaking changes, but you probably don't need to make any changes
31
-
32
- ## Breaking Changes
33
-
34
- A major bump comes with breaking changes, but most likely no changes necessary
35
- on your end:
36
-
37
- - Removed support for Node.js v16, Knip v3 requires at least Node.js v18.6
38
- - Simplified [exit codes][6]
39
- - [Production mode][7] now includes types by default (add `--exclude types` for
40
- previous behavior)
41
- - Removed `--ignore-internal` flag; [`@internal`][8] exports ignored in
42
- production mode now
43
- - The `--debug-file-filter` flag is removed
44
- - The `jsonExt` reporter is now the default [JSON reporter][9] (the previous one
45
- is gone)
46
- - Moved `typescript` to `peerDependencies` (requires `>=5.0.4`)
47
-
48
- ## Installation
49
-
50
- Try out the latest Knip v3 release today!
51
-
52
- <Tabs syncKey="pm">
53
- <TabItem label="npm">
54
- ```shell
55
- npm install -D knip
56
- ```
57
- </TabItem>
58
-
59
- <TabItem label="pnpm">
60
- ```shell
61
- pnpm add -D knip
62
- ```
63
- </TabItem>
64
-
65
- <TabItem label="bun">
66
- ```shell
67
- bun add -D knip
68
- ```
69
- </TabItem>
70
-
71
- <TabItem label="yarn">
72
- ```shell
73
- yarn add -D knip
74
- ```
75
- </TabItem>
76
- </Tabs>
77
-
78
- Remember, Knip it before you ship it! Have a great day ☀️
79
-
80
- [1]: https://discord.gg/r5uXTtbTpc
81
- [2]: https://www.npmjs.com/package/knip
82
- [3]: https://github.com/webpro-nl/knip/stargazers
83
- [4]: https://github.com/webpro-nl/knip/network/dependents
84
- [5]: https://github.com/marketplace/actions/knip-reporter
85
- [6]: ../reference/cli.md#exit-code
86
- [7]: ../features/production-mode.md
87
- [8]: ../reference/jsdoc-tsdoc-tags.md#internal
88
- [9]: ../features/reporters.md#json
@@ -1,149 +0,0 @@
1
- ---
2
- title: Announcing Knip v4
3
- date: 2024-01-16
4
- sidebar:
5
- order: 5
6
- ---
7
-
8
- import { Tabs, TabItem } from '@astrojs/starlight/components';
9
-
10
- _Published: 2024-01-16_
11
-
12
- I'm happy to announce that Knip v4 is available!
13
-
14
- The work took over a month and the process of [slimming down to speed up][1]
15
- ended up really well: significant faster runs and reduced memory usage. In the
16
- meantime, v3 continued to receive more contributions, plugins and bug fixes.
17
-
18
- ## Highlights
19
-
20
- Compared to v3, here are the highlights:
21
-
22
- - Performance: significant speed bump (up to 80%!)
23
- - Performance: globbing in combo with `.gitignore` is a lot more efficient
24
- - Configuration: [built-in compilers][2] (for Astro, MDX, Svelte & Vue)
25
- - The `ignore` option has been improved
26
- - Internal refactoring to serialize data for future improvements like caching.
27
-
28
- The actual performance win in your projects depends on various factors like size
29
- and complexity.
30
-
31
- ## Major Changes
32
-
33
- The changes have been tested against various repositories, but it's possible
34
- that you will encounter false positives caused by the major refactoring that has
35
- been done. If you do, [please report][3]!
36
-
37
- ### Unused Class Members
38
-
39
- Finding unused class members is no longer enabled by default. Here's why it's
40
- now opt-in:
41
-
42
- - When using Knip for the first time on a large repository it can crash after a
43
- while with an out of memory error. This is a terrible experience.
44
- - Plenty of codebases don't use classes at all, keeping TS programs in memory is
45
- a waste of resources.
46
- - Many configurations already exclude `classMembers` from the output.
47
-
48
- Enable unused class members by using the CLI argument or the configuration
49
- option:
50
-
51
- ```shell
52
- knip --include classMembers
53
- ```
54
-
55
- ```json
56
- {
57
- "include": ["classMembers"]
58
- }
59
- ```
60
-
61
- Now that unused class members is opt-in and better organized within Knip, it
62
- might be interesting to start looking at opt-ins for other unused members, such
63
- as those of types and interfaces.
64
-
65
- By the way, enum members are "cheap" with the v4 refactor, so those are still
66
- included by default.
67
-
68
- ### Compilers
69
-
70
- You can remove the `compilers` option from your configuration. Since you can
71
- override them, your custom compilers can stay where they are. This also means
72
- that you can go back from `knip.ts` to `knip.json` if you prefer.
73
-
74
- ### Ignore Files
75
-
76
- The `ignore` option accepted patterns like `examples/`, but if you want to
77
- ignore the files inside this folder you should update to globs like
78
- `examples/**`.
79
-
80
- ## What's Next?
81
-
82
- The refactoring for this release opens the door to more optimizations, such as
83
- caching. I'm also very excited to see how deeper integrations such as in GitHub
84
- Actions or IDEs like VS Code or WebStorm may further develop.
85
-
86
- Remember, if you are you using Knip at work your company can [sponsor me][4]!
87
-
88
- ## One More Thing...
89
-
90
- An idea I've been toying with is "tagged exports". The idea is that you can tag
91
- exports in a JSDoc comment. The tag does not need to be part of the JSDoc or
92
- TSDoc spec. For example:
93
-
94
- ```ts
95
- /** @custom */
96
- export const myExport = 1;
97
- ```
98
-
99
- Then, include or exclude such tagged exports from the report like so:
100
-
101
- ```shell
102
- knip --experimental-tags=+custom
103
- knip --experimental-tags=-custom,-internal
104
- ```
105
-
106
- This way, you can either focus on or ignore specific tagged exports with tags
107
- you define yourself. This also works for individual class or enum members.
108
-
109
- Once this feature is intuitive and stable, the `experimental` flag will be
110
- removed and option(s) added to the Knip configuration file. The docs are in the
111
- [CLI reference][5].
112
-
113
- ## Let's Go!
114
-
115
- What are you waiting for? Start using Knip v4 today!
116
-
117
- <Tabs syncKey="pm">
118
- <TabItem label="npm">
119
- ```shell
120
- npm install -D knip
121
- ```
122
- </TabItem>
123
-
124
- <TabItem label="pnpm">
125
- ```shell
126
- pnpm add -D knip
127
- ```
128
- </TabItem>
129
-
130
- <TabItem label="bun">
131
- ```shell
132
- bun add -D knip
133
- ```
134
- </TabItem>
135
-
136
- <TabItem label="yarn">
137
- ```shell
138
- yarn add -D knip
139
- ```
140
- </TabItem>
141
- </Tabs>
142
-
143
- Remember, Knip it before you ship it! Have a great day ☀️
144
-
145
- [1]: ./slim-down-to-speed-up.md
146
- [2]: ../features/compilers.md
147
- [3]: ../guides/issue-reproduction.md
148
- [4]: https://github.com/sponsors/webpro
149
- [5]: ../reference/cli.md#--experimental-tags
@@ -1,190 +0,0 @@
1
- ---
2
- title: Announcing Knip v5
3
- date: 2024-02-10
4
- sidebar:
5
- order: 4
6
- ---
7
-
8
- import { Tabs, TabItem } from '@astrojs/starlight/components';
9
-
10
- _Published: 2024-02-10_
11
-
12
- Today brings the smallest major release so far. Tiny yet mighty!
13
-
14
- Below are two cases to demonstrate the change in how unused exports are
15
- reported.
16
-
17
- ## Case 1
18
-
19
- The first case shows two exports with a namespaced import that references one of
20
- those exports explicitly:
21
-
22
- ```ts title="knip.js"
23
- export const version = 'v5';
24
- export const getRocket = () => '🚀';
25
- ```
26
-
27
- ```ts title="index.js"
28
- import * as NS from './knip.js';
29
-
30
- console.log(NS.version);
31
- ```
32
-
33
- In this case we see that `getRocket` is an unused export.
34
-
35
- Previously it would go into the "Unused exports in namespaces" category
36
- (`nsExports`). This issue has been moved to the "Unused exports" category
37
- (`exports`).
38
-
39
- ## Case 2
40
-
41
- The second case is similar, but only the imported namespace itself is
42
- referenced. None of the individual exports is referenced:
43
-
44
- ```ts title="index.js"
45
- import * as NS from './knip.js';
46
- import send from 'stats';
47
-
48
- send(NS);
49
- ```
50
-
51
- Are the `version` and `getRocket` exports used? We can't know. The same is true
52
- for the spread object pattern:
53
-
54
- ```ts title="index.js"
55
- import * as NS from './knip.js';
56
-
57
- const Spread = { ...NS };
58
- ```
59
-
60
- Previously those exports would go into the "Unused exports in namespaces"
61
- category. This is still the case, but this category is no longer enabled by
62
- default.
63
-
64
- ## Include unused exports in namespaces
65
-
66
- To enable this type of issues in Knip v5, add this argument to the command:
67
-
68
- ```shell
69
- knip --include nsExports
70
- ```
71
-
72
- Or in your configuration file:
73
-
74
- ```json title="knip.json"
75
- {
76
- "include": ["nsExports", "nsTypes"]
77
- }
78
- ```
79
-
80
- Now `version` and `getRocket` will be reported as "Unused exports in
81
- namespaces".
82
-
83
- Note that `nsExports` and `nsTypes` are split for more granular control.
84
-
85
- ## Handling exports in namespaced imports
86
-
87
- You have a few options to handle namespaced imports when it comes to unused
88
- exports.
89
-
90
- ### 1. Use named imports
91
-
92
- Regardless of whether `nsExports` is enabled or not, it's often good practice to
93
- replace the namespaced imports with named imports:
94
-
95
- ```ts title="index.js"
96
- import { version, getRocket } from './knip.js';
97
-
98
- send({ version, getRocket });
99
- ```
100
-
101
- Whenever possible, explicit over implicit is often the better choice.
102
-
103
- ### 2. Standardized JSDoc tags
104
-
105
- Using one of the available JSDoc tags like `@public` or `@internal`:
106
-
107
- ```ts title="knip.js"
108
- export const version = 'v5';
109
- /** @public */
110
- export const getRocket = () => '🚀';
111
- ```
112
-
113
- Assuming only imported using a namespace (like in the example cases above), this
114
- will exclude the `getRocket` export from the report, even though it isn't
115
- explicitly referenced.
116
-
117
- ### 3. Arbitrary JSDoc tags
118
-
119
- Another solution is to tag individual exports arbitrarily:
120
-
121
- ```ts title="knip.js"
122
- export const version = 'v5';
123
- /** @launch */
124
- export const getRocket = () => '🚀';
125
- ```
126
-
127
- And then exclude the tag like so:
128
-
129
- ```shell
130
- $ knip --experimental-tags=-launch
131
- Exports in used namespace (1)
132
- version NS unknown knip.js:1:1
133
- ```
134
-
135
- Assuming only imported using a namespace (like in the example cases above), this
136
- will exclude the `getRocket` export from the report, even though it isn't
137
- explicitly referenced.
138
-
139
- ## A better default
140
-
141
- I believe this behavior in v5 is the better default: have all exports you want
142
- to know about in a single category, and those you probably want to ignore in
143
- another that's disabled by default.
144
-
145
- Before the [v4 refactoring][1], this would be a lot harder to implement. That
146
- refactoring turns out to be a better investment than expected. Combined with a
147
- better understanding of how people write code and use Knip, this change is a
148
- natural iteration.
149
-
150
- Why the major bump? It's not breaking for the large majority of users, but for
151
- some it may be breaking. For instance when relying on the [JSON reporter][2],
152
- other reporter output, or custom [preprocessing][3]. It's not a bug fix, it's
153
- not a new feature, but since semver is all about setting expectations I feel the
154
- change is large enough to warrant a major bump.
155
-
156
- ## Let's Go!
157
-
158
- What are you waiting for? Start using Knip v5 today!
159
-
160
- <Tabs syncKey="pm">
161
- <TabItem label="npm">
162
- ```shell
163
- npm install -D knip
164
- ```
165
- </TabItem>
166
-
167
- <TabItem label="pnpm">
168
- ```shell
169
- pnpm add -D knip
170
- ```
171
- </TabItem>
172
-
173
- <TabItem label="bun">
174
- ```shell
175
- bun add -D knip
176
- ```
177
- </TabItem>
178
-
179
- <TabItem label="yarn">
180
- ```shell
181
- yarn add -D knip
182
- ```
183
- </TabItem>
184
- </Tabs>
185
-
186
- Remember, Knip it before you ship it! Have a great day ☀️
187
-
188
- [1]: ../blog/slim-down-to-speed-up.md
189
- [2]: ../features/reporters.md#json
190
- [3]: ../features/reporters.md#preprocessors