@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.
- package/package.json +17 -17
- package/src/docs/blog/for-editors-and-agents.md +47 -43
- package/src/docs/blog/knip-v3.mdx +1 -1
- package/src/docs/blog/knip-v4.mdx +2 -2
- package/src/docs/blog/two-years.mdx +1 -1
- package/src/docs/explanations/comparison-and-migration.md +4 -0
- package/src/docs/explanations/plugins.md +38 -10
- package/src/docs/features/auto-fix.mdx +22 -7
- package/src/docs/features/monorepos-and-workspaces.md +19 -4
- package/src/docs/features/production-mode.md +1 -1
- package/src/docs/features/reporters.md +9 -7
- package/src/docs/guides/configuring-project-files.md +13 -13
- package/src/docs/guides/contributing.md +1 -1
- package/src/docs/guides/handling-issues.mdx +183 -121
- package/src/docs/guides/issue-reproduction.md +21 -12
- package/src/docs/guides/performance.md +19 -8
- package/src/docs/guides/troubleshooting.md +7 -10
- package/src/docs/guides/using-knip-in-ci.md +16 -20
- package/src/docs/index.mdx +3 -3
- package/src/docs/overview/configuration.md +6 -6
- package/src/docs/overview/features.md +5 -5
- package/src/docs/overview/getting-started.mdx +15 -5
- package/src/docs/reference/cli.md +269 -243
- package/src/docs/reference/configuration.md +24 -7
- package/src/docs/reference/faq.md +111 -59
- package/src/docs/reference/jsdoc-tsdoc-tags.md +12 -1
- package/src/docs/reference/known-issues.md +43 -21
- package/src/docs/reference/plugins.md +15 -1
- package/src/docs/reference/related-tooling.md +3 -3
- package/src/docs/sponsors.mdx +3 -4
- package/src/docs/typescript/unused-exports.md +1 -1
- package/src/docs/writing-a-plugin/index.md +17 -4
- package/src/tools.js +3 -9
- package/src/docs/docs/blog/brief-history.md +0 -30
- package/src/docs/docs/blog/for-editors-and-agents.md +0 -131
- package/src/docs/docs/blog/knip-v3.mdx +0 -88
- package/src/docs/docs/blog/knip-v4.mdx +0 -149
- package/src/docs/docs/blog/knip-v5.mdx +0 -190
- package/src/docs/docs/blog/migration-to-v1.md +0 -65
- package/src/docs/docs/blog/release-notes-v2.md +0 -46
- package/src/docs/docs/blog/slim-down-to-speed-up.md +0 -269
- package/src/docs/docs/blog/state-of-knip.md +0 -191
- package/src/docs/docs/blog/two-years.mdx +0 -107
- package/src/docs/docs/explanations/comparison-and-migration.md +0 -129
- package/src/docs/docs/explanations/entry-files.md +0 -70
- package/src/docs/docs/explanations/plugins.md +0 -329
- package/src/docs/docs/explanations/why-use-knip.md +0 -128
- package/src/docs/docs/features/auto-fix.mdx +0 -348
- package/src/docs/docs/features/compilers.md +0 -172
- package/src/docs/docs/features/integrated-monorepos.md +0 -61
- package/src/docs/docs/features/monorepos-and-workspaces.md +0 -149
- package/src/docs/docs/features/production-mode.md +0 -95
- package/src/docs/docs/features/reporters.md +0 -304
- package/src/docs/docs/features/rules-and-filters.md +0 -102
- package/src/docs/docs/features/script-parser.md +0 -156
- package/src/docs/docs/features/source-mapping.md +0 -100
- package/src/docs/docs/guides/configuring-project-files.md +0 -205
- package/src/docs/docs/guides/contributing.md +0 -24
- package/src/docs/docs/guides/handling-issues.mdx +0 -708
- package/src/docs/docs/guides/issue-reproduction.md +0 -102
- package/src/docs/docs/guides/namespace-imports.md +0 -125
- package/src/docs/docs/guides/performance.md +0 -108
- package/src/docs/docs/guides/troubleshooting.md +0 -133
- package/src/docs/docs/guides/using-knip-in-ci.md +0 -50
- package/src/docs/docs/guides/working-with-commonjs.md +0 -72
- package/src/docs/docs/index.mdx +0 -160
- package/src/docs/docs/overview/configuration.md +0 -104
- package/src/docs/docs/overview/features.md +0 -66
- package/src/docs/docs/overview/getting-started.mdx +0 -205
- package/src/docs/docs/overview/screenshots-videos.md +0 -42
- package/src/docs/docs/playground.mdx +0 -38
- package/src/docs/docs/reference/cli.md +0 -511
- package/src/docs/docs/reference/configuration.md +0 -430
- package/src/docs/docs/reference/dynamic-configuration.mdx +0 -72
- package/src/docs/docs/reference/faq.md +0 -432
- package/src/docs/docs/reference/issue-types.md +0 -43
- package/src/docs/docs/reference/jsdoc-tsdoc-tags.md +0 -122
- package/src/docs/docs/reference/known-issues.md +0 -86
- package/src/docs/docs/reference/plugins/.gitkeep +0 -0
- package/src/docs/docs/reference/plugins/angular.md +0 -33
- package/src/docs/docs/reference/plugins/astro-db.md +0 -34
- package/src/docs/docs/reference/plugins/astro-og-canvas.md +0 -13
- package/src/docs/docs/reference/plugins/astro.md +0 -43
- package/src/docs/docs/reference/plugins/ava.md +0 -46
- package/src/docs/docs/reference/plugins/babel.md +0 -38
- package/src/docs/docs/reference/plugins/biome.md +0 -34
- package/src/docs/docs/reference/plugins/bumpp.md +0 -38
- package/src/docs/docs/reference/plugins/bun.md +0 -13
- package/src/docs/docs/reference/plugins/c8.md +0 -26
- package/src/docs/docs/reference/plugins/capacitor.md +0 -35
- package/src/docs/docs/reference/plugins/changelogen.md +0 -38
- package/src/docs/docs/reference/plugins/changelogithub.md +0 -38
- package/src/docs/docs/reference/plugins/changesets.md +0 -33
- package/src/docs/docs/reference/plugins/commitizen.md +0 -35
- package/src/docs/docs/reference/plugins/commitlint.md +0 -39
- package/src/docs/docs/reference/plugins/convex.md +0 -34
- package/src/docs/docs/reference/plugins/create-typescript-app.md +0 -33
- package/src/docs/docs/reference/plugins/cspell.md +0 -36
- package/src/docs/docs/reference/plugins/cucumber.md +0 -36
- package/src/docs/docs/reference/plugins/cypress.md +0 -40
- package/src/docs/docs/reference/plugins/danger.md +0 -33
- package/src/docs/docs/reference/plugins/dependency-cruiser.md +0 -44
- package/src/docs/docs/reference/plugins/docusaurus.md +0 -39
- package/src/docs/docs/reference/plugins/dotenv.md +0 -24
- package/src/docs/docs/reference/plugins/drizzle.md +0 -33
- package/src/docs/docs/reference/plugins/eleventy.md +0 -38
- package/src/docs/docs/reference/plugins/eslint.md +0 -74
- package/src/docs/docs/reference/plugins/expo.md +0 -38
- package/src/docs/docs/reference/plugins/expressive-code.md +0 -39
- package/src/docs/docs/reference/plugins/gatsby.md +0 -46
- package/src/docs/docs/reference/plugins/github-action.md +0 -33
- package/src/docs/docs/reference/plugins/github-actions.md +0 -34
- package/src/docs/docs/reference/plugins/glob.md +0 -26
- package/src/docs/docs/reference/plugins/graphql-codegen.md +0 -43
- package/src/docs/docs/reference/plugins/hardhat.md +0 -33
- package/src/docs/docs/reference/plugins/husky.md +0 -37
- package/src/docs/docs/reference/plugins/i18next-parser.md +0 -44
- package/src/docs/docs/reference/plugins/jest.md +0 -50
- package/src/docs/docs/reference/plugins/karma.md +0 -36
- package/src/docs/docs/reference/plugins/knex.md +0 -33
- package/src/docs/docs/reference/plugins/ladle.md +0 -40
- package/src/docs/docs/reference/plugins/lefthook.md +0 -43
- package/src/docs/docs/reference/plugins/lint-staged.md +0 -45
- package/src/docs/docs/reference/plugins/linthtml.md +0 -38
- package/src/docs/docs/reference/plugins/lockfile-lint.md +0 -38
- package/src/docs/docs/reference/plugins/lost-pixel.md +0 -33
- package/src/docs/docs/reference/plugins/markdownlint.md +0 -34
- package/src/docs/docs/reference/plugins/mdx.md +0 -37
- package/src/docs/docs/reference/plugins/mdxlint.md +0 -35
- package/src/docs/docs/reference/plugins/metro.md +0 -46
- package/src/docs/docs/reference/plugins/mocha.md +0 -48
- package/src/docs/docs/reference/plugins/moonrepo.md +0 -35
- package/src/docs/docs/reference/plugins/msw.md +0 -36
- package/src/docs/docs/reference/plugins/nano-staged.md +0 -36
- package/src/docs/docs/reference/plugins/nest.md +0 -38
- package/src/docs/docs/reference/plugins/netlify.md +0 -42
- package/src/docs/docs/reference/plugins/next-intl.md +0 -33
- package/src/docs/docs/reference/plugins/next-mdx.md +0 -36
- package/src/docs/docs/reference/plugins/next.md +0 -53
- package/src/docs/docs/reference/plugins/nitro.md +0 -50
- package/src/docs/docs/reference/plugins/node-modules-inspector.md +0 -45
- package/src/docs/docs/reference/plugins/node.md +0 -48
- package/src/docs/docs/reference/plugins/nodemon.md +0 -27
- package/src/docs/docs/reference/plugins/npm-package-json-lint.md +0 -38
- package/src/docs/docs/reference/plugins/nuxt.md +0 -49
- package/src/docs/docs/reference/plugins/nx.md +0 -57
- package/src/docs/docs/reference/plugins/nyc.md +0 -36
- package/src/docs/docs/reference/plugins/oclif.md +0 -33
- package/src/docs/docs/reference/plugins/oxlint.md +0 -44
- package/src/docs/docs/reference/plugins/parcel.md +0 -37
- package/src/docs/docs/reference/plugins/playwright-ct.md +0 -39
- package/src/docs/docs/reference/plugins/playwright-test.md +0 -26
- package/src/docs/docs/reference/plugins/playwright.md +0 -49
- package/src/docs/docs/reference/plugins/plop.md +0 -33
- package/src/docs/docs/reference/plugins/pnpm.md +0 -33
- package/src/docs/docs/reference/plugins/postcss.md +0 -43
- package/src/docs/docs/reference/plugins/preconstruct.md +0 -33
- package/src/docs/docs/reference/plugins/prettier.md +0 -36
- package/src/docs/docs/reference/plugins/prisma.md +0 -55
- package/src/docs/docs/reference/plugins/react-cosmos.md +0 -39
- package/src/docs/docs/reference/plugins/react-router.md +0 -34
- package/src/docs/docs/reference/plugins/relay.md +0 -52
- package/src/docs/docs/reference/plugins/release-it.md +0 -34
- package/src/docs/docs/reference/plugins/remark.md +0 -37
- package/src/docs/docs/reference/plugins/remix.md +0 -40
- package/src/docs/docs/reference/plugins/rollup.md +0 -47
- package/src/docs/docs/reference/plugins/rsbuild.md +0 -33
- package/src/docs/docs/reference/plugins/rslib.md +0 -33
- package/src/docs/docs/reference/plugins/rspack.md +0 -33
- package/src/docs/docs/reference/plugins/rstest.md +0 -33
- package/src/docs/docs/reference/plugins/semantic-release.md +0 -38
- package/src/docs/docs/reference/plugins/sentry.md +0 -35
- package/src/docs/docs/reference/plugins/simple-git-hooks.md +0 -35
- package/src/docs/docs/reference/plugins/size-limit.md +0 -35
- package/src/docs/docs/reference/plugins/sst.md +0 -33
- package/src/docs/docs/reference/plugins/starlight.md +0 -33
- package/src/docs/docs/reference/plugins/storybook.md +0 -44
- package/src/docs/docs/reference/plugins/stryker.md +0 -33
- package/src/docs/docs/reference/plugins/stylelint.md +0 -38
- package/src/docs/docs/reference/plugins/svelte.md +0 -34
- package/src/docs/docs/reference/plugins/sveltekit.md +0 -33
- package/src/docs/docs/reference/plugins/svgo.md +0 -37
- package/src/docs/docs/reference/plugins/svgr.md +0 -40
- package/src/docs/docs/reference/plugins/swc.md +0 -33
- package/src/docs/docs/reference/plugins/syncpack.md +0 -38
- package/src/docs/docs/reference/plugins/tailwind.md +0 -33
- package/src/docs/docs/reference/plugins/tanstack-router.md +0 -48
- package/src/docs/docs/reference/plugins/taskfile.md +0 -40
- package/src/docs/docs/reference/plugins/travis.md +0 -33
- package/src/docs/docs/reference/plugins/ts-node.md +0 -27
- package/src/docs/docs/reference/plugins/tsdown.md +0 -45
- package/src/docs/docs/reference/plugins/tsup.md +0 -45
- package/src/docs/docs/reference/plugins/tsx.md +0 -46
- package/src/docs/docs/reference/plugins/typedoc.md +0 -49
- package/src/docs/docs/reference/plugins/typescript.md +0 -50
- package/src/docs/docs/reference/plugins/unbuild.md +0 -33
- package/src/docs/docs/reference/plugins/unocss.md +0 -36
- package/src/docs/docs/reference/plugins/vercel-og.md +0 -38
- package/src/docs/docs/reference/plugins/vike.md +0 -34
- package/src/docs/docs/reference/plugins/vite.md +0 -48
- package/src/docs/docs/reference/plugins/vitepress.md +0 -34
- package/src/docs/docs/reference/plugins/vitest.md +0 -50
- package/src/docs/docs/reference/plugins/vue.md +0 -33
- package/src/docs/docs/reference/plugins/webdriver-io.md +0 -33
- package/src/docs/docs/reference/plugins/webpack.md +0 -48
- package/src/docs/docs/reference/plugins/wireit.md +0 -33
- package/src/docs/docs/reference/plugins/wrangler.md +0 -33
- package/src/docs/docs/reference/plugins/xo.md +0 -40
- package/src/docs/docs/reference/plugins/yarn.md +0 -33
- package/src/docs/docs/reference/plugins/yorkie.md +0 -33
- package/src/docs/docs/reference/plugins.md +0 -140
- package/src/docs/docs/reference/related-tooling.md +0 -46
- package/src/docs/docs/sponsors.mdx +0 -64
- package/src/docs/docs/typescript/unused-dependencies.md +0 -86
- package/src/docs/docs/typescript/unused-exports.md +0 -87
- package/src/docs/docs/writing-a-plugin/argument-parsing.md +0 -202
- package/src/docs/docs/writing-a-plugin/index.md +0 -392
- package/src/docs/docs/writing-a-plugin/inputs.md +0 -162
- package/src/docs/reference/plugins/angular.md +0 -33
- package/src/docs/reference/plugins/astro-db.md +0 -34
- package/src/docs/reference/plugins/astro.md +0 -43
- package/src/docs/reference/plugins/ava.md +0 -46
- package/src/docs/reference/plugins/babel.md +0 -38
- package/src/docs/reference/plugins/biome.md +0 -34
- package/src/docs/reference/plugins/bumpp.md +0 -38
- package/src/docs/reference/plugins/bun.md +0 -33
- package/src/docs/reference/plugins/c8.md +0 -26
- package/src/docs/reference/plugins/capacitor.md +0 -35
- package/src/docs/reference/plugins/changelogen.md +0 -38
- package/src/docs/reference/plugins/changelogithub.md +0 -38
- package/src/docs/reference/plugins/changesets.md +0 -33
- package/src/docs/reference/plugins/commitizen.md +0 -35
- package/src/docs/reference/plugins/commitlint.md +0 -39
- package/src/docs/reference/plugins/convex.md +0 -34
- package/src/docs/reference/plugins/create-typescript-app.md +0 -33
- package/src/docs/reference/plugins/cspell.md +0 -36
- package/src/docs/reference/plugins/cucumber.md +0 -36
- package/src/docs/reference/plugins/cypress.md +0 -40
- package/src/docs/reference/plugins/danger.md +0 -33
- package/src/docs/reference/plugins/dependency-cruiser.md +0 -44
- package/src/docs/reference/plugins/docusaurus.md +0 -39
- package/src/docs/reference/plugins/dotenv.md +0 -24
- package/src/docs/reference/plugins/drizzle.md +0 -33
- package/src/docs/reference/plugins/eleventy.md +0 -38
- package/src/docs/reference/plugins/eslint.md +0 -74
- package/src/docs/reference/plugins/expo.md +0 -38
- package/src/docs/reference/plugins/gatsby.md +0 -46
- package/src/docs/reference/plugins/github-action.md +0 -33
- package/src/docs/reference/plugins/github-actions.md +0 -34
- package/src/docs/reference/plugins/glob.md +0 -26
- package/src/docs/reference/plugins/graphql-codegen.md +0 -43
- package/src/docs/reference/plugins/hardhat.md +0 -33
- package/src/docs/reference/plugins/husky.md +0 -37
- package/src/docs/reference/plugins/i18next-parser.md +0 -44
- package/src/docs/reference/plugins/jest.md +0 -50
- package/src/docs/reference/plugins/karma.md +0 -36
- package/src/docs/reference/plugins/ladle.md +0 -40
- package/src/docs/reference/plugins/lefthook.md +0 -43
- package/src/docs/reference/plugins/lint-staged.md +0 -45
- package/src/docs/reference/plugins/linthtml.md +0 -38
- package/src/docs/reference/plugins/lockfile-lint.md +0 -38
- package/src/docs/reference/plugins/lost-pixel.md +0 -33
- package/src/docs/reference/plugins/markdownlint.md +0 -34
- package/src/docs/reference/plugins/mdx.md +0 -37
- package/src/docs/reference/plugins/mdxlint.md +0 -35
- package/src/docs/reference/plugins/metro.md +0 -46
- package/src/docs/reference/plugins/mocha.md +0 -48
- package/src/docs/reference/plugins/moonrepo.md +0 -35
- package/src/docs/reference/plugins/msw.md +0 -36
- package/src/docs/reference/plugins/nano-staged.md +0 -36
- package/src/docs/reference/plugins/nest.md +0 -38
- package/src/docs/reference/plugins/netlify.md +0 -42
- package/src/docs/reference/plugins/next-intl.md +0 -33
- package/src/docs/reference/plugins/next-mdx.md +0 -36
- package/src/docs/reference/plugins/next.md +0 -53
- package/src/docs/reference/plugins/node-modules-inspector.md +0 -45
- package/src/docs/reference/plugins/node.md +0 -48
- package/src/docs/reference/plugins/nodemon.md +0 -27
- package/src/docs/reference/plugins/npm-package-json-lint.md +0 -38
- package/src/docs/reference/plugins/nuxt.md +0 -49
- package/src/docs/reference/plugins/nx.md +0 -57
- package/src/docs/reference/plugins/nyc.md +0 -36
- package/src/docs/reference/plugins/oclif.md +0 -33
- package/src/docs/reference/plugins/oxlint.md +0 -44
- package/src/docs/reference/plugins/playwright-ct.md +0 -39
- package/src/docs/reference/plugins/playwright-test.md +0 -26
- package/src/docs/reference/plugins/playwright.md +0 -49
- package/src/docs/reference/plugins/plop.md +0 -33
- package/src/docs/reference/plugins/pnpm.md +0 -33
- package/src/docs/reference/plugins/postcss.md +0 -43
- package/src/docs/reference/plugins/preconstruct.md +0 -33
- package/src/docs/reference/plugins/prettier.md +0 -36
- package/src/docs/reference/plugins/prisma.md +0 -55
- package/src/docs/reference/plugins/react-cosmos.md +0 -39
- package/src/docs/reference/plugins/react-router.md +0 -34
- package/src/docs/reference/plugins/relay.md +0 -52
- package/src/docs/reference/plugins/release-it.md +0 -34
- package/src/docs/reference/plugins/remark.md +0 -37
- package/src/docs/reference/plugins/remix.md +0 -40
- package/src/docs/reference/plugins/rollup.md +0 -47
- package/src/docs/reference/plugins/rsbuild.md +0 -33
- package/src/docs/reference/plugins/rslib.md +0 -33
- package/src/docs/reference/plugins/rspack.md +0 -33
- package/src/docs/reference/plugins/rstest.md +0 -33
- package/src/docs/reference/plugins/semantic-release.md +0 -38
- package/src/docs/reference/plugins/sentry.md +0 -35
- package/src/docs/reference/plugins/simple-git-hooks.md +0 -35
- package/src/docs/reference/plugins/size-limit.md +0 -36
- package/src/docs/reference/plugins/sst.md +0 -33
- package/src/docs/reference/plugins/starlight.md +0 -33
- package/src/docs/reference/plugins/storybook.md +0 -44
- package/src/docs/reference/plugins/stryker.md +0 -33
- package/src/docs/reference/plugins/stylelint.md +0 -38
- package/src/docs/reference/plugins/svelte.md +0 -37
- package/src/docs/reference/plugins/svgo.md +0 -37
- package/src/docs/reference/plugins/svgr.md +0 -40
- package/src/docs/reference/plugins/swc.md +0 -33
- package/src/docs/reference/plugins/syncpack.md +0 -38
- package/src/docs/reference/plugins/tailwind.md +0 -33
- package/src/docs/reference/plugins/taskfile.md +0 -34
- package/src/docs/reference/plugins/travis.md +0 -33
- package/src/docs/reference/plugins/ts-node.md +0 -27
- package/src/docs/reference/plugins/tsdown.md +0 -45
- package/src/docs/reference/plugins/tsup.md +0 -45
- package/src/docs/reference/plugins/tsx.md +0 -46
- package/src/docs/reference/plugins/typedoc.md +0 -49
- package/src/docs/reference/plugins/typescript.md +0 -50
- package/src/docs/reference/plugins/unbuild.md +0 -33
- package/src/docs/reference/plugins/unocss.md +0 -36
- package/src/docs/reference/plugins/vercel-og.md +0 -38
- package/src/docs/reference/plugins/vike.md +0 -34
- package/src/docs/reference/plugins/vite.md +0 -48
- package/src/docs/reference/plugins/vitest.md +0 -50
- package/src/docs/reference/plugins/vue.md +0 -33
- package/src/docs/reference/plugins/webdriver-io.md +0 -33
- package/src/docs/reference/plugins/webpack.md +0 -48
- package/src/docs/reference/plugins/wireit.md +0 -33
- package/src/docs/reference/plugins/wrangler.md +0 -33
- package/src/docs/reference/plugins/xo.md +0 -40
- package/src/docs/reference/plugins/yarn.md +0 -33
- package/src/docs/reference/plugins/yorkie.md +0 -33
- /package/src/docs/{docs/reference → reference}/configuration-hints.md +0 -0
- /package/src/docs/{docs/reference → reference}/integrations.md +0 -0
|
@@ -6,22 +6,24 @@ sidebar:
|
|
|
6
6
|
|
|
7
7
|
import { Tabs, TabItem } from '@astrojs/starlight/components';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
some initial configuration.
|
|
9
|
+
Issues reported by Knip may contain false positives, but also tons of useful
|
|
10
|
+
information. Getting the most out of Knip may require some configuration.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
If you start out using Knip in a large project and have a long report, it makes
|
|
17
|
-
sense to go over the issue types one by one. For instance, reducing the number
|
|
18
|
-
of unused files will also reduce the number of unused dependencies.
|
|
12
|
+
Go over the issue types one by one. For instance, reducing the number of unused
|
|
13
|
+
files will also reduce the number of unused dependencies.
|
|
19
14
|
|
|
20
15
|
1. [Unused files][1]
|
|
21
16
|
2. [Unused dependencies][2]
|
|
22
17
|
3. [Unresolved imports][3]
|
|
23
18
|
4. [Unused exports][4]
|
|
24
19
|
|
|
20
|
+
:::tip
|
|
21
|
+
|
|
22
|
+
Try the [Knip Editor Extension][5]! Let your coding agent use the built-in
|
|
23
|
+
MCP Server and create a custom `knip.json` for you.
|
|
24
|
+
|
|
25
|
+
:::
|
|
26
|
+
|
|
25
27
|
## Unused files
|
|
26
28
|
|
|
27
29
|
Getting the list of unused files right trickles down into the other issue types
|
|
@@ -32,22 +34,29 @@ of `project` files, but not in the set of files resolved from the `entry` files:
|
|
|
32
34
|
unused files = project files - (entry files + resolved files)
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
:::tip
|
|
38
|
+
|
|
39
|
+
Addressing reported [Configuration Hints][6] first might help significantly,
|
|
40
|
+
especially when handling unused files.
|
|
41
|
+
|
|
42
|
+
:::
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
44
|
+
Common causes for unused files include:
|
|
45
|
+
|
|
46
|
+
- [Missing generated files][7]
|
|
47
|
+
- [Dynamic import specifiers][8]
|
|
48
|
+
- [Unsupported arguments in scripts][9]
|
|
49
|
+
- [Unsupported file formats][10]
|
|
50
|
+
- [Missing plugin][11]
|
|
51
|
+
- [Incomplete plugin][12]
|
|
52
|
+
- [TypeScript path aliases in monorepos][13]
|
|
53
|
+
- [Relative paths across workspaces][14]
|
|
54
|
+
- [Integrated monorepos][15]
|
|
55
|
+
- [Auto-mocking or auto-imports][16]
|
|
47
56
|
|
|
48
57
|
In most cases you can add `entry` patterns manually.
|
|
49
58
|
|
|
50
|
-
Use `--files` to [filter the report][
|
|
59
|
+
Use `--files` to [filter the report][17] and focus only on unused files:
|
|
51
60
|
|
|
52
61
|
```sh
|
|
53
62
|
knip --files
|
|
@@ -60,15 +69,15 @@ exports.
|
|
|
60
69
|
:::caution
|
|
61
70
|
|
|
62
71
|
Don't add unused files to the `ignore` option before reading [configuring
|
|
63
|
-
project files][
|
|
64
|
-
mode and `ignore
|
|
72
|
+
project files][18]. Learn why and when to use `entry`, `project`, production
|
|
73
|
+
mode and `ignore*` patterns for better results and performance.
|
|
65
74
|
|
|
66
75
|
:::
|
|
67
76
|
|
|
68
77
|
### Missing generated files
|
|
69
78
|
|
|
70
79
|
For certain features, Knip needs to run after relevant files are generated. For
|
|
71
|
-
instance, [source mapping][
|
|
80
|
+
instance, [source mapping][19] in a monorepo may require files to be built into
|
|
72
81
|
`dist` folders first. And generated files in the `src` directory may import
|
|
73
82
|
other files. For instance, the `src/routeTree.gen.ts` file generated by
|
|
74
83
|
`@tanstack/router` must exist so Knip can find the imported route files.
|
|
@@ -106,7 +115,7 @@ Some tooling command arguments aren't recognized:
|
|
|
106
115
|
**Solution**: add `production.ts` to `entry` patterns.
|
|
107
116
|
|
|
108
117
|
This works the same for any script, also those in GitHub Actions workflows or
|
|
109
|
-
Git hooks. See [script parser][
|
|
118
|
+
Git hooks. See [script parser][20] for more details about Knip's script parser.
|
|
110
119
|
|
|
111
120
|
### Unsupported file formats
|
|
112
121
|
|
|
@@ -123,9 +132,9 @@ Entry files referenced in HTML files (e.g. `<script src="production.js">`).
|
|
|
123
132
|
**Solution**: add `production.js` to `entry` patterns. Or add an `.html`
|
|
124
133
|
compiler to extract and resolve the value of `<script src>` elements.
|
|
125
134
|
|
|
126
|
-
Knip has support for some popular framework formats through [compilers][
|
|
127
|
-
additional compilers can be added for
|
|
128
|
-
|
|
135
|
+
Knip has support for some popular framework formats through [compilers][21], and
|
|
136
|
+
additional compilers can be added for any file type. The recommended solution is
|
|
137
|
+
usually to add the file as shown in each example as an `entry` file.
|
|
129
138
|
|
|
130
139
|
### Missing plugin
|
|
131
140
|
|
|
@@ -139,16 +148,16 @@ examples:
|
|
|
139
148
|
- A framework automatically imports all files matching `src/models/*.ts` → those
|
|
140
149
|
files are reported as unused.
|
|
141
150
|
|
|
142
|
-
**Solution**: [create a new plugin][
|
|
143
|
-
the list][
|
|
144
|
-
dependency or two (using [`ignoreDependencies`][
|
|
151
|
+
**Solution**: [create a new plugin][22] for the tool or framework that's not [in
|
|
152
|
+
the list][23] yet. Or work around it and add `entry` patterns and maybe ignore a
|
|
153
|
+
dependency or two (using [`ignoreDependencies`][24]).
|
|
145
154
|
|
|
146
155
|
### Incomplete plugin
|
|
147
156
|
|
|
148
157
|
Files may be reported as unused if existing plugins do not include that entry
|
|
149
|
-
file pattern yet. See the [plugins section of entry files][
|
|
158
|
+
file pattern yet. See the [plugins section of entry files][25] for more details.
|
|
150
159
|
|
|
151
|
-
**Solution**: [override plugin configuration][
|
|
160
|
+
**Solution**: [override plugin configuration][26] to customize default patterns
|
|
152
161
|
for existing plugins. Or even better: send a pull request to improve the plugin.
|
|
153
162
|
|
|
154
163
|
### TypeScript path aliases in monorepos
|
|
@@ -184,7 +193,7 @@ Knip, it's better to be explicit and list other workspaces as dependencies in
|
|
|
184
193
|
An additional benefit is that Knip will report unused and unlisted dependencies
|
|
185
194
|
from now on.
|
|
186
195
|
|
|
187
|
-
Also see [FAQ: Why can't I use path aliases to reference other workspaces?][
|
|
196
|
+
Also see [FAQ: Why can't I use path aliases to reference other workspaces?][27]
|
|
188
197
|
|
|
189
198
|
### Relative paths across workspaces
|
|
190
199
|
|
|
@@ -207,7 +216,7 @@ import { something } from '@org/common';
|
|
|
207
216
|
An additional benefit is that Knip will report unused and unlisted dependencies
|
|
208
217
|
from now on.
|
|
209
218
|
|
|
210
|
-
Also see [TypeScript path aliases in monorepos][
|
|
219
|
+
Also see [TypeScript path aliases in monorepos][13].
|
|
211
220
|
|
|
212
221
|
### Integrated monorepos
|
|
213
222
|
|
|
@@ -215,7 +224,7 @@ Multiple instances of configuration files like `.eslintrc` and
|
|
|
215
224
|
`jest.config.json` across the repository may be reported as unused when working
|
|
216
225
|
in a (mono)repo with a single `package.json`.
|
|
217
226
|
|
|
218
|
-
**Solution**: see [integrated monorepos][
|
|
227
|
+
**Solution**: see [integrated monorepos][28] for more details and how to
|
|
219
228
|
configure plugins to target those configuration files.
|
|
220
229
|
|
|
221
230
|
### Auto-mocking or auto-imports
|
|
@@ -250,11 +259,12 @@ unused dependencies.
|
|
|
250
259
|
|
|
251
260
|
The most common causes for unused dependencies include:
|
|
252
261
|
|
|
253
|
-
- [Missing or incomplete plugins][
|
|
254
|
-
- [Unrecognized references][
|
|
255
|
-
- [Type Definition Packages][
|
|
262
|
+
- [Missing or incomplete plugins][29]
|
|
263
|
+
- [Unrecognized references][30]
|
|
264
|
+
- [Type Definition Packages][31]
|
|
265
|
+
- [Dependencies named after Node.js builtins][32]
|
|
256
266
|
|
|
257
|
-
Use `--dependencies` to [filter the report][
|
|
267
|
+
Use `--dependencies` to [filter the report][17] and focus only on issues related
|
|
258
268
|
to dependencies:
|
|
259
269
|
|
|
260
270
|
```sh
|
|
@@ -264,8 +274,8 @@ knip --dependencies
|
|
|
264
274
|
:::caution[Monorepo]
|
|
265
275
|
|
|
266
276
|
In a monorepo, a dependency is unused in the root workspace's `package.json` if
|
|
267
|
-
it's also listed in
|
|
268
|
-
|
|
277
|
+
it's also listed in a descendant workspace, and referenced only in the
|
|
278
|
+
descendant workspace.
|
|
269
279
|
|
|
270
280
|
:::
|
|
271
281
|
|
|
@@ -285,10 +295,57 @@ Sometimes a reference to a dependency is unrecognizable or unreachable to Knip,
|
|
|
285
295
|
so it's a false positive and incorrectly reported as unused.
|
|
286
296
|
|
|
287
297
|
**Solution**: add a new plugin or improve an existing one. If you don't feel
|
|
288
|
-
like a plugin could solve it, a last resort is to use [ignoreDependencies][
|
|
298
|
+
like a plugin could solve it, a last resort is to use [ignoreDependencies][24].
|
|
289
299
|
|
|
290
300
|
If a binary (or "executable") is referenced you'll want to use `ignoreBinaries`
|
|
291
|
-
instead. See [unlisted binaries][
|
|
301
|
+
instead. See [unlisted binaries][33].
|
|
302
|
+
|
|
303
|
+
### Dependencies named after Node.js builtins
|
|
304
|
+
|
|
305
|
+
Some packages have the same name as a Node.js builtin (for instance `buffer` or
|
|
306
|
+
`process`).
|
|
307
|
+
|
|
308
|
+
**Solution**: if Knip reports such a dependency as unused, add it to
|
|
309
|
+
[ignoreDependencies][24].
|
|
310
|
+
|
|
311
|
+
### Conditional or dynamic dependencies
|
|
312
|
+
|
|
313
|
+
Dependencies added conditionally in configuration files may not be detected by
|
|
314
|
+
Knip. This happens because Knip loads and executes config files, and conditional
|
|
315
|
+
logic may evaluate differently during analysis.
|
|
316
|
+
|
|
317
|
+
For example, this Playwright configuration conditionally adds a reporter:
|
|
318
|
+
|
|
319
|
+
```ts title="playwright.config.ts"
|
|
320
|
+
import { defineConfig } from '@playwright/test';
|
|
321
|
+
|
|
322
|
+
const reporters: any[] = [['list']];
|
|
323
|
+
if (process.env.REPORT_PORTAL_ENABLED) {
|
|
324
|
+
reporters.push(['@reportportal/agent-js-playwright', config]);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export default defineConfig({
|
|
328
|
+
reporter: reporters,
|
|
329
|
+
});
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
If `process.env.REPORT_PORTAL_ENABLED` evaluates to `false` when Knip runs, the
|
|
333
|
+
`@reportportal/agent-js-playwright` dependency won't be detected and may be
|
|
334
|
+
reported as unused.
|
|
335
|
+
|
|
336
|
+
This limitation exists because Knip executes configuration files to parse their
|
|
337
|
+
exported value. While Knip can parse configuration files statically using AST
|
|
338
|
+
(Abstract Syntax Tree) analysis, this approach becomes complex very quickly and
|
|
339
|
+
most of the time it is easier to use the [`ignoreDependencies`][24]
|
|
340
|
+
configuration option for conditionals.
|
|
341
|
+
|
|
342
|
+
```json title="knip.json"
|
|
343
|
+
{
|
|
344
|
+
"ignoreDependencies": ["@reportportal/agent-js-playwright"]
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
This pattern can be applied to any plugin that loads configuration files.
|
|
292
349
|
|
|
293
350
|
### Type Definition Packages
|
|
294
351
|
|
|
@@ -317,7 +374,7 @@ In strict production mode, even when re-exported and part of the package's
|
|
|
317
374
|
public API, Knip does not try to figure out what exactly are "production types"
|
|
318
375
|
and expects those in `devDependencies`.
|
|
319
376
|
|
|
320
|
-
**Solution**: list exceptions in [ignoreDependencies][
|
|
377
|
+
**Solution**: list exceptions in [ignoreDependencies][24].
|
|
321
378
|
|
|
322
379
|
### Unlisted dependencies
|
|
323
380
|
|
|
@@ -349,7 +406,7 @@ reported as an unlisted binary as there is no package that contains it.
|
|
|
349
406
|
|
|
350
407
|
Binaries that are installed on the OS already and thus likely not meant to be
|
|
351
408
|
installed from npm are not reported as unlisted (details: [list of ignored
|
|
352
|
-
binaries in source][
|
|
409
|
+
binaries in source][34]).
|
|
353
410
|
|
|
354
411
|
#### Missing binaries
|
|
355
412
|
|
|
@@ -359,7 +416,7 @@ either the way your package manager installs dependencies and binaries, or by
|
|
|
359
416
|
not running Knip from the root of the repository.
|
|
360
417
|
|
|
361
418
|
**Solution**: run Knip from the project root. If needed, [lint workspaces
|
|
362
|
-
individually][
|
|
419
|
+
individually][35].
|
|
363
420
|
|
|
364
421
|
Sometimes binaries and how they're reported can be a bit confusing. See this
|
|
365
422
|
example:
|
|
@@ -377,9 +434,9 @@ example:
|
|
|
377
434
|
```
|
|
378
435
|
|
|
379
436
|
This example works fine without anything reported, as the `@commitlint/cli`
|
|
380
|
-
package includes the `commitlint` binary. However, some script may contain
|
|
381
|
-
|
|
382
|
-
|
|
437
|
+
package includes the `commitlint` binary. However, some script may contain `npx
|
|
438
|
+
commitlint` and here Knip assumes `commitlint` is the name of the package. This
|
|
439
|
+
technically works, as `commitlint` is a transitive dependency of
|
|
383
440
|
`@commitlint/cli`.
|
|
384
441
|
|
|
385
442
|
**Solution**: use `npx @commitlint/cli`
|
|
@@ -395,10 +452,10 @@ or consider the binary and package(s) referenced, respectively.
|
|
|
395
452
|
Knip may ignore or be unable to resolve an import specifier or dependency
|
|
396
453
|
references. The most common causes for unresolved imports:
|
|
397
454
|
|
|
398
|
-
- [Template strings][
|
|
399
|
-
- [Extensionless imports][
|
|
400
|
-
- [Unrecognized path aliases][
|
|
401
|
-
- [External aliased imports][
|
|
455
|
+
- [Template strings][36]
|
|
456
|
+
- [Extensionless imports][30]
|
|
457
|
+
- [Unrecognized path aliases][37]
|
|
458
|
+
- [External aliased imports][38]
|
|
402
459
|
|
|
403
460
|
### Template strings
|
|
404
461
|
|
|
@@ -430,24 +487,24 @@ The first import is resolved properly, because `.vue` is a known extension if
|
|
|
430
487
|
the Vue plugin is enabled. The second import might not be resolved, because
|
|
431
488
|
`.svg` is not a known extension.
|
|
432
489
|
|
|
433
|
-
|
|
434
|
-
|
|
490
|
+
**Solution**: include the extension. Hosts supporting ES Modules (e.g. Node.js,
|
|
491
|
+
browsers) require a file extension for import specifiers.
|
|
435
492
|
|
|
436
493
|
### Unrecognized path aliases
|
|
437
494
|
|
|
438
|
-
Knip considers TS config path aliases and [paths configured in knip.json][
|
|
495
|
+
Knip considers TS config path aliases and [paths configured in knip.json][39],
|
|
439
496
|
but not those in e.g. Webpack or Vite configurations.
|
|
440
497
|
|
|
441
|
-
**Solution**: configure [paths][
|
|
442
|
-
[`ignoreUnresolved`][
|
|
498
|
+
**Solution**: configure [paths][39] or try relative imports. Otherwise, use
|
|
499
|
+
[`ignoreUnresolved`][40] as a last resort.
|
|
443
500
|
|
|
444
501
|
### External aliased imports
|
|
445
502
|
|
|
446
503
|
External libraries may use aliased imports that aren't resolved by Knip.
|
|
447
504
|
|
|
448
|
-
For instance, [unplugin-icons][
|
|
505
|
+
For instance, [unplugin-icons][41] does this to import icons from icon sets as
|
|
449
506
|
components. Such imports are reported as unused. Use the [`paths` configuration
|
|
450
|
-
option][
|
|
507
|
+
option][39] to tell Knip where to find the icon types:
|
|
451
508
|
|
|
452
509
|
```json title="knip.json"
|
|
453
510
|
{
|
|
@@ -458,9 +515,9 @@ option][13] to tell Knip where to find the icon types:
|
|
|
458
515
|
```
|
|
459
516
|
|
|
460
517
|
Where `[framework]` is the name of the framework you're using (see [available
|
|
461
|
-
types][
|
|
518
|
+
types][42]).
|
|
462
519
|
|
|
463
|
-
**Solution**: try [--include-libs][
|
|
520
|
+
**Solution**: try [--include-libs][43] or configure [paths][39].
|
|
464
521
|
|
|
465
522
|
## Unused exports
|
|
466
523
|
|
|
@@ -468,17 +525,17 @@ By default, Knip does not report unused exports of `entry` files.
|
|
|
468
525
|
|
|
469
526
|
The most common causes for unused exports include:
|
|
470
527
|
|
|
471
|
-
- [Namespace enumerations][
|
|
472
|
-
- [External libraries][
|
|
528
|
+
- [Namespace enumerations][44]
|
|
529
|
+
- [External libraries][45]
|
|
473
530
|
|
|
474
|
-
Use the `--exports` flag to [filter][
|
|
531
|
+
Use the `--exports` flag to [filter][17] and focus only on issues related to
|
|
475
532
|
exports:
|
|
476
533
|
|
|
477
534
|
```sh
|
|
478
535
|
knip --exports
|
|
479
536
|
```
|
|
480
537
|
|
|
481
|
-
Use [includeEntryExports][
|
|
538
|
+
Use [includeEntryExports][46] to report unused exports of entry files as well.
|
|
482
539
|
This can be set per workspace.
|
|
483
540
|
|
|
484
541
|
### Namespace enumerations
|
|
@@ -490,7 +547,7 @@ are then **not** reported.
|
|
|
490
547
|
**Solution**: if all exports on imported namespaces should be considered
|
|
491
548
|
individually, include the `nsExports` issue type to disable the heuristic.
|
|
492
549
|
|
|
493
|
-
See [namespace imports][
|
|
550
|
+
See [namespace imports][47] to see all related patterns.
|
|
494
551
|
|
|
495
552
|
### External libraries
|
|
496
553
|
|
|
@@ -533,16 +590,17 @@ knip --include-libs
|
|
|
533
590
|
```
|
|
534
591
|
|
|
535
592
|
This comes at a performance and memory penalty, but should give better results
|
|
536
|
-
if you need it. This flag is implied when [classMembers][
|
|
593
|
+
if you need it. This flag is implied when [classMembers][48] are included (that
|
|
537
594
|
feature comes with roughly the same performance penalty).
|
|
538
595
|
|
|
539
596
|
### Exclude exports from the report
|
|
540
597
|
|
|
541
598
|
To exclude false positives from the report, there are a few options:
|
|
542
599
|
|
|
543
|
-
- [Ignore exports used in file][
|
|
544
|
-
- Individual exports can be [tagged using JSDoc syntax][
|
|
600
|
+
- [Ignore exports used in file][49] for exports used internally.
|
|
601
|
+
- Individual exports can be [tagged using JSDoc syntax][50].
|
|
545
602
|
- Have the export in an entry file:
|
|
603
|
+
|
|
546
604
|
- Add the file to the `entry` file patterns array in the configuration.
|
|
547
605
|
- Move the export(s) to an entry file.
|
|
548
606
|
- Add the file to the `exports` field of `package.json`
|
|
@@ -551,11 +609,11 @@ To exclude false positives from the report, there are a few options:
|
|
|
551
609
|
### Missing unused exports?
|
|
552
610
|
|
|
553
611
|
Did you expect certain exports in the report, but are they missing? They might
|
|
554
|
-
be exported from an entry file. In that case, use [--include-entry-exports][
|
|
612
|
+
be exported from an entry file. In that case, use [--include-entry-exports][46]
|
|
555
613
|
to make Knip also report unused exports in entry files.
|
|
556
614
|
|
|
557
615
|
The exports of non-standard extensions like `.astro`, `.mdx`, `.vue` or
|
|
558
|
-
`.svelte` are not available by default. See [compilers][
|
|
616
|
+
`.svelte` are not available by default. See [compilers][21] for more details on
|
|
559
617
|
how to include them.
|
|
560
618
|
|
|
561
619
|
### Class members
|
|
@@ -570,10 +628,10 @@ knip --include classMembers
|
|
|
570
628
|
This option is also available in the Knip configuration file. Note that this
|
|
571
629
|
feature comes at a cost: linting will take more time and more memory.
|
|
572
630
|
|
|
573
|
-
Individual class members can be [tagged using JSDoc syntax][
|
|
631
|
+
Individual class members can be [tagged using JSDoc syntax][50].
|
|
574
632
|
|
|
575
633
|
Classes exported from entry files are ignored, and so are their members. Use
|
|
576
|
-
[--include-entry-exports][
|
|
634
|
+
[--include-entry-exports][46] to make Knip also report members of unused exports
|
|
577
635
|
in entry files.
|
|
578
636
|
|
|
579
637
|
### Enum members
|
|
@@ -585,62 +643,66 @@ Reporting such members can be disabled:
|
|
|
585
643
|
knip --exclude enumMembers
|
|
586
644
|
```
|
|
587
645
|
|
|
588
|
-
Individual enum members can be [tagged using JSDoc syntax][
|
|
646
|
+
Individual enum members can be [tagged using JSDoc syntax][50].
|
|
589
647
|
|
|
590
648
|
Enums exported from entry files are ignored, and so are their members. Use
|
|
591
|
-
[--include-entry-exports][
|
|
649
|
+
[--include-entry-exports][46] to make Knip also report members of unused exports
|
|
592
650
|
in entry files.
|
|
593
651
|
|
|
594
652
|
## Feedback or false positives?
|
|
595
653
|
|
|
596
654
|
If you believe Knip incorrectly reports something as unused (i.e. there's a
|
|
597
|
-
false positive), feel free to create a [minimal reproduction][
|
|
655
|
+
false positive), feel free to create a [minimal reproduction][51] and open an
|
|
598
656
|
issue on GitHub. It'll make Knip better for everyone!
|
|
599
657
|
|
|
600
658
|
[1]: #unused-files
|
|
601
659
|
[2]: #unused-dependencies
|
|
602
660
|
[3]: #unresolved-imports
|
|
603
661
|
[4]: #unused-exports
|
|
604
|
-
[5]:
|
|
605
|
-
[6]:
|
|
606
|
-
[7]: #
|
|
607
|
-
[8]: #
|
|
608
|
-
[9]: #
|
|
609
|
-
[10]: #
|
|
610
|
-
[11]: #
|
|
611
|
-
[12]: #
|
|
612
|
-
[13]: #
|
|
613
|
-
[14]: #
|
|
614
|
-
[15]:
|
|
615
|
-
[16]:
|
|
616
|
-
[17]: ../features/
|
|
617
|
-
[18]:
|
|
618
|
-
[19]: ../features/
|
|
619
|
-
[20]:
|
|
620
|
-
[21]: ../
|
|
621
|
-
[22]: ../
|
|
622
|
-
[23]: ../
|
|
623
|
-
[24]: ../
|
|
624
|
-
[25]: ../
|
|
625
|
-
[26]: ../
|
|
626
|
-
[27]: #
|
|
627
|
-
[28]:
|
|
628
|
-
[29]: #
|
|
629
|
-
[30]: #
|
|
630
|
-
[31]:
|
|
631
|
-
[32]:
|
|
632
|
-
[33]: #
|
|
633
|
-
[34]: #
|
|
634
|
-
[35]: #
|
|
635
|
-
[36]:
|
|
636
|
-
[37]:
|
|
637
|
-
[38]: #
|
|
638
|
-
[39]: #
|
|
639
|
-
[40]: #
|
|
640
|
-
[41]:
|
|
641
|
-
[42]:
|
|
642
|
-
[43]: ../reference/cli#--include-libs
|
|
643
|
-
[44]: #
|
|
644
|
-
[45]:
|
|
645
|
-
[46]: ../reference/
|
|
646
|
-
[47]: ../guides/
|
|
662
|
+
[5]: ../reference/integrations.md
|
|
663
|
+
[6]: ../reference/configuration-hints.md
|
|
664
|
+
[7]: #missing-generated-files
|
|
665
|
+
[8]: #dynamic-import-specifiers
|
|
666
|
+
[9]: #unsupported-arguments-in-scripts
|
|
667
|
+
[10]: #unsupported-file-formats
|
|
668
|
+
[11]: #missing-plugin
|
|
669
|
+
[12]: #incomplete-plugin
|
|
670
|
+
[13]: #typescript-path-aliases-in-monorepos
|
|
671
|
+
[14]: #relative-paths-across-workspaces
|
|
672
|
+
[15]: #integrated-monorepos
|
|
673
|
+
[16]: #auto-mocking-or-auto-imports
|
|
674
|
+
[17]: ../features/rules-and-filters.md#filters
|
|
675
|
+
[18]: ./configuring-project-files.md
|
|
676
|
+
[19]: ../features/source-mapping.md
|
|
677
|
+
[20]: ../features/script-parser.md
|
|
678
|
+
[21]: ../features/compilers.md
|
|
679
|
+
[22]: ../writing-a-plugin/index.md
|
|
680
|
+
[23]: ../reference/plugins.md
|
|
681
|
+
[24]: ../reference/configuration.md#ignoredependencies
|
|
682
|
+
[25]: ../explanations/plugins.md#entry-files
|
|
683
|
+
[26]: ../explanations/entry-files.md#plugins
|
|
684
|
+
[27]: ../reference/faq.md#why-cant-i-use-path-aliases-to-reference-other-workspaces
|
|
685
|
+
[28]: ../features/integrated-monorepos.md
|
|
686
|
+
[29]: #missing-or-incomplete-plugin
|
|
687
|
+
[30]: #unrecognized-reference
|
|
688
|
+
[31]: #type-definition-packages
|
|
689
|
+
[32]: #dependencies-named-after-nodejs-builtins
|
|
690
|
+
[33]: #unlisted-binaries
|
|
691
|
+
[34]: https://github.com/webpro-nl/knip/blob/e031018e676c47d84873cc2403251c0111ef318d/packages/knip/src/constants.ts#L39-L148
|
|
692
|
+
[35]: ../features/monorepos-and-workspaces.md#filter-workspaces
|
|
693
|
+
[36]: #template-strings
|
|
694
|
+
[37]: #unrecognized-path-aliases
|
|
695
|
+
[38]: #external-aliased-imports
|
|
696
|
+
[39]: ../reference/configuration.md#paths
|
|
697
|
+
[40]: ../reference/configuration.md#ignoreunresolved
|
|
698
|
+
[41]: https://www.npmjs.com/package/unplugin-icons
|
|
699
|
+
[42]: https://github.com/unplugin/unplugin-icons/tree/main/types
|
|
700
|
+
[43]: ../reference/cli.md#--include-libs
|
|
701
|
+
[44]: #namespace-enumerations
|
|
702
|
+
[45]: #external-libraries
|
|
703
|
+
[46]: ../reference/configuration.md#includeentryexports
|
|
704
|
+
[47]: ../guides/namespace-imports.md
|
|
705
|
+
[48]: #class-members
|
|
706
|
+
[49]: ../reference/configuration.md#ignoreexportsusedinfile
|
|
707
|
+
[50]: ../reference/jsdoc-tsdoc-tags.md
|
|
708
|
+
[51]: ../guides/issue-reproduction.md
|
|
@@ -19,6 +19,8 @@ influence the issue at hand, such as:
|
|
|
19
19
|
- Dependent or depending workspaces in a monorepo
|
|
20
20
|
- Knip configuration in `knip.json`
|
|
21
21
|
|
|
22
|
+
## Keep it minimal
|
|
23
|
+
|
|
22
24
|
Create the minimum of source code and configuration with a few files to
|
|
23
25
|
reproduce and demonstrate the issue. Having this as a basis has many benefits:
|
|
24
26
|
|
|
@@ -30,6 +32,12 @@ reproduce and demonstrate the issue. Having this as a basis has many benefits:
|
|
|
30
32
|
Providing this with an issue description will help us help you and improve the
|
|
31
33
|
chances the issue can be looked into efficiently and in a timely manner.
|
|
32
34
|
|
|
35
|
+
Useful **complements** to a minimal reproduction might include:
|
|
36
|
+
|
|
37
|
+
- Screenshots, videos, code snippets or log output
|
|
38
|
+
- Links to an existing project repository
|
|
39
|
+
- Applications scaffolded by tools like Angular or Svelte CLI
|
|
40
|
+
|
|
33
41
|
## Before opening an issue
|
|
34
42
|
|
|
35
43
|
Before opening an issue, please make sure you:
|
|
@@ -42,6 +50,10 @@ Before opening an issue, please make sure you:
|
|
|
42
50
|
Please file only a single issue at a time, so each of them can be labeled and
|
|
43
51
|
tracked separately.
|
|
44
52
|
|
|
53
|
+
There is no need to open an issue if you're going to submit a pull request to
|
|
54
|
+
close it right away anyway. In that case it's preferred to keep things central
|
|
55
|
+
in either an issue or pull request.
|
|
56
|
+
|
|
45
57
|
## Templates
|
|
46
58
|
|
|
47
59
|
A convenient way to create a minimal reproduction is by starting with one of
|
|
@@ -61,21 +73,17 @@ Other solutions to share a minimal and reproducible case may work well too,
|
|
|
61
73
|
including:
|
|
62
74
|
|
|
63
75
|
- A public repository on e.g. GitHub or GitLab.
|
|
64
|
-
- A
|
|
65
|
-
|
|
66
|
-
The goal is to have an easy and common understanding and reproduction. A link to
|
|
67
|
-
your existing project repository will likely not be considered "minimal". Issues
|
|
68
|
-
containing just a screenshot, or snippets of output or source code don't provide
|
|
69
|
-
the full picture and aren't complete nor actionable.
|
|
76
|
+
- A pull request with a new [test][9] and/or [fixture folder][10].
|
|
70
77
|
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
The goal is to have an easy and common understanding and reproduction. If you're
|
|
79
|
+
unable to create a reproduction using one of the methods described then please
|
|
80
|
+
clearly explain this in the issue or [contact me][11].
|
|
73
81
|
|
|
74
82
|
## Pull Request
|
|
75
83
|
|
|
76
84
|
The optimal way is to add fixtures and failing tests to the Knip repository, and
|
|
77
85
|
open a pull request to discuss the issue! Also see [instructions for
|
|
78
|
-
development][
|
|
86
|
+
development][12].
|
|
79
87
|
|
|
80
88
|
[1]: https://github.com/webpro-nl/knip/issues?q=is%3Aissue
|
|
81
89
|
[2]: https://knip.dev/reference/known-issues
|
|
@@ -89,6 +97,7 @@ development][11].
|
|
|
89
97
|
https://stackblitz.com/github/webpro-nl/knip/tree/main/templates/issue-reproduction/monorepo
|
|
90
98
|
[7]: https://codesandbox.io
|
|
91
99
|
[8]: https://stackblitz.com
|
|
92
|
-
[9]: https://github.com/webpro-nl/knip/
|
|
93
|
-
[10]: https://github.com/webpro
|
|
94
|
-
[11]: https://github.com/webpro
|
|
100
|
+
[9]: https://github.com/webpro-nl/knip/blob/main/.github/DEVELOPMENT.md#tests
|
|
101
|
+
[10]: https://github.com/webpro-nl/knip/tree/main/packages/knip/fixtures
|
|
102
|
+
[11]: https://github.com/webpro
|
|
103
|
+
[12]: https://github.com/webpro-nl/knip/blob/main/.github/DEVELOPMENT.md
|
|
@@ -59,9 +59,9 @@ on large monorepos.
|
|
|
59
59
|
|
|
60
60
|
Knip does not install the TypeScript Language Service (LS) by default. This is
|
|
61
61
|
expensive, as TypeScript needs to set up symbols and caching for the rather slow
|
|
62
|
-
`findReferences` function.
|
|
62
|
+
`findReferences` function. Even more so for multiple projects/workspaces.
|
|
63
63
|
|
|
64
|
-
There are two cases that enforce Knip to install the LS
|
|
64
|
+
There are two cases that enforce Knip to install the LS:
|
|
65
65
|
|
|
66
66
|
### 1. Class members
|
|
67
67
|
|
|
@@ -70,10 +70,11 @@ The `findReferences` function is used to find unused members of imported classes
|
|
|
70
70
|
|
|
71
71
|
### 2. Include external type definitions
|
|
72
72
|
|
|
73
|
-
When [`--include-libs`][3] is enabled, Knip
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
When [`--include-libs`][3] is enabled, Knip loads type definitions of external
|
|
74
|
+
dependencies. This will also install the LS to access its `findReferences`
|
|
75
|
+
function. It acts as an extra line of defense: only exports that Knip thinks
|
|
76
|
+
aren't referenced (during the default/fast procedure), will now receive a second
|
|
77
|
+
opinion from `findReferences`.
|
|
77
78
|
|
|
78
79
|
## Metrics
|
|
79
80
|
|
|
@@ -85,13 +86,23 @@ those functions. Example usage:
|
|
|
85
86
|
knip --include classMembers --performance
|
|
86
87
|
```
|
|
87
88
|
|
|
89
|
+
## ignoreExportsUsedInFile
|
|
90
|
+
|
|
91
|
+
The [ignoreExportsUsedInFile][5] option slows down the process slightly.
|
|
92
|
+
Typically, anywhere between 0.25% and 10% of total running time. To find out:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
knip --performance-fn hasRefsInFile
|
|
96
|
+
```
|
|
97
|
+
|
|
88
98
|
## A last resort
|
|
89
99
|
|
|
90
100
|
In case Knip is unbearably slow (or even crashes), you could resort to [lint
|
|
91
|
-
individual workspaces][
|
|
101
|
+
individual workspaces][6].
|
|
92
102
|
|
|
93
103
|
[1]: ./configuring-project-files.md
|
|
94
104
|
[2]: ../reference/cli.md#--isolate-workspaces
|
|
95
105
|
[3]: ../guides/handling-issues.mdx#external-libraries
|
|
96
106
|
[4]: ../reference/cli.md#--performance
|
|
97
|
-
[5]: ../
|
|
107
|
+
[5]: ../reference/configuration.md#ignoreexportsusedinfile
|
|
108
|
+
[6]: ../features/monorepos-and-workspaces.md#filter-workspaces
|