@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
@@ -1,149 +0,0 @@
1
- ---
2
- title: Monorepos & Workspaces
3
- sidebar:
4
- order: 2
5
- ---
6
-
7
- Workspaces are handled out-of-the-box by Knip.
8
-
9
- Workspaces are sometimes also referred to as package-based monorepos, or as
10
- packages in a monorepo. Knip uses the term workspace exclusively to indicate a
11
- directory that has a `package.json`.
12
-
13
- ## Configuration
14
-
15
- Here's example configuration with custom `entry` and `project` patterns:
16
-
17
- ```json title="knip.json"
18
- {
19
- "workspaces": {
20
- ".": {
21
- "entry": "scripts/*.js",
22
- "project": "scripts/**/*.js"
23
- },
24
- "packages/*": {
25
- "entry": "{index,cli}.ts",
26
- "project": "**/*.ts"
27
- },
28
- "packages/cli": {
29
- "entry": "bin/cli.js"
30
- }
31
- }
32
- }
33
- ```
34
-
35
- :::tip
36
-
37
- Run Knip without any configuration to see if and where custom `entry` and/or
38
- `project` files are necessary per workspace.
39
-
40
- :::
41
-
42
- Each workspace has the same [default configuration][1].
43
-
44
- The root workspace is named `"."` under `workspaces` (like in the example
45
- above).
46
-
47
- :::caution
48
-
49
- In a project with workspaces, the `entry` and `project` options at the root
50
- level are ignored. Use the workspace named `"."` for those (like in the example
51
- above).
52
-
53
- :::
54
-
55
- ## Workspaces
56
-
57
- Knip reads workspaces from four possible locations:
58
-
59
- 1. The `workspaces` array in `package.json` (npm, Bun, Yarn, Lerna)
60
- 2. The `packages` array in `pnpm-workspace.yaml` (pnpm)
61
- 3. The `workspaces.packages` array in `package.json` (legacy)
62
- 4. The `workspaces` object in Knip configuration
63
-
64
- The `workspaces` in Knip configuration (4) not already defined in the root
65
- `package.json` or `pnpm-workspace.yaml` (1, 2, 3) are added to the analysis.
66
-
67
- :::caution
68
-
69
- A workspace must have a `package.json` file.
70
-
71
- :::
72
-
73
- For projects with only a root `package.json`, please see [integrated
74
- monorepos][2].
75
-
76
- ## Additional workspaces
77
-
78
- If a workspaces is not configured as such in `package.json#workspaces` (or
79
- `pnpm-workspace.yaml`) it can be added to the Knip configuration manually. Add
80
- their path to the `workspaces` configuration object the same way as
81
- `"packages/cli": {}` in the example above.
82
-
83
- ## Source mapping
84
-
85
- See [Source Mapping][3].
86
-
87
- ## Additional options
88
-
89
- The following options are available inside workspace configurations:
90
-
91
- - [ignore][4]
92
- - [ignoreBinaries][5]
93
- - [ignoreDependencies][6]
94
- - [ignoreMembers][7]
95
- - [ignoreUnresolved][8]
96
- - [includeEntryExports][9]
97
-
98
- [Plugins][10] can be configured separately per workspace.
99
-
100
- Use `--debug` for verbose output and see the workspaces Knip includes, their
101
- configurations, enabled plugins, glob options and resolved files.
102
-
103
- ## Filter workspaces
104
-
105
- Use the `--workspace` (or `-W`) argument to select one or more workspaces:
106
-
107
- ```sh
108
- knip --workspace packages/my-lib
109
- ```
110
-
111
- The filter supports multiple formats:
112
-
113
- ```sh
114
- knip --workspace @myorg/my-lib # Package name
115
- knip --workspace '@myorg/*' # Package name glob
116
- knip --workspace packages/my-lib # Directory path
117
- knip --workspace './apps/*' # Directory glob
118
- ```
119
-
120
- Combine selectors to include or exclude workspaces:
121
-
122
- ```sh
123
- knip --workspace @myorg/* --workspace '!@myorg/legacy'
124
- knip --workspace './apps/*' --workspace '@shared/utils'
125
- ```
126
-
127
- This will include the target workspace(s), but also ancestor and dependent
128
- workspaces. For two reasons:
129
-
130
- - Ancestor workspaces may list dependencies in `package.json` the linted
131
- workspace uses.
132
- - Dependent workspaces may reference exports from the linted workspace.
133
-
134
- To lint the workspace in isolation, there are two options:
135
-
136
- - Combine the `workspace` argument with [strict production mode][11].
137
- - Run Knip from inside the workspace directory.
138
-
139
- [1]: ../overview/configuration.md#defaults
140
- [2]: ./integrated-monorepos.md
141
- [3]: ./source-mapping.md
142
- [4]: ../reference/configuration.md#ignore
143
- [5]: ../reference/configuration.md#ignorebinaries
144
- [6]: ../reference/configuration.md#ignoredependencies
145
- [7]: ../reference/configuration.md#ignoremembers
146
- [8]: ../reference/configuration.md#ignoreunresolved
147
- [9]: ../reference/configuration.md#includeentryexports
148
- [10]: ../reference/configuration.md#plugins
149
- [11]: ./production-mode.md#strict-mode
@@ -1,95 +0,0 @@
1
- ---
2
- title: Production Mode
3
- sidebar:
4
- order: 1
5
- ---
6
-
7
- The default mode for Knip is comprehensive and targets all project code,
8
- including configuration files, test files, Storybook stories, and so on. Test
9
- files usually import production files. This prevents production files or their
10
- exports from being reported as unused, while sometimes both of them can be
11
- deleted. Knip features a "production mode" to focus only on the code that you
12
- ship.
13
-
14
- ## Configuration
15
-
16
- To tell Knip what is production code, add an exclamation mark behind each
17
- `pattern!` that represents production code:
18
-
19
- ```json title="knip.json"
20
- {
21
- "entry": ["src/index.ts!", "build/script.js"],
22
- "project": ["src/**/*.ts!", "build/*.js"]
23
- }
24
- ```
25
-
26
- Depending on file structure and enabled plugins, you might not need to modify
27
- your configuration at all.
28
-
29
- Run Knip with the `--production` flag:
30
-
31
- ```sh
32
- knip --production
33
- ```
34
-
35
- Here's what's included in production mode:
36
-
37
- - Only `entry` and `project` patterns suffixed with `!`
38
- - Only production `entry` file patterns exported by plugins (such as Next.js and
39
- Remix)
40
- - Only the `start` script (of `package.json#scripts`)
41
- - Ignore exports with the [`@internal` tag][1]
42
-
43
- :::note
44
-
45
- The production run does not replace the default run. Depending on your needs you
46
- can run either of them or both separately. Usually both modes can share the same
47
- configuration.
48
-
49
- :::
50
-
51
- To see the difference between default and production mode in great detail, use
52
- the `--debug` flag and inspect what entry and project files are used, and the
53
- plugins that are enabled. For instance, in production mode this shows that files
54
- such as tests and Storybook files (stories) are excluded from the analysis.
55
-
56
- In case files like mocks and test helpers are reported as unused files, use
57
- negated patterns to exclude those files in production mode:
58
-
59
- ```json title="knip.json"
60
- {
61
- "entry": ["src/index.ts!"],
62
- "project": ["src/**/*.ts!", "!src/test-helpers/**!"]
63
- }
64
- ```
65
-
66
- Also see [configuring project files][2] to align `entry` and `project` with
67
- production mode.
68
-
69
- ## Strict Mode
70
-
71
- In production mode, only `dependencies` (not `devDependencies`) are considered
72
- when finding unused or unlisted dependencies.
73
-
74
- Additionally, the `--strict` flag can be added to:
75
-
76
- - Verify isolation: workspaces should use strictly their own `dependencies`
77
- - Include `peerDependencies` when finding unused or unlisted dependencies
78
- - Report type-only imports listed in `dependencies`
79
-
80
- ```sh
81
- knip --production --strict
82
- ```
83
-
84
- Using `--strict` implies `--production`, so the latter can be omitted.
85
-
86
- ## Types
87
-
88
- Add `--exclude types` if you don't want to include types in the report:
89
-
90
- ```sh
91
- knip --production --exclude types
92
- ```
93
-
94
- [1]: ../reference/jsdoc-tsdoc-tags.md#internal
95
- [2]: ../guides/configuring-project-files.md
@@ -1,304 +0,0 @@
1
- ---
2
- title: Reporters & Preprocessors
3
- ---
4
-
5
- ## Built-in Reporters
6
-
7
- Knip provides the following built-in reporters:
8
-
9
- - `codeowners`
10
- - `compact`
11
- - [`disclosure`][1]
12
- - [`github-actions`][2]
13
- - [`json`][3]
14
- - [`markdown`][4]
15
- - [`codeclimate`][5]
16
- - `symbols` (default)
17
-
18
- Example usage:
19
-
20
- ```sh
21
- knip --reporter compact
22
- ```
23
-
24
- ### JSON
25
-
26
- The built-in `json` reporter output is meant to be consumed by other tools. It
27
- reports in JSON format with unused `files` and `issues` as an array with one
28
- object per file structured like this:
29
-
30
- ```json
31
- {
32
- "files": ["src/unused.ts"],
33
- "issues": [
34
- {
35
- "file": "package.json",
36
- "owners": ["@org/admin"],
37
- "dependencies": [{ "name": "jquery", "line": 5, "col": 6, "pos": 71 }],
38
- "devDependencies": [{ "name": "lodash", "line": 9, "col": 6, "pos": 99 }],
39
- "unlisted": [{ "name": "react" }, { "name": "@org/unresolved" }],
40
- "exports": [],
41
- "types": [],
42
- "duplicates": []
43
- },
44
- {
45
- "file": "src/Registration.tsx",
46
- "owners": ["@org/owner"],
47
- "dependencies": [],
48
- "devDependencies": [],
49
- "binaries": [],
50
- "unresolved": [
51
- { "name": "./unresolved", "line": 8, "col": 23, "pos": 407 }
52
- ],
53
- "exports": [{ "name": "unusedExport", "line": 1, "col": 14, "pos": 13 }],
54
- "types": [
55
- { "name": "unusedEnum", "line": 3, "col": 13, "pos": 71 },
56
- { "name": "unusedType", "line": 8, "col": 14, "pos": 145 }
57
- ],
58
- "enumMembers": {
59
- "MyEnum": [
60
- { "name": "unusedMember", "line": 13, "col": 3, "pos": 167 },
61
- { "name": "unusedKey", "line": 15, "col": 3, "pos": 205 }
62
- ]
63
- },
64
- "classMembers": {
65
- "MyClass": [
66
- { "name": "unusedMember", "line": 40, "col": 3, "pos": 687 },
67
- { "name": "unusedSetter", "line": 61, "col": 14, "pos": 1071 }
68
- ]
69
- },
70
- "duplicates": ["Registration", "default"]
71
- }
72
- ]
73
- }
74
- ```
75
-
76
- The keys match the [reported issue types][6]. Example usage:
77
-
78
- ```sh
79
- knip --reporter json
80
- ```
81
-
82
- ### GitHub Actions
83
-
84
- Use the GitHub Actions reporter in a workflow for annotations in pull requests.
85
- Example usage:
86
-
87
- ```sh
88
- knip --reporter github-actions
89
- ```
90
-
91
- Changed files in pull requests will now contain inline annotations for lint
92
- findings.
93
-
94
- ### Markdown
95
-
96
- The built-in `markdown` reporter output is meant to be saved to a Markdown file.
97
- This allows following the changes in issues over time. It reports issues in
98
- Markdown tables separated by issue types as headings, for example:
99
-
100
- ```md
101
- # Knip report
102
-
103
- ## Unused files (1)
104
-
105
- - src/unused.ts
106
-
107
- ## Unlisted dependencies (2)
108
-
109
- | Name | Location | Severity |
110
- | :-------------- | :---------------- | :------- |
111
- | unresolved | src/index.ts:8:23 | error |
112
- | @org/unresolved | src/index.ts:9:23 | error |
113
-
114
- ## Unresolved imports (1)
115
-
116
- | Name | Location | Severity |
117
- | :----------- | :----------------- | :------- |
118
- | ./unresolved | src/index.ts:10:12 | error |
119
- ```
120
-
121
- ### Disclosure
122
-
123
- This reporter is useful for sharing large reports. Groups of issues are rendered
124
- in a closed state initially. The reporter renders this:
125
-
126
- ````text
127
- $ knip --reporter disclosure
128
-
129
- <details>
130
- <summary>Unused files (2)</summary>
131
-
132
- ```
133
- unused.ts
134
- dangling.js
135
- ```
136
-
137
- </details>
138
-
139
- <details>
140
- <summary>Unused dependencies (2)</summary>
141
-
142
- ```
143
- my-package package.json:17:5
144
- unused-dep package.json:20:5
145
- ```
146
-
147
- </details>
148
- ````
149
-
150
- The above can be copy-pasted where HTML and Markdown is supported, such as a
151
- GitHub issue or pull request, and renders like so:
152
-
153
- <details>
154
- <summary>Unused files (2)</summary>
155
-
156
- ```
157
- unused.ts
158
- dangling.js
159
- ```
160
-
161
- </details>
162
-
163
- <details>
164
- <summary>Unused dependencies (2)</summary>
165
-
166
- ```
167
- my-package package.json:17:5
168
- unused-dep package.json:20:5
169
- ```
170
-
171
- </details>
172
-
173
- ### CodeClimate
174
-
175
- The built-in `codeclimate` reporter generates output in the Code Climate Report
176
- JSON format. Example usage:
177
-
178
- ```text
179
- $ knip --reporter codeclimate
180
-
181
- [
182
- {
183
- "type": "issue",
184
- "check_name": "Unused exports",
185
- "description": "isUnused",
186
- "categories": ["Bug Risk"],
187
- "location": {
188
- "path": "path/to/file.ts",
189
- "positions": {
190
- "begin": {
191
- "line": 6,
192
- "column": 1
193
- }
194
- }
195
- }
196
- "severity": "major",
197
- "fingerprint": "e9789995c1fe9f7d75eed6a0c0f89e84",
198
- }
199
- ]
200
- ```
201
-
202
- ## Custom Reporters
203
-
204
- When the provided built-in reporters are not sufficient, a custom local reporter
205
- can be implemented or an external reporter can be used. Multiple reporters can
206
- be used at once by repeating the `--reporter` argument.
207
-
208
- The results are passed to the function from its default export and can be used
209
- to write issues to `stdout`, a JSON or CSV file, or sent to a service. It
210
- supports a local JavaScript or TypeScript file or an external dependency.
211
-
212
- ### Local
213
-
214
- The default export of the reporter should be a function with this interface:
215
-
216
- ```ts
217
- type Reporter = async (options: ReporterOptions): void;
218
-
219
- type ReporterOptions = {
220
- report: Report;
221
- issues: Issues;
222
- counters: Counters;
223
- configurationHints: ConfigurationHints;
224
- isDisableConfigHints: boolean;
225
- isTreatConfigHintsAsErrors: boolean;
226
- cwd: string;
227
- isProduction: boolean;
228
- isShowProgress: boolean;
229
- options: string;
230
- };
231
- ```
232
-
233
- The data can then be used to write issues to `stdout`, a JSON or CSV file, or
234
- sent to a service.
235
-
236
- Here's a most minimal reporter example:
237
-
238
- ```ts title="./my-reporter.ts"
239
- import type { Reporter } from 'knip';
240
-
241
- const reporter: Reporter = function (options) {
242
- console.log(options.issues);
243
- console.log(options.counters);
244
- };
245
-
246
- export default reporter;
247
- ```
248
-
249
- Example usage:
250
-
251
- ```sh
252
- knip --reporter ./my-reporter.ts
253
- ```
254
-
255
- ### External
256
-
257
- Pass `--reporter [pkg-name]` to use an external reporter. The default exported
258
- function of the `main` script (default: `index.js`) will be invoked with the
259
- `ReporterOptions`, just like a local reporter.
260
-
261
- ## Preprocessors
262
-
263
- A preprocessor is a function that runs after the analysis is finished. It
264
- receives the results from the analysis and should return data in the same
265
- shape/structure (unless you pass it to only your own reporter).
266
-
267
- The data goes through the preprocessors before the final data is passed to the
268
- reporters. There are no built-in preprocessors. Just like reporters, use e.g.
269
- `--preprocessor ./my-preprocessor` from the command line (can be repeated).
270
-
271
- The default export of the preprocessor should be a function with this interface:
272
-
273
- ```ts
274
- type Preprocessor = async (options: ReporterOptions) => ReporterOptions;
275
- ```
276
-
277
- Like reporters, you can use local JavaScript or TypeScript files and external
278
- npm packages as preprocessors.
279
-
280
- Example preprocessor:
281
-
282
- ```ts title="./preprocess.ts"
283
- import type { Preprocessor } from 'knip';
284
-
285
- const preprocess: Preprocessor = function (options) {
286
- // modify options.issues and options.counters
287
- return options;
288
- };
289
-
290
- export default preprocess;
291
- ```
292
-
293
- Example usage:
294
-
295
- ```sh
296
- knip --preprocessor ./preprocess.ts
297
- ```
298
-
299
- [1]: #disclosure
300
- [2]: #github-actions
301
- [3]: #json
302
- [4]: #markdown
303
- [5]: #codeclimate
304
- [6]: ../reference/issue-types.md
@@ -1,102 +0,0 @@
1
- ---
2
- title: Rules & Filters
3
- sidebar:
4
- order: 5
5
- ---
6
-
7
- Use rules or filters to customize Knip's output. This has various use cases, a
8
- few examples:
9
-
10
- - Temporarily focus on a specific issue type.
11
- - You don't want to see unused `type`, `interface` and `enum` exports reported.
12
- - Specific issue types should be printed, but not counted against the total
13
- error count.
14
-
15
- If you're looking to handle one-off exceptions, also see [JSDoc tags][1].
16
-
17
- ## Filters
18
-
19
- You can `--include` or `--exclude` any of the reported issue types to slice &
20
- dice the report to your needs. Alternatively, they can be added to the
21
- configuration (e.g. `"exclude": ["dependencies"]`).
22
-
23
- Use `--include` to report only specific issue types. The following example
24
- commands do the same:
25
-
26
- ```sh
27
- knip --include files --include dependencies
28
- knip --include files,dependencies
29
- ```
30
-
31
- Or the other way around, use `--exclude` to ignore the types you're not
32
- interested in:
33
-
34
- ```sh
35
- knip --include files --exclude enumMembers,duplicates
36
- ```
37
-
38
- Also see the [list of issue types][2].
39
-
40
- ### Shorthands
41
-
42
- Knip has shortcuts to include only specific issue types.
43
-
44
- 1. The `--dependencies` flag includes:
45
- - `dependencies` (and `devDependencies` + `optionalPeerDependencies`)
46
- - `unlisted`
47
- - `binaries`
48
- - `unresolved`
49
- - `catalog`
50
-
51
- 2. The `--exports` flag includes:
52
- - `exports`
53
- - `types`
54
- - `enumMembers`
55
- - `duplicates`
56
-
57
- 3. The `--files` flag is a shortcut for `--include files`
58
-
59
- ## Rules
60
-
61
- Use `rules` in the configuration to customize the issue types that count towards
62
- the total error count, or to exclude them altogether.
63
-
64
- | Value | Default | Printed | Counted | Description |
65
- | :-------- | :-----: | :-----: | :-----: | :-------------------------------- |
66
- | `"error"` | ✓ | ✓ | ✓ | Similar to the `--include` filter |
67
- | `"warn"` | - | ✓ | - | Printed in faded/gray color |
68
- | `"off"` | - | - | - | Similar to the `--exclude` filter |
69
-
70
- Example:
71
-
72
- ```json title="knip.json"
73
- {
74
- "rules": {
75
- "files": "warn",
76
- "classMembers": "off",
77
- "duplicates": "off"
78
- }
79
- }
80
- ```
81
-
82
- Also see the [issue types overview][2].
83
-
84
- NOTE: If the `dependencies` issue type is included, the `devDependencies` and
85
- `optionalPeerDependencies` types can still be set to `"warn"` separately.
86
-
87
- The rules are modeled after the ESLint `rules` configuration, and could be
88
- extended in the future.
89
-
90
- ## Rules or filters?
91
-
92
- Filters are meant to be used as command-line flags, rules allow for more
93
- fine-grained configuration.
94
-
95
- - Rules are more fine-grained since they also have "warn".
96
- - Rules could be extended in the future.
97
- - Filters can be set in configuration and from CLI (rules only in
98
- configuration).
99
- - Filters have shorthands (rules don't have this).
100
-
101
- [1]: ../reference/jsdoc-tsdoc-tags.md
102
- [2]: ../reference/issue-types.md