@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
|
@@ -180,6 +180,13 @@ notation below is valid and will report only exports tagged `@lintignore` or
|
|
|
180
180
|
}
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
+
:::caution
|
|
184
|
+
|
|
185
|
+
Tags must not contain hyphens or plus symbols, so it is recommended to stick to
|
|
186
|
+
letters and avoid snake-case.
|
|
187
|
+
|
|
188
|
+
:::
|
|
189
|
+
|
|
183
190
|
Also see [JSDoc & TSDoc Tags][8].
|
|
184
191
|
|
|
185
192
|
### `treatConfigHintsAsErrors`
|
|
@@ -198,17 +205,23 @@ Exit with non-zero code (1) if there are any configuration hints.
|
|
|
198
205
|
|
|
199
206
|
:::tip
|
|
200
207
|
|
|
201
|
-
Please read [configuring project files][9] before using the `ignore` option
|
|
202
|
-
because in most cases you'll want to fine‑tune `entry` and `project` (or use
|
|
203
|
-
production mode) instead.
|
|
208
|
+
Please read [configuring project files][9] before using the `ignore` option.
|
|
204
209
|
|
|
205
210
|
:::
|
|
206
211
|
|
|
207
|
-
|
|
212
|
+
Avoid `ignore` patterns. There is almost always a better solution:
|
|
213
|
+
|
|
214
|
+
- Follow up on configuration hints (if there are any).
|
|
215
|
+
- Fine-tune `entry` and `project` patterns.
|
|
216
|
+
- Use [production mode][10].
|
|
217
|
+
- Other `ignore*` options.
|
|
218
|
+
|
|
219
|
+
**NOTE**: An exception to the rule: to _temporarily_ report only issues in files
|
|
220
|
+
that match the negated `ignore` pattern:
|
|
208
221
|
|
|
209
222
|
```json title="knip.json"
|
|
210
223
|
{
|
|
211
|
-
"ignore": ["src/
|
|
224
|
+
"ignore": ["!src/dir/**"]
|
|
212
225
|
}
|
|
213
226
|
```
|
|
214
227
|
|
|
@@ -271,6 +284,8 @@ export default {
|
|
|
271
284
|
|
|
272
285
|
Suffix an item with `!` to enable it only in production mode.
|
|
273
286
|
|
|
287
|
+
Also see [Unused dependencies][11].
|
|
288
|
+
|
|
274
289
|
### `ignoreMembers`
|
|
275
290
|
|
|
276
291
|
Array of class and enum members to exclude from the report. Regular expressions
|
|
@@ -399,7 +414,7 @@ files (`.js` or `.ts`), not in JSON configuration files.
|
|
|
399
414
|
|
|
400
415
|
Override built-in compilers or add custom compilers for additional file types.
|
|
401
416
|
|
|
402
|
-
Also see [Compilers][
|
|
417
|
+
Also see [Compilers][12].
|
|
403
418
|
|
|
404
419
|
[1]: ../reference/dynamic-configuration.mdx
|
|
405
420
|
[2]: ../overview/configuration.md
|
|
@@ -410,4 +425,6 @@ Also see [Compilers][10].
|
|
|
410
425
|
[7]: ../features/rules-and-filters.md#filters
|
|
411
426
|
[8]: ./jsdoc-tsdoc-tags.md
|
|
412
427
|
[9]: ../guides/configuring-project-files.md
|
|
413
|
-
[10]: ../features/
|
|
428
|
+
[10]: ../features/production-mode.md
|
|
429
|
+
[11]: ../guides/handling-issues.mdx#unused-dependencies
|
|
430
|
+
[12]: ../features/compilers.md
|
|
@@ -22,6 +22,65 @@ This FAQ is an attempt to provide some perspective on a few design decisions and
|
|
|
22
22
|
why certain things work the way they do. Here and there it's intentionally a bit
|
|
23
23
|
more in-depth than the rest of the docs.
|
|
24
24
|
|
|
25
|
+
## Why should I even bother to do all this?
|
|
26
|
+
|
|
27
|
+
Because the payoff is huge. While it might take a bit of effort to configure
|
|
28
|
+
Knip correctly initially, a clean module graph gives you absolute confidence in
|
|
29
|
+
your codebase. You can delete dead code, remove unused dependencies, and
|
|
30
|
+
refactor with certainty. It prevents the slow accumulation of technical debt and
|
|
31
|
+
keeps your project lean and fast. Once configured, Knip runs quickly in CI and
|
|
32
|
+
keeps your codebase pristine automatically.
|
|
33
|
+
|
|
34
|
+
:::tip
|
|
35
|
+
|
|
36
|
+
Try the [Knip MCP Server][1] or the [Knip Editor Extension][2]. Let your coding
|
|
37
|
+
agent use the built-in MCP Server and create a custom `knip.json` for you, so
|
|
38
|
+
you don't have to.
|
|
39
|
+
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
## Common Pitfalls
|
|
43
|
+
|
|
44
|
+
### Why shouldn't I ignore or disable configuration hints?
|
|
45
|
+
|
|
46
|
+
Configuration hints are critical for building a healthy and accurate module
|
|
47
|
+
graph. They usually indicate that Knip cannot resolve a dependency, plugin, or
|
|
48
|
+
entry file. If you ignore or disable these hints, Knip's understanding of your
|
|
49
|
+
project will be incomplete, which inevitably leads to false positives (reporting
|
|
50
|
+
used code as unused). Always address configuration hints first before looking at
|
|
51
|
+
other reported issues.
|
|
52
|
+
|
|
53
|
+
### Why is it a bad idea to use `ignore` patterns like I do in ESLint?
|
|
54
|
+
|
|
55
|
+
Knip is not a regular file-based linter like ESLint. It works by analyzing the
|
|
56
|
+
entire interconnected module graph of your project. Using `ignore` patterns does
|
|
57
|
+
not exclude files from the analysis, it only suppresses the reporting of issues
|
|
58
|
+
in those files. This hides real issues and creates blind spots. Instead of
|
|
59
|
+
ignoring files, ensure your entry points and plugins are configured correctly,
|
|
60
|
+
and use `project` patterns to define the boundaries of your codebase. Read more:
|
|
61
|
+
[Configuring Project Files][3].
|
|
62
|
+
|
|
63
|
+
If you have specific exports (such as types) that are only used within the file
|
|
64
|
+
they are defined, use the [ignoreExportsUsedInFile][4] configuration option
|
|
65
|
+
rather than ignoring the file entirely.
|
|
66
|
+
|
|
67
|
+
### How should I exclude tests and development tools from the analysis?
|
|
68
|
+
|
|
69
|
+
A common mistake is trying to exclude test files, storybooks, or development
|
|
70
|
+
tools using `project` or `ignore` patterns. The correct approach is to use
|
|
71
|
+
[production mode][5]. This mode is specifically designed to strictly analyze
|
|
72
|
+
only your production source code and `dependencies`, automatically excluding
|
|
73
|
+
tests and `devDependencies` without requiring complex ignore rules.
|
|
74
|
+
|
|
75
|
+
### Why shouldn't I run `knip --fix` immediately?
|
|
76
|
+
|
|
77
|
+
Running `knip --fix` before your configuration is fully settled is dangerous. If
|
|
78
|
+
your configuration is missing entry points or has unresolved hints, Knip might
|
|
79
|
+
think perfectly valid, actively used code is unused. Auto-fixing in this state
|
|
80
|
+
can lead to deleting code that your application relies on. Always verify the
|
|
81
|
+
reported issues manually and ensure your configuration is solid before using the
|
|
82
|
+
`--fix` flag.
|
|
83
|
+
|
|
25
84
|
## Comparison
|
|
26
85
|
|
|
27
86
|
### Why isn't Knip an ESLint plugin?
|
|
@@ -38,27 +97,25 @@ File-oriented linters like ESLint are complementary to Knip.
|
|
|
38
97
|
### Isn't tree-shaking enough?
|
|
39
98
|
|
|
40
99
|
In short: no. They share an important goal: improve UX by removing unused code.
|
|
41
|
-
|
|
42
|
-
complementary tools.
|
|
100
|
+
But tree-shaking and Knip are different and complementary tools.
|
|
43
101
|
|
|
44
102
|
Tree-shaking is a build or compile-time activity to reduce production bundle
|
|
45
103
|
size. It typically operates on bundled production code, which might include
|
|
46
|
-
external/third-party code.
|
|
47
|
-
hands".
|
|
104
|
+
external/third-party code. A build time optimization and "out of your hands".
|
|
48
105
|
|
|
49
|
-
On the other hand, Knip is a project linter that should be part of the
|
|
50
|
-
It lints, reports and fixes only your own source code.
|
|
51
|
-
with other linters, focuses on inter-file dependencies, so
|
|
52
|
-
file may not be caught by Knip.
|
|
106
|
+
On the other hand, Knip is a project linter that should be part of the
|
|
107
|
+
development and QA phase. It lints, reports and fixes only your own source code.
|
|
108
|
+
Moreover, in contrast with other linters, focuses on inter-file dependencies, so
|
|
109
|
+
dead code within a file may not be caught by Knip.
|
|
53
110
|
|
|
54
|
-
Issues reported by the linter are
|
|
55
|
-
that Knip [auto-fixes][1] for you).
|
|
111
|
+
Issues reported by the linter are for you to handle and review.
|
|
56
112
|
|
|
57
113
|
Besides those differences, Knip has a broader scope:
|
|
58
114
|
|
|
59
|
-
- Improve DX (see [less is more][
|
|
60
|
-
-
|
|
61
|
-
|
|
115
|
+
- Improve DX (see [less is more][6]).
|
|
116
|
+
- Unless using [production mode][5], also lint all source code like tests,
|
|
117
|
+
scripts and Storybook stories.
|
|
118
|
+
- Handle more [types of issues][7] (such as unlisted dependencies).
|
|
62
119
|
|
|
63
120
|
## Synergy
|
|
64
121
|
|
|
@@ -91,13 +148,13 @@ Building up the module and dependency graphs requires non-standard module
|
|
|
91
148
|
resolution and not only static but also dynamic analysis (i.e. actually load and
|
|
92
149
|
execute modules), such as for parsers of plugins to receive the exported value
|
|
93
150
|
of dynamic tooling configuration files. Additionally, [exports consumed by
|
|
94
|
-
external libraries][
|
|
151
|
+
external libraries][8] require type information, as supported by the TypeScript
|
|
95
152
|
backend. Last but not least, shell script parsing is required to find the right
|
|
96
153
|
entry files, configuration files and dependencies accurately.
|
|
97
154
|
|
|
98
155
|
The rippling effect of plugins and recursively adding entry files and
|
|
99
156
|
dependencies to build up the graphs is also exactly what's meant by
|
|
100
|
-
["comprehensive" here][
|
|
157
|
+
["comprehensive" here][9].
|
|
101
158
|
|
|
102
159
|
## Building the graphs
|
|
103
160
|
|
|
@@ -145,7 +202,7 @@ files (`config/vitest.config.ts` and `playwright.e2e.config.ts` in the examples
|
|
|
145
202
|
above). They're recognized as configuration files and passed to their respective
|
|
146
203
|
plugins, and may contain additional entry files.
|
|
147
204
|
|
|
148
|
-
Entry files are added to the module graph. [Module resolution][
|
|
205
|
+
Entry files are added to the module graph. [Module resolution][10] might result
|
|
149
206
|
in additional entry files recursively until no more entry files are found.
|
|
150
207
|
|
|
151
208
|
### What does Knip look for in source files?
|
|
@@ -158,7 +215,7 @@ all nodes of the generated AST to find:
|
|
|
158
215
|
- Accessed properties on namespace imports and re-exports to track individual
|
|
159
216
|
export usage
|
|
160
217
|
- Calls to `require.resolve` and `import.meta.resolve`
|
|
161
|
-
- Scripts in template strings (passed to [script parser][
|
|
218
|
+
- Scripts in template strings (passed to [script parser][11])
|
|
162
219
|
|
|
163
220
|
### What's in the graphs?
|
|
164
221
|
|
|
@@ -196,7 +253,7 @@ there are a few issues with this approach:
|
|
|
196
253
|
|
|
197
254
|
- It requires lockfile parsing for each lockfile format and version of each
|
|
198
255
|
package manager.
|
|
199
|
-
- The lockfile doesn't contain whether the package [has types included][
|
|
256
|
+
- The lockfile doesn't contain whether the package [has types included][12].
|
|
200
257
|
|
|
201
258
|
## Module Resolution
|
|
202
259
|
|
|
@@ -217,12 +274,12 @@ seem to meet all requirements to be usable on its own by Knip:
|
|
|
217
274
|
`module.js`
|
|
218
275
|
|
|
219
276
|
A few strategies have been tried and tweaked, and Knip currently uses a
|
|
220
|
-
combination of [oxc-resolver][
|
|
277
|
+
combination of [oxc-resolver][13], the TypeScript module resolver and a few
|
|
221
278
|
customizations. This single custom module resolver function is hooked into the
|
|
222
279
|
TypeScript compiler and language service hosts.
|
|
223
280
|
|
|
224
|
-
Everything else is handled by `oxc-resolver` for things like [script
|
|
225
|
-
and resolving references to files in other workspaces.
|
|
281
|
+
Everything else is handled by `oxc-resolver` for things like [script
|
|
282
|
+
parsing][11] and resolving references to files in other workspaces.
|
|
226
283
|
|
|
227
284
|
### How does Knip handle non-standard import syntax?
|
|
228
285
|
|
|
@@ -252,7 +309,7 @@ file. They're not a concept in Knip.
|
|
|
252
309
|
|
|
253
310
|
A TypeScript program has a 1-to-1 relationship with workspaces if they're
|
|
254
311
|
analyzed in isolation. However, by default Knip optimizes for performance and
|
|
255
|
-
utilizes [workspace sharing][
|
|
312
|
+
utilizes [workspace sharing][14]. That's why debug output contains messages like
|
|
256
313
|
"Installed 2 programs for 29 workspaces".
|
|
257
314
|
|
|
258
315
|
### Why doesn't Knip match my TypeScript project structure?
|
|
@@ -284,7 +341,7 @@ Knip shares the files of multiple workspaces in a single program if their
|
|
|
284
341
|
configuration allows it. This optimization is enabled by default, while it also
|
|
285
342
|
allows the module resolver (one per program) to do some more caching.
|
|
286
343
|
|
|
287
|
-
Also see [workspace sharing][
|
|
344
|
+
Also see [workspace sharing][14].
|
|
288
345
|
|
|
289
346
|
### Why doesn't Knip just use `ts.findReferences`?
|
|
290
347
|
|
|
@@ -300,34 +357,31 @@ comprehensive graph include:
|
|
|
300
357
|
Without sacrificing these benefits, Knip does use `ts.findReferences` to find
|
|
301
358
|
references to class members (i.e. when the issue type `classMembers` is
|
|
302
359
|
included). In case analysis of exports requires type information of external
|
|
303
|
-
dependencies, the [`--include-libs ` flag][
|
|
360
|
+
dependencies, the [`--include-libs ` flag][8] will trigger the same.
|
|
304
361
|
|
|
305
362
|
### Why can't I use path aliases to reference other workspaces?
|
|
306
363
|
|
|
307
364
|
Projects can use `compilerOptions.paths` to alias paths in other workspaces in
|
|
308
365
|
the same monorepo. Knip doesn't understand those paths might represent internal
|
|
309
|
-
workspaces and might report false positives.
|
|
310
|
-
complicated, but a major reason is that Knip does it's job based on the
|
|
311
|
-
workspace graph, while [workspaces are different from TypeScript programs][11]
|
|
312
|
-
and [the workspace graph doesn't match TypeScript project structure][12].
|
|
366
|
+
workspaces and might report false positives.
|
|
313
367
|
|
|
314
368
|
The recommendation and best practice is to list such workspaces/dependencies in
|
|
315
369
|
`package.json`, and import them as such. Other tooling should not have any
|
|
316
370
|
issues with this standard approach either.
|
|
317
371
|
|
|
318
|
-
Also see the example in [TypeScript path aliases in monorepos][
|
|
372
|
+
Also see the example in [TypeScript path aliases in monorepos][15].
|
|
319
373
|
|
|
320
374
|
### What's up with that configurable `tsconfig.json` location?
|
|
321
375
|
|
|
322
376
|
There's a difference between `--tsConfig [file]` as a CLI argument and the
|
|
323
377
|
`typescript.config` option in Knip configuration.
|
|
324
378
|
|
|
325
|
-
The [`--tsConfig [file]` option][
|
|
379
|
+
The [`--tsConfig [file]` option][16] is used to provide an alternative location
|
|
326
380
|
for the default root `tsconfig.json` file. Relevant `compilerOptions` include
|
|
327
381
|
`paths` and `moduleResolution`. This setting is only available at the root
|
|
328
382
|
level.
|
|
329
383
|
|
|
330
|
-
On the other hand, the [`config` option of the plugin][
|
|
384
|
+
On the other hand, the [`config` option of the plugin][17] can be set per
|
|
331
385
|
workspace. The TypeScript plugin extracts referenced external dependencies such
|
|
332
386
|
as those in `extends`, `compilerOptions.types` and JSX settings:
|
|
333
387
|
|
|
@@ -351,7 +405,7 @@ From this example, Knip can determine whether the `@tsconfig/node20` and
|
|
|
351
405
|
for `tsconfig.json` can be set per workspace.
|
|
352
406
|
- In case path aliases from `compilerOptions.paths` aren't picked up by Knip,
|
|
353
407
|
either use `--tsConfig [file]` to target a different `tsconfig.json`, or
|
|
354
|
-
manually add [paths][
|
|
408
|
+
manually add [paths][18] to the Knip configuration. The latter can be done per
|
|
355
409
|
workspace.
|
|
356
410
|
|
|
357
411
|
## Compilers
|
|
@@ -374,7 +428,7 @@ other file types.
|
|
|
374
428
|
Knip comes with basic "compilers" for a few common non-standard file types.
|
|
375
429
|
They're not actual compilers, they're regular expressions only to extract import
|
|
376
430
|
statements. Override the built-in Vue "compiler" with the real one in your
|
|
377
|
-
project. Also see the answer to the previous question and [Compilers][
|
|
431
|
+
project. Also see the answer to the previous question and [Compilers][19].
|
|
378
432
|
|
|
379
433
|
## Miscellaneous
|
|
380
434
|
|
|
@@ -394,7 +448,7 @@ Which mode should've been the default? They both have their merits:
|
|
|
394
448
|
tooling, including most issues found in production mode. This mode has the
|
|
395
449
|
most impact on DX, for the same reason.
|
|
396
450
|
|
|
397
|
-
Also see [production mode][
|
|
451
|
+
Also see [production mode][5].
|
|
398
452
|
|
|
399
453
|
### Why doesn't Knip have...?
|
|
400
454
|
|
|
@@ -408,34 +462,32 @@ Examples of features that have been requested include:
|
|
|
408
462
|
- Unused object members (and e.g. React component props)
|
|
409
463
|
- Unused object props in function return values
|
|
410
464
|
- Analyze workspaces in parallel
|
|
411
|
-
- Plugins for editors like VS Code and WebStorm (LSP-based?)
|
|
412
465
|
- Support Deno
|
|
413
466
|
- Improve internal code structures and accessibility to support contributions
|
|
414
|
-
- One-shot dead code removal (more comprehensive removal of unused variables,
|
|
415
|
-
duplicate exports, dead code, etc).
|
|
416
467
|
- Replace dependencies for better performance and correctness, such as for shell
|
|
417
|
-
script parsing
|
|
468
|
+
script parsing and globbing with "unignores".
|
|
418
469
|
|
|
419
470
|
These are all interesting ideas, but most increase the API surface area, and all
|
|
420
471
|
require more development efforts and maintenance. Time is limited and
|
|
421
|
-
[sponsorships][
|
|
422
|
-
|
|
423
|
-
[1]: ../
|
|
424
|
-
[2]: ../
|
|
425
|
-
[3]:
|
|
426
|
-
[4]: ../
|
|
427
|
-
[5]: ../
|
|
428
|
-
[6]: #
|
|
429
|
-
[7]:
|
|
430
|
-
[8]: ../guides/handling-issues.mdx#
|
|
431
|
-
[9]:
|
|
432
|
-
[10]:
|
|
433
|
-
[11]:
|
|
434
|
-
[12]: #
|
|
435
|
-
[13]:
|
|
436
|
-
[14]: ../
|
|
437
|
-
[15]: ../
|
|
438
|
-
[16]: ../reference/
|
|
439
|
-
[17]: ../
|
|
440
|
-
[18]: ../
|
|
441
|
-
[19]: /
|
|
472
|
+
[sponsorships][20] currently don't cover - this can change though!
|
|
473
|
+
|
|
474
|
+
[1]: ../reference/integrations.md#mcp-server
|
|
475
|
+
[2]: ../reference/integrations.md#vs-code-extension
|
|
476
|
+
[3]: ../guides/configuring-project-files.md
|
|
477
|
+
[4]: ../reference/configuration.md#ignoreexportsusedinfile
|
|
478
|
+
[5]: ../features/production-mode.md
|
|
479
|
+
[6]: ../explanations/why-use-knip.md#less-is-more
|
|
480
|
+
[7]: ./issue-types.md
|
|
481
|
+
[8]: ../guides/handling-issues.mdx#external-libraries
|
|
482
|
+
[9]: ../explanations/why-use-knip.md#comprehensive
|
|
483
|
+
[10]: #module-resolution
|
|
484
|
+
[11]: ../features/script-parser.md
|
|
485
|
+
[12]: ../guides/handling-issues.mdx#type-definition-packages
|
|
486
|
+
[13]: https://oxc.rs/docs/guide/usage/resolver.html
|
|
487
|
+
[14]: ../guides/performance.md#workspace-sharing
|
|
488
|
+
[15]: ../guides/handling-issues.mdx#typescript-path-aliases-in-monorepos
|
|
489
|
+
[16]: ../reference/cli.md#--tsconfig-file
|
|
490
|
+
[17]: ../explanations/plugins.md#configuration-files
|
|
491
|
+
[18]: ../reference/configuration.md#paths
|
|
492
|
+
[19]: ../features/compilers.md
|
|
493
|
+
[20]: /sponsors
|
|
@@ -30,7 +30,7 @@ Example:
|
|
|
30
30
|
export const myUnusedExport = 1;
|
|
31
31
|
|
|
32
32
|
/** @lintignore */
|
|
33
|
-
import Unresolved from
|
|
33
|
+
import Unresolved from "./generated/lib.js";
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
And then include (`+`) or exclude (`-`) these tagged exports from the report
|
|
@@ -42,6 +42,17 @@ knip --tags=-lintignore,-internal
|
|
|
42
42
|
|
|
43
43
|
Tags can also be [configured in `knip.json`][2].
|
|
44
44
|
|
|
45
|
+
When an excluded tag is no longer necessary because the export is actually used,
|
|
46
|
+
Knip reports a **tag hint**:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
Tag hints (1)
|
|
50
|
+
ignored unimported.ts Unused tag in unimported.ts: ignored → @custom
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This helps you clean up tags that were added to suppress issues that have since
|
|
54
|
+
been resolved.
|
|
55
|
+
|
|
45
56
|
## `@public`
|
|
46
57
|
|
|
47
58
|
By default, Knip reports unused exports in non-entry files.
|
|
@@ -2,31 +2,50 @@
|
|
|
2
2
|
title: Known Issues
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
List of known issues and workarounds for exceptions thrown during a Knip run.
|
|
6
|
+
|
|
7
|
+
See [handling issues][1] to learn more about dealing with lint issues.
|
|
6
8
|
|
|
7
9
|
## Exceptions from config files
|
|
8
10
|
|
|
9
11
|
An exception may be thrown when a Knip plugin loads a JavaScript or TypeScript
|
|
10
|
-
configuration file such as `webpack.config.js` or `vite.config.ts
|
|
11
|
-
load such files differently, in a different environment, or without certain
|
|
12
|
-
environment variables set.
|
|
12
|
+
configuration file such as `webpack.config.js` or `vite.config.ts`:
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
```sh
|
|
15
|
+
$ knip
|
|
16
|
+
Error loading .../vite.config.ts
|
|
17
|
+
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Knip may load such files differently, in a different environment, with missing
|
|
20
|
+
environment variables, missing path aliases, etcetera. Use `--debug` to locate
|
|
21
|
+
the cause of the issue with more details.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
Potential workarounds:
|
|
24
|
+
|
|
25
|
+
- [Set path aliases][2] for "Cannot find module" errors
|
|
26
|
+
- Set missing environment variable(s), potential solutions:
|
|
27
|
+
- Use a helper package like [dotenvx][3]
|
|
28
|
+
- `KEY=VAL knip`
|
|
29
|
+
- `node --env-file .env $(which knip)`
|
|
30
|
+
- Disable loading the file by overriding the default `config` for that plugin.
|
|
31
|
+
- Example: `vite: { config: [] }`
|
|
32
|
+
- In a monorepo, be more specific like so:
|
|
33
|
+
`workspaces: { "packages/lib": { vite: { config: [] } } }`
|
|
34
|
+
- If this helps, add the file as an `entry` file for static analysis.
|
|
35
|
+
- Disable the related plugin.
|
|
36
|
+
- Example: `eslint: false`
|
|
37
|
+
- In a monorepo, be more specific like so:
|
|
38
|
+
`workspaces: { "packages/lib": { eslint: false } }`
|
|
39
|
+
- If this helps, add the file as an `entry` file for static analysis.
|
|
40
|
+
- As a last resort, ignore the workspace: `ignoreWorkspaces: ["packages/lib"]`.
|
|
23
41
|
|
|
24
42
|
## Path aliases in config files
|
|
25
43
|
|
|
26
44
|
Loading the configuration file (e.g. `cypress.config.ts`) for one of Knip's
|
|
27
45
|
plugins may give an error:
|
|
28
46
|
|
|
29
|
-
```
|
|
47
|
+
```sh
|
|
48
|
+
$ knip
|
|
30
49
|
Analyzing workspace ....
|
|
31
50
|
Error loading .../cypress.config.ts
|
|
32
51
|
Reason: Cannot find module '@alias/name'
|
|
@@ -35,15 +54,15 @@ Require stack:
|
|
|
35
54
|
```
|
|
36
55
|
|
|
37
56
|
Some tools (such as Cypress and Jest) support using TypeScript path aliases in
|
|
38
|
-
the configuration file.
|
|
39
|
-
compared to `tsconfig.json#compilerOptions.paths` and `knip.json#paths` (e.g.
|
|
40
|
-
the target values are not arrays).
|
|
57
|
+
the configuration file.
|
|
41
58
|
|
|
42
59
|
Potential workarounds:
|
|
43
60
|
|
|
44
61
|
- Rewrite the import in the configuration file to a relative import.
|
|
45
|
-
-
|
|
46
|
-
-
|
|
62
|
+
- Inject support with a module like `tsx`: `NODE_OPTIONS="--import tsx" knip`
|
|
63
|
+
- Or `tsconfig-paths`: `NODE_OPTIONS="--import tsconfig-paths/register.js" knip`
|
|
64
|
+
- Use Bun with [knip-bun][4].
|
|
65
|
+
- See [exceptions from config files][5] for more potential workarounds.
|
|
47
66
|
|
|
48
67
|
## Nx Daemon
|
|
49
68
|
|
|
@@ -53,12 +72,15 @@ In Nx projects you might encounter this error:
|
|
|
53
72
|
NX Daemon process terminated and closed the connection
|
|
54
73
|
```
|
|
55
74
|
|
|
56
|
-
The solution is to [disable the Nx Daemon][
|
|
75
|
+
The solution is to [disable the Nx Daemon][6]:
|
|
57
76
|
|
|
58
77
|
```sh
|
|
59
78
|
NX_DAEMON=false knip
|
|
60
79
|
```
|
|
61
80
|
|
|
62
|
-
[1]:
|
|
63
|
-
[2]:
|
|
64
|
-
[3]: https://
|
|
81
|
+
[1]: ../guides/handling-issues.mdx
|
|
82
|
+
[2]: #path-aliases-in-config-files
|
|
83
|
+
[3]: https://dotenvx.com/
|
|
84
|
+
[4]: ./cli.md#knip-bun
|
|
85
|
+
[5]: #exceptions-from-config-files
|
|
86
|
+
[6]: https://nx.dev/concepts/nx-daemon#turning-it-off
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Plugins (
|
|
2
|
+
title: Plugins (137)
|
|
3
3
|
tableOfContents: false
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@ tableOfContents: false
|
|
|
7
7
|
- [Angular](/reference/plugins/angular "Angular")
|
|
8
8
|
- [Astro](/reference/plugins/astro "Astro")
|
|
9
9
|
- [Astro DB](/reference/plugins/astro-db "Astro DB")
|
|
10
|
+
- [astro-og-canvas](/reference/plugins/astro-og-canvas "astro-og-canvas")
|
|
10
11
|
- [Ava](/reference/plugins/ava "Ava")
|
|
11
12
|
- [Babel](/reference/plugins/babel "Babel")
|
|
12
13
|
- [Biome](/reference/plugins/biome "Biome")
|
|
@@ -31,7 +32,9 @@ tableOfContents: false
|
|
|
31
32
|
- [Drizzle](/reference/plugins/drizzle "Drizzle")
|
|
32
33
|
- [Eleventy](/reference/plugins/eleventy "Eleventy")
|
|
33
34
|
- [ESLint](/reference/plugins/eslint "ESLint")
|
|
35
|
+
- [execa](/reference/plugins/execa "execa")
|
|
34
36
|
- [Expo](/reference/plugins/expo "Expo")
|
|
37
|
+
- [Expressive Code](/reference/plugins/expressive-code "Expressive Code")
|
|
35
38
|
- [Gatsby](/reference/plugins/gatsby "Gatsby")
|
|
36
39
|
- [GitHub Action](/reference/plugins/github-action "GitHub Action")
|
|
37
40
|
- [GitHub Actions](/reference/plugins/github-actions "GitHub Actions")
|
|
@@ -42,6 +45,7 @@ tableOfContents: false
|
|
|
42
45
|
- [i18next Parser](/reference/plugins/i18next-parser "i18next Parser")
|
|
43
46
|
- [Jest](/reference/plugins/jest "Jest")
|
|
44
47
|
- [Karma](/reference/plugins/karma "Karma")
|
|
48
|
+
- [Knex](/reference/plugins/knex "Knex")
|
|
45
49
|
- [Ladle](/reference/plugins/ladle "Ladle")
|
|
46
50
|
- [Lefthook](/reference/plugins/lefthook "Lefthook")
|
|
47
51
|
- [lint-staged](/reference/plugins/lint-staged "lint-staged")
|
|
@@ -61,6 +65,7 @@ tableOfContents: false
|
|
|
61
65
|
- [Next.js](/reference/plugins/next "Next.js")
|
|
62
66
|
- [next-intl](/reference/plugins/next-intl "next-intl")
|
|
63
67
|
- [Next.js MDX](/reference/plugins/next-mdx "Next.js MDX")
|
|
68
|
+
- [Nitro](/reference/plugins/nitro "Nitro")
|
|
64
69
|
- [Node.js](/reference/plugins/node "Node.js")
|
|
65
70
|
- [node-modules-inspector](/reference/plugins/node-modules-inspector "node-modules-inspector")
|
|
66
71
|
- [nodemon](/reference/plugins/nodemon "nodemon")
|
|
@@ -70,16 +75,21 @@ tableOfContents: false
|
|
|
70
75
|
- [nyc](/reference/plugins/nyc "nyc")
|
|
71
76
|
- [oclif](/reference/plugins/oclif "oclif")
|
|
72
77
|
- [Oxlint](/reference/plugins/oxlint "Oxlint")
|
|
78
|
+
- [Parcel](/reference/plugins/parcel "Parcel")
|
|
79
|
+
- [Payload CMS](/reference/plugins/payload "Payload CMS")
|
|
73
80
|
- [Playwright](/reference/plugins/playwright "Playwright")
|
|
74
81
|
- [Playwright for components](/reference/plugins/playwright-ct "Playwright for components")
|
|
75
82
|
- [playwright-test](/reference/plugins/playwright-test "playwright-test")
|
|
76
83
|
- [Plop](/reference/plugins/plop "Plop")
|
|
84
|
+
- [pm2](/reference/plugins/pm2 "pm2")
|
|
77
85
|
- [pnpm](/reference/plugins/pnpm "pnpm")
|
|
78
86
|
- [PostCSS](/reference/plugins/postcss "PostCSS")
|
|
79
87
|
- [Preconstruct](/reference/plugins/preconstruct "Preconstruct")
|
|
80
88
|
- [Prettier](/reference/plugins/prettier "Prettier")
|
|
81
89
|
- [Prisma](/reference/plugins/prisma "Prisma")
|
|
90
|
+
- [Qwik](/reference/plugins/qwik "Qwik")
|
|
82
91
|
- [React Cosmos](/reference/plugins/react-cosmos "React Cosmos")
|
|
92
|
+
- [React Native](/reference/plugins/react-native "React Native")
|
|
83
93
|
- [React Router](/reference/plugins/react-router "React Router")
|
|
84
94
|
- [Relay](/reference/plugins/relay "Relay")
|
|
85
95
|
- [Release It!](/reference/plugins/release-it "Release It!")
|
|
@@ -100,11 +110,13 @@ tableOfContents: false
|
|
|
100
110
|
- [Stryker](/reference/plugins/stryker "Stryker")
|
|
101
111
|
- [Stylelint](/reference/plugins/stylelint "Stylelint")
|
|
102
112
|
- [Svelte](/reference/plugins/svelte "Svelte")
|
|
113
|
+
- [SvelteKit](/reference/plugins/sveltekit "SvelteKit")
|
|
103
114
|
- [SVGO](/reference/plugins/svgo "SVGO")
|
|
104
115
|
- [SVGR](/reference/plugins/svgr "SVGR")
|
|
105
116
|
- [SWC](/reference/plugins/swc "SWC")
|
|
106
117
|
- [Syncpack](/reference/plugins/syncpack "Syncpack")
|
|
107
118
|
- [Tailwind](/reference/plugins/tailwind "Tailwind")
|
|
119
|
+
- [TanStack Router](/reference/plugins/tanstack-router "TanStack Router")
|
|
108
120
|
- [Taskfile](/reference/plugins/taskfile "Taskfile")
|
|
109
121
|
- [Travis CI](/reference/plugins/travis "Travis CI")
|
|
110
122
|
- [ts-node](/reference/plugins/ts-node "ts-node")
|
|
@@ -118,6 +130,7 @@ tableOfContents: false
|
|
|
118
130
|
- [Vercel OG](/reference/plugins/vercel-og "Vercel OG")
|
|
119
131
|
- [Vike](/reference/plugins/vike "Vike")
|
|
120
132
|
- [Vite](/reference/plugins/vite "Vite")
|
|
133
|
+
- [VitePress](/reference/plugins/vitepress "VitePress")
|
|
121
134
|
- [Vitest](/reference/plugins/vitest "Vitest")
|
|
122
135
|
- [Vue](/reference/plugins/vue "Vue")
|
|
123
136
|
- [WebdriverIO](/reference/plugins/webdriver-io "WebdriverIO")
|
|
@@ -127,6 +140,7 @@ tableOfContents: false
|
|
|
127
140
|
- [xo](/reference/plugins/xo "xo")
|
|
128
141
|
- [Yarn](/reference/plugins/yarn "Yarn")
|
|
129
142
|
- [yorkie](/reference/plugins/yorkie "yorkie")
|
|
143
|
+
- [zx](/reference/plugins/zx "zx")
|
|
130
144
|
|
|
131
145
|
|
|
132
146
|
:::
|
|
@@ -4,10 +4,10 @@ title: Related Tooling
|
|
|
4
4
|
|
|
5
5
|
This is an overview of related tooling for features Knip does not support.
|
|
6
6
|
|
|
7
|
-
## Unused variables
|
|
7
|
+
## Unused imports & variables
|
|
8
8
|
|
|
9
|
-
Knip doesn't look for unused variables within a file. The focus is
|
|
10
|
-
|
|
9
|
+
Knip doesn't look for unused imports and variables within a file. The focus is
|
|
10
|
+
on exported values and types across files.
|
|
11
11
|
|
|
12
12
|
Use [ESLint][1], [Biome][2] or [oxlint][3] to find unused variables within
|
|
13
13
|
files.
|
package/src/docs/sponsors.mdx
CHANGED
|
@@ -8,7 +8,6 @@ import Posts from '../../components/Posts.astro';
|
|
|
8
8
|
import Projects from '../../components/Projects.astro';
|
|
9
9
|
import SponsorsComponent from '../../components/Sponsors.astro';
|
|
10
10
|
import SponsorsChart from '../../components/SponsorsChart.astro';
|
|
11
|
-
import SponsorsPast from '../../components/SponsorsPast.astro';
|
|
12
11
|
|
|
13
12
|
:::article{.prose}
|
|
14
13
|
|
|
@@ -40,8 +39,8 @@ one year before that.
|
|
|
40
39
|
|
|
41
40
|
<SponsorsChart />
|
|
42
41
|
|
|
43
|
-
- The monthly aggregated average over the charted period is $
|
|
44
|
-
- The monthly recurring average without one-time payments is $
|
|
42
|
+
- The monthly aggregated average over the charted period is $513.
|
|
43
|
+
- The monthly recurring average without one-time payments is $350.
|
|
45
44
|
- GitHub Sponsors is for my GitHub account. This has more repositories, but in
|
|
46
45
|
practice targets mostly Knip (and perhaps some [release-it][5]).
|
|
47
46
|
- [Chart generated][6] using [Venz][7].
|
|
@@ -61,5 +60,5 @@ one year before that.
|
|
|
61
60
|
[3]: https://github.com/sponsors/webpro
|
|
62
61
|
[4]: https://opencollective.com/knip
|
|
63
62
|
[5]: https://github.com/release-it/release-it
|
|
64
|
-
[6]: https://try.venz.dev?type=pivot&lp=tr&br=0&labelX=month&labelY=amount+\($\)&l=GitHub+Sponsors&color=%23fbfbfb&l=Open+Collective&color=%232487ff&label=2023-11&data=9,0&label=2023-12&data=74,0&label=2024-01&data=239,0&label=2024-02&data=489,0&label=2024-03&data=189,0&label=2024-04&data=204,750&label=2024-05&data=304,101&label=2024-06&data=1204,0&label=2024-07&data=204,35&label=2024-08&data=229,25&label=2024-09&data=2729,25&label=2024-10&data=410,45&label=2024-11&data=222,45&label=2024-12&data=222,145&label=2025-01&data=342,145&label=2025-02&data=244,145&label=2025-03&data=222,145&label=2025-04&data=222,145&label=2025-05&data=242,145&label=2025-06&data=247,145&label=2025-07&data=297,145&label=2025-08&data=268,145&label=2025-09&data=350,145&label=2025-10&data=375,145
|
|
63
|
+
[6]: https://try.venz.dev?type=pivot&lp=tr&br=0&labelX=month&labelY=amount+\($\)&l=GitHub+Sponsors&color=%23fbfbfb&l=Open+Collective&color=%232487ff&label=2023-11&data=9,0&label=2023-12&data=74,0&label=2024-01&data=239,0&label=2024-02&data=489,0&label=2024-03&data=189,0&label=2024-04&data=204,750&label=2024-05&data=304,101&label=2024-06&data=1204,0&label=2024-07&data=204,35&label=2024-08&data=229,25&label=2024-09&data=2729,25&label=2024-10&data=410,45&label=2024-11&data=222,45&label=2024-12&data=222,145&label=2025-01&data=342,145&label=2025-02&data=244,145&label=2025-03&data=222,145&label=2025-04&data=222,145&label=2025-05&data=242,145&label=2025-06&data=247,145&label=2025-07&data=297,145&label=2025-08&data=268,145&label=2025-09&data=350,145&label=2025-10&data=375,145&label=2025-11&data=549,145&label=2025-12&data=355,145
|
|
65
64
|
[7]: https://try.venz.dev
|
|
@@ -68,7 +68,7 @@ to easily navigate around.
|
|
|
68
68
|
|
|
69
69
|
## How is Knip different from ESLint for finding unused exports?
|
|
70
70
|
|
|
71
|
-
While linters like ESLint can find unused
|
|
71
|
+
While linters like ESLint can find unused imports and variables within
|
|
72
72
|
individual files, Knip analyzes the entire project to determine which exports
|
|
73
73
|
are actually unused. By building [a comprehensive module graph][7], Knip
|
|
74
74
|
identifies exports that are not imported or used anywhere in the codebase. This
|