@knip/mcp 0.0.12 → 0.0.14
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 +3 -3
- package/src/docs/docs/blog/for-editors-and-agents.md +44 -44
- package/src/docs/docs/blog/knip-v4.mdx +2 -2
- package/src/docs/docs/blog/two-years.mdx +1 -1
- package/src/docs/docs/explanations/plugins.md +16 -6
- package/src/docs/docs/guides/configuring-project-files.md +12 -12
- package/src/docs/docs/guides/contributing.md +1 -1
- package/src/docs/docs/guides/handling-issues.mdx +110 -64
- package/src/docs/docs/guides/issue-reproduction.md +4 -0
- package/src/docs/docs/guides/troubleshooting.md +4 -7
- package/src/docs/docs/index.mdx +3 -3
- package/src/docs/docs/overview/configuration.md +6 -6
- package/src/docs/docs/reference/configuration.md +17 -7
- package/src/docs/docs/reference/known-issues.md +32 -19
- package/src/docs/docs/reference/plugins/angular.md +10 -6
- package/src/docs/docs/reference/plugins/astro-db.md +10 -7
- package/src/docs/docs/reference/plugins/astro.md +10 -6
- package/src/docs/docs/reference/plugins/ava.md +10 -7
- package/src/docs/docs/reference/plugins/babel.md +9 -3
- package/src/docs/docs/reference/plugins/biome.md +10 -7
- package/src/docs/docs/reference/plugins/bumpp.md +9 -3
- package/src/docs/docs/reference/plugins/bun.md +6 -22
- package/src/docs/docs/reference/plugins/c8.md +7 -4
- package/src/docs/docs/reference/plugins/capacitor.md +10 -6
- package/src/docs/docs/reference/plugins/changelogen.md +9 -3
- package/src/docs/docs/reference/plugins/changelogithub.md +9 -3
- package/src/docs/docs/reference/plugins/changesets.md +10 -6
- package/src/docs/docs/reference/plugins/commitizen.md +10 -8
- package/src/docs/docs/reference/plugins/commitlint.md +9 -3
- package/src/docs/docs/reference/plugins/convex.md +10 -7
- package/src/docs/docs/reference/plugins/create-typescript-app.md +10 -6
- package/src/docs/docs/reference/plugins/cspell.md +9 -3
- package/src/docs/docs/reference/plugins/cucumber.md +11 -9
- package/src/docs/docs/reference/plugins/cypress.md +10 -6
- package/src/docs/docs/reference/plugins/danger.md +10 -6
- package/src/docs/docs/reference/plugins/dependency-cruiser.md +14 -9
- package/src/docs/docs/reference/plugins/docusaurus.md +10 -6
- package/src/docs/docs/reference/plugins/dotenv.md +8 -4
- package/src/docs/docs/reference/plugins/drizzle.md +10 -6
- package/src/docs/docs/reference/plugins/eleventy.md +11 -11
- package/src/docs/docs/reference/plugins/eslint.md +22 -10
- package/src/docs/docs/reference/plugins/expo.md +11 -11
- package/src/docs/docs/reference/plugins/gatsby.md +9 -3
- package/src/docs/docs/reference/plugins/github-action.md +10 -6
- package/src/docs/docs/reference/plugins/github-actions.md +10 -7
- package/src/docs/docs/reference/plugins/glob.md +8 -4
- package/src/docs/docs/reference/plugins/graphql-codegen.md +9 -3
- package/src/docs/docs/reference/plugins/hardhat.md +10 -6
- package/src/docs/docs/reference/plugins/husky.md +9 -3
- package/src/docs/docs/reference/plugins/i18next-parser.md +14 -9
- package/src/docs/docs/reference/plugins/jest.md +14 -10
- package/src/docs/docs/reference/plugins/karma.md +9 -3
- package/src/docs/docs/reference/plugins/ladle.md +11 -9
- package/src/docs/docs/reference/plugins/lefthook.md +13 -7
- package/src/docs/docs/reference/plugins/lint-staged.md +9 -3
- package/src/docs/docs/reference/plugins/linthtml.md +9 -3
- package/src/docs/docs/reference/plugins/lockfile-lint.md +9 -3
- package/src/docs/docs/reference/plugins/lost-pixel.md +10 -6
- package/src/docs/docs/reference/plugins/markdownlint.md +10 -7
- package/src/docs/docs/reference/plugins/mdx.md +10 -6
- package/src/docs/docs/reference/plugins/mdxlint.md +9 -3
- package/src/docs/docs/reference/plugins/metro.md +12 -9
- package/src/docs/docs/reference/plugins/mocha.md +15 -13
- package/src/docs/docs/reference/plugins/moonrepo.md +10 -8
- package/src/docs/docs/reference/plugins/msw.md +11 -9
- package/src/docs/docs/reference/plugins/nano-staged.md +9 -3
- package/src/docs/docs/reference/plugins/nest.md +10 -9
- package/src/docs/docs/reference/plugins/netlify.md +11 -9
- package/src/docs/docs/reference/plugins/next-intl.md +10 -6
- package/src/docs/docs/reference/plugins/next-mdx.md +11 -9
- package/src/docs/docs/reference/plugins/next.md +10 -6
- package/src/docs/docs/reference/plugins/node-modules-inspector.md +11 -4
- package/src/docs/docs/reference/plugins/node.md +12 -8
- package/src/docs/docs/reference/plugins/nodemon.md +8 -4
- package/src/docs/docs/reference/plugins/npm-package-json-lint.md +9 -3
- package/src/docs/docs/reference/plugins/nuxt.md +14 -8
- package/src/docs/docs/reference/plugins/nx.md +15 -7
- package/src/docs/docs/reference/plugins/nyc.md +9 -3
- package/src/docs/docs/reference/plugins/oclif.md +10 -6
- package/src/docs/docs/reference/plugins/oxlint.md +14 -9
- package/src/docs/docs/reference/plugins/playwright-ct.md +12 -8
- package/src/docs/docs/reference/plugins/playwright-test.md +10 -5
- package/src/docs/docs/reference/plugins/playwright.md +15 -12
- package/src/docs/docs/reference/plugins/plop.md +10 -6
- package/src/docs/docs/reference/plugins/pnpm.md +8 -5
- package/src/docs/docs/reference/plugins/postcss.md +9 -3
- package/src/docs/docs/reference/plugins/preconstruct.md +10 -6
- package/src/docs/docs/reference/plugins/prettier.md +9 -3
- package/src/docs/docs/reference/plugins/prisma.md +14 -10
- package/src/docs/docs/reference/plugins/react-cosmos.md +10 -6
- package/src/docs/docs/reference/plugins/react-router.md +9 -3
- package/src/docs/docs/reference/plugins/relay.md +14 -10
- package/src/docs/docs/reference/plugins/release-it.md +10 -7
- package/src/docs/docs/reference/plugins/remark.md +9 -3
- package/src/docs/docs/reference/plugins/remix.md +9 -3
- package/src/docs/docs/reference/plugins/rollup.md +14 -9
- package/src/docs/docs/reference/plugins/rsbuild.md +10 -6
- package/src/docs/docs/reference/plugins/rslib.md +10 -6
- package/src/docs/docs/reference/plugins/rspack.md +10 -6
- package/src/docs/docs/reference/plugins/rstest.md +10 -6
- package/src/docs/docs/reference/plugins/semantic-release.md +9 -3
- package/src/docs/docs/reference/plugins/sentry.md +10 -6
- package/src/docs/docs/reference/plugins/simple-git-hooks.md +9 -3
- package/src/docs/docs/reference/plugins/size-limit.md +9 -3
- package/src/docs/docs/reference/plugins/sst.md +10 -6
- package/src/docs/docs/reference/plugins/starlight.md +10 -6
- package/src/docs/docs/reference/plugins/storybook.md +11 -9
- package/src/docs/docs/reference/plugins/stryker.md +10 -6
- package/src/docs/docs/reference/plugins/stylelint.md +9 -3
- package/src/docs/docs/reference/plugins/svelte.md +9 -3
- package/src/docs/docs/reference/plugins/svgo.md +10 -6
- package/src/docs/docs/reference/plugins/svgr.md +9 -3
- package/src/docs/docs/reference/plugins/swc.md +10 -6
- package/src/docs/docs/reference/plugins/syncpack.md +9 -3
- package/src/docs/docs/reference/plugins/tailwind.md +10 -6
- package/src/docs/docs/reference/plugins/taskfile.md +10 -7
- package/src/docs/docs/reference/plugins/travis.md +8 -5
- package/src/docs/docs/reference/plugins/ts-node.md +8 -4
- package/src/docs/docs/reference/plugins/tsdown.md +14 -10
- package/src/docs/docs/reference/plugins/tsup.md +14 -10
- package/src/docs/docs/reference/plugins/tsx.md +12 -8
- package/src/docs/docs/reference/plugins/typedoc.md +13 -6
- package/src/docs/docs/reference/plugins/typescript.md +16 -10
- package/src/docs/docs/reference/plugins/unbuild.md +10 -6
- package/src/docs/docs/reference/plugins/unocss.md +9 -3
- package/src/docs/docs/reference/plugins/vercel-og.md +9 -3
- package/src/docs/docs/reference/plugins/vike.md +9 -3
- package/src/docs/docs/reference/plugins/vite.md +14 -9
- package/src/docs/docs/reference/plugins/vitepress.md +40 -0
- package/src/docs/docs/reference/plugins/vitest.md +13 -6
- package/src/docs/docs/reference/plugins/vue.md +10 -6
- package/src/docs/docs/reference/plugins/webdriver-io.md +10 -6
- package/src/docs/docs/reference/plugins/webpack.md +14 -9
- package/src/docs/docs/reference/plugins/wireit.md +10 -6
- package/src/docs/docs/reference/plugins/wrangler.md +10 -6
- package/src/docs/docs/reference/plugins/xo.md +10 -7
- package/src/docs/docs/reference/plugins/yarn.md +8 -5
- package/src/docs/docs/reference/plugins/yorkie.md +10 -6
- package/src/docs/docs/sponsors.mdx +2 -3
- package/src/texts.js +19 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knip/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Knip MCP Server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"author": "Lars Kappert <lars@webpro.nl>",
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
30
30
|
"zod": "^4.1.11",
|
|
31
|
-
"knip": "^5.
|
|
31
|
+
"knip": "^5.80.0"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=18.18.0"
|
|
@@ -7,32 +7,31 @@ sidebar:
|
|
|
7
7
|
|
|
8
8
|
_Published: 2025-12-17_
|
|
9
9
|
|
|
10
|
-
Three years in, Knip has
|
|
10
|
+
Three years in, Knip has found its place in [over 10.000 projects][1] and is
|
|
11
11
|
downloaded [over 18M times/month][2]. A long period of steady growth in usage
|
|
12
12
|
and stability allows Knip to become more accessible to more people. That's why
|
|
13
|
-
I'm excited and proud to introduce the brand new
|
|
14
|
-
Server. For humans and coding agents alike, Knip will help keep your
|
|
15
|
-
tidy.
|
|
13
|
+
I'm excited and proud to introduce the brand new [Editor Extension][3] **and**
|
|
14
|
+
MCP Server. For humans and coding agents alike, Knip will help keep your
|
|
15
|
+
codebases tidy.
|
|
16
16
|
|
|
17
17
|
Don't forget... Knip it before you ship it!
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Editor Extension
|
|
20
20
|
|
|
21
21
|
This one is for you.
|
|
22
22
|
|
|
23
|
-
[The usual suspects][
|
|
23
|
+
[The usual suspects][4] like red squiggles for unused exports are there. What
|
|
24
24
|
really moves the needle for DX with Knip's module graph is **navigation**. A
|
|
25
|
-
completely unique way to view & fly through codebases
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
completely unique way to view & fly through codebases. Connect the dots during
|
|
26
|
+
development and refactors, while keeping things in check. We're starting out
|
|
27
|
+
with [3 key features][5]:
|
|
28
28
|
|
|
29
29
|
1. **Hover over Export** for import & usage locations
|
|
30
30
|
2. **Imports Tree View** for direct links to implementations
|
|
31
31
|
3. **Exports Tree View** for direct links to import & usage locations
|
|
32
32
|
|
|
33
|
-
Find [Knip on the VS Code Marketplace][
|
|
34
|
-
|
|
35
|
-
**EDIT:** Or find [Knip on the Open VSX Registry][6].
|
|
33
|
+
Find [Knip on the VS Code Marketplace][6] and find [Knip in the Open VSX
|
|
34
|
+
Registry][7].
|
|
36
35
|
|
|
37
36
|
## MCP Server
|
|
38
37
|
|
|
@@ -41,7 +40,7 @@ coding agent to "configure knip" and it will RTFM so you don't have to. Using a
|
|
|
41
40
|
newer model like Opus 4.5 or GPT 5.2 results in an optimized `knip.json` file
|
|
42
41
|
and an uncluttered codebase.
|
|
43
42
|
|
|
44
|
-
The [MCP Server is available][
|
|
43
|
+
The [MCP Server is available][8] separately and built into the VS Code
|
|
45
44
|
Extension.
|
|
46
45
|
|
|
47
46
|
## Language Server
|
|
@@ -53,25 +52,25 @@ information. Queries like "where is an export imported" or "is this import part
|
|
|
53
52
|
of a circular dependency" are just scratching the surface here.
|
|
54
53
|
|
|
55
54
|
Extensions for other IDEs can be built on top. See
|
|
56
|
-
[language-server/README.md][
|
|
55
|
+
[language-server/README.md][9]
|
|
57
56
|
|
|
58
57
|
## Screenshots
|
|
59
58
|
|
|
60
|
-
- [Lint Findings][
|
|
61
|
-
- [Imports & Exports][
|
|
62
|
-
- [Contention][
|
|
63
|
-
- [Circular Dependencies][
|
|
64
|
-
- [Conflicts][
|
|
65
|
-
- [Branching][
|
|
66
|
-
- [VS Code Extension Settings][
|
|
59
|
+
- [Lint Findings][4]
|
|
60
|
+
- [Imports & Exports][5]
|
|
61
|
+
- [Contention][10]
|
|
62
|
+
- [Circular Dependencies][11]
|
|
63
|
+
- [Conflicts][12]
|
|
64
|
+
- [Branching][13]
|
|
65
|
+
- [VS Code Extension Settings][14]
|
|
67
66
|
|
|
68
67
|
### Lint Findings
|
|
69
68
|
|
|
70
|
-
![Lint Findings][
|
|
69
|
+
![Lint Findings][15]
|
|
71
70
|
|
|
72
71
|
### Imports & Exports
|
|
73
72
|
|
|
74
|
-
![hover][
|
|
73
|
+
![hover][16]
|
|
75
74
|
|
|
76
75
|
### Contention
|
|
77
76
|
|
|
@@ -83,7 +82,7 @@ branched/diamond-shaped import chains.
|
|
|
83
82
|
|
|
84
83
|
If an import is part of a circular dependency, Knip will display:
|
|
85
84
|
|
|
86
|
-
![Circular Dependencies][
|
|
85
|
+
![Circular Dependencies][17]
|
|
87
86
|
|
|
88
87
|
#### Conflicts
|
|
89
88
|
|
|
@@ -91,7 +90,7 @@ TypeScript shows direct conflicts when importing or re-exporting the same named
|
|
|
91
90
|
export from different files. Except when the problem is more subtle and the
|
|
92
91
|
chain spans more than one file. Knip warns:
|
|
93
92
|
|
|
94
|
-
![Conflicts][
|
|
93
|
+
![Conflicts][18]
|
|
95
94
|
|
|
96
95
|
#### Branching
|
|
97
96
|
|
|
@@ -99,29 +98,30 @@ Branched or diamond-shaped imports chains indicate unnecessary re-exports and
|
|
|
99
98
|
complexity. They help to untangle large codebases and shrink or get rid of
|
|
100
99
|
barrel files. Knip warns:
|
|
101
100
|
|
|
102
|
-
![Branching][
|
|
101
|
+
![Branching][19]
|
|
103
102
|
|
|
104
103
|
### VS Code Extension Settings
|
|
105
104
|
|
|
106
|
-
![VS Code Extension Settings][
|
|
105
|
+
![VS Code Extension Settings][20]
|
|
107
106
|
|
|
108
107
|
[1]: https://github.com/webpro-nl/knip/network/dependents
|
|
109
108
|
[2]: https://www.npmjs.com/package/knip
|
|
110
|
-
[3]: #
|
|
111
|
-
[4]: #
|
|
112
|
-
[5]:
|
|
113
|
-
[6]: https://
|
|
114
|
-
[7]: https://
|
|
115
|
-
[8]:
|
|
109
|
+
[3]: #editor-extension
|
|
110
|
+
[4]: #lint-findings
|
|
111
|
+
[5]: #imports--exports
|
|
112
|
+
[6]: https://marketplace.visualstudio.com/items?itemName=webpro.vscode-knip
|
|
113
|
+
[7]: https://open-vsx.org/extension/webpro/vscode-knip
|
|
114
|
+
[8]: https://www.npmjs.com/package/@knip/mcp
|
|
115
|
+
[9]:
|
|
116
116
|
https://github.com/webpro-nl/knip/blob/main/packages/language-server/README.md
|
|
117
|
-
[
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
121
|
-
[
|
|
122
|
-
[
|
|
123
|
-
[
|
|
124
|
-
[
|
|
125
|
-
[
|
|
126
|
-
[
|
|
127
|
-
[
|
|
117
|
+
[10]: #contention
|
|
118
|
+
[11]: #circular-dependencies
|
|
119
|
+
[12]: #conflicts
|
|
120
|
+
[13]: #branching
|
|
121
|
+
[14]: #vs-code-extension-settings
|
|
122
|
+
[15]: /screenshots/editors-and-agents/diagnostics.webp
|
|
123
|
+
[16]: /screenshots/editors-and-agents/imports-exports.webp
|
|
124
|
+
[17]: /screenshots/editors-and-agents/circular-dependency.webp
|
|
125
|
+
[18]: /screenshots/editors-and-agents/conflict.webp
|
|
126
|
+
[19]: /screenshots/editors-and-agents/branch.webp
|
|
127
|
+
[20]: /screenshots/editors-and-agents/vscode-extension-settings.webp
|
|
@@ -144,6 +144,6 @@ Remember, Knip it before you ship it! Have a great day ☀️
|
|
|
144
144
|
|
|
145
145
|
[1]: ./slim-down-to-speed-up.md
|
|
146
146
|
[2]: ../features/compilers.md
|
|
147
|
-
[3]: ../guides/issue-reproduction
|
|
147
|
+
[3]: ../guides/issue-reproduction.md
|
|
148
148
|
[4]: https://github.com/sponsors/webpro
|
|
149
|
-
[5]: ../reference/cli#--experimental-tags
|
|
149
|
+
[5]: ../reference/cli.md#--experimental-tags
|
|
@@ -101,7 +101,7 @@ Thanks to Joshua Goldberg for [emoji-blast][7]! 🎉
|
|
|
101
101
|
[1]: https://www.npmjs.com/package/exportman/v/0.0.1
|
|
102
102
|
[2]: /cow-with-orange-scissors-van-gogh-style.webp
|
|
103
103
|
[3]: https://github.com/webpro-nl/knip/releases/tag/5.31.0
|
|
104
|
-
[4]: ../features/auto-fix.
|
|
104
|
+
[4]: ../features/auto-fix.mdx
|
|
105
105
|
[5]: https://github.com/unjs/jiti
|
|
106
106
|
[6]: /sponsors
|
|
107
107
|
[7]: https://www.emojiblast.dev
|
|
@@ -73,7 +73,7 @@ export default defineConfig({
|
|
|
73
73
|
});
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
The Vitest plugin reads this configuration and
|
|
76
|
+
The Vitest plugin reads this configuration and returns two dependencies:
|
|
77
77
|
|
|
78
78
|
- `@vitest/coverage-istanbul`
|
|
79
79
|
- `vitest-environment-happy-dom`
|
|
@@ -108,7 +108,7 @@ configured.
|
|
|
108
108
|
|
|
109
109
|
:::tip[Plugins result in less configuration]
|
|
110
110
|
|
|
111
|
-
Plugins uses entry file patterns as defined in
|
|
111
|
+
Plugins uses entry file patterns as defined in your configuration file of these
|
|
112
112
|
tools. So you don't need to repeat this in your Knip configuration.
|
|
113
113
|
|
|
114
114
|
:::
|
|
@@ -242,7 +242,8 @@ dependency.
|
|
|
242
242
|
|
|
243
243
|
:::tip[Summary]
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
In your config files, plugins can find additional entry files and also other
|
|
246
|
+
config files recursively.
|
|
246
247
|
|
|
247
248
|
:::
|
|
248
249
|
|
|
@@ -283,6 +284,14 @@ automatically added as `entry` files for Knip to **statically** resolve the
|
|
|
283
284
|
|
|
284
285
|
Additionally, `./setup-tests.ts` will be added as an `entry` file.
|
|
285
286
|
|
|
287
|
+
:::note
|
|
288
|
+
|
|
289
|
+
When plugins dynamically load configuration files, conditional dependencies may
|
|
290
|
+
not be detected if the condition evaluates differently during analysis. See
|
|
291
|
+
[conditional or dynamic dependencies][9] for details and workarounds.
|
|
292
|
+
|
|
293
|
+
:::
|
|
294
|
+
|
|
286
295
|
## Command-Line Arguments
|
|
287
296
|
|
|
288
297
|
Plugins may define the arguments where Knip should look for entry files,
|
|
@@ -293,7 +302,7 @@ node --loader tsx scripts/deploy.ts
|
|
|
293
302
|
playwright test -c playwright.web.config.ts
|
|
294
303
|
```
|
|
295
304
|
|
|
296
|
-
Please see [script parser][
|
|
305
|
+
Please see [script parser][10] for more details.
|
|
297
306
|
|
|
298
307
|
## Summary
|
|
299
308
|
|
|
@@ -309,11 +318,12 @@ Plugins are configured with two distinct types of files:
|
|
|
309
318
|
:::
|
|
310
319
|
|
|
311
320
|
[1]: ../reference/plugins.md
|
|
312
|
-
[2]: ../
|
|
321
|
+
[2]: ../writing-a-plugin/index.md
|
|
313
322
|
[3]: #configuration-files
|
|
314
323
|
[4]: #entry-files
|
|
315
324
|
[5]: #command-line-arguments
|
|
316
325
|
[6]: ./entry-files.md
|
|
317
326
|
[7]: ../reference/plugins/eslint.md
|
|
318
327
|
[8]: ../reference/plugins/vitest.md
|
|
319
|
-
[9]: ../
|
|
328
|
+
[9]: ../guides/handling-issues.mdx#conditional-or-dynamic-dependencies
|
|
329
|
+
[10]: ../features/script-parser.md
|
|
@@ -11,7 +11,7 @@ Knip faster:
|
|
|
11
11
|
- Start with defaults. Only add targeted `entry` overrides when needed.
|
|
12
12
|
- Use `project` patterns (with negations) to define the scope for Knip.
|
|
13
13
|
- Use production mode to exclude tests and other non-production files.
|
|
14
|
-
- Use `ignore` only to suppress issues in specific files
|
|
14
|
+
- Use `ignore` only to suppress issues in specific files; it does not exclude
|
|
15
15
|
files from analysis.
|
|
16
16
|
|
|
17
17
|
Let's dive in and expand on all of these.
|
|
@@ -41,7 +41,7 @@ and adjust `project` to fit your codebase.
|
|
|
41
41
|
Use negated `project` patterns to precisely include/exclude files for unused
|
|
42
42
|
files detection.
|
|
43
43
|
|
|
44
|
-
Use `ignore
|
|
44
|
+
Use `ignore*` to suppress specific issues in matching files; it does not exclude
|
|
45
45
|
files from analysis.
|
|
46
46
|
|
|
47
47
|
:::
|
|
@@ -87,12 +87,12 @@ positives)? Use negated `project` patterns:
|
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Why is
|
|
90
|
+
Why this is better:
|
|
91
91
|
|
|
92
|
-
- `project` defines
|
|
93
|
-
|
|
92
|
+
- `project` defines what belongs to the codebase, so build outputs are excluded
|
|
93
|
+
from analysis and unused file detection
|
|
94
94
|
- `ignore` is for the few files that should be analyzed but contain exceptions
|
|
95
|
-
-
|
|
95
|
+
- Improves performance by analyzing fewer files
|
|
96
96
|
|
|
97
97
|
## Ignore issues in specific files
|
|
98
98
|
|
|
@@ -127,8 +127,8 @@ instead.
|
|
|
127
127
|
}
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
Why not: `ignore`
|
|
131
|
-
|
|
130
|
+
Why not: `ignore` hides issues from the report; it does not exclude files from
|
|
131
|
+
analysis.
|
|
132
132
|
|
|
133
133
|
❌ Also don't do this:
|
|
134
134
|
|
|
@@ -138,8 +138,8 @@ from analysis.
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
Why not: plugins
|
|
142
|
-
|
|
141
|
+
Why not: plugins add test files as `entry` files; you can't and shouldn't
|
|
142
|
+
override that globally.
|
|
143
143
|
|
|
144
144
|
❌ Or this:
|
|
145
145
|
|
|
@@ -149,8 +149,8 @@ and shouldn't override that globally.
|
|
|
149
149
|
}
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
Why not: `project` is
|
|
153
|
-
|
|
152
|
+
Why not: `project` is for unused file detection; negating test files is
|
|
153
|
+
ineffective because they are `entry` files.
|
|
154
154
|
|
|
155
155
|
✅ Do this instead:
|
|
156
156
|
|
|
@@ -20,5 +20,5 @@ contributes to that goal is welcome!
|
|
|
20
20
|
[1]: https://github.com/webpro-nl/knip
|
|
21
21
|
[2]: ./issue-reproduction.md
|
|
22
22
|
[3]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
|
|
23
|
-
[4]:
|
|
23
|
+
[4]: ../writing-a-plugin/index.md
|
|
24
24
|
[5]: https://github.com/webpro-nl/knip/blob/main/.github/DEVELOPMENT.md
|