@knip/mcp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +53 -0
  2. package/docs/blog/brief-history.md +30 -0
  3. package/docs/blog/knip-v3.mdx +88 -0
  4. package/docs/blog/knip-v4.mdx +149 -0
  5. package/docs/blog/knip-v5.mdx +190 -0
  6. package/docs/blog/migration-to-v1.md +65 -0
  7. package/docs/blog/release-notes-v2.md +46 -0
  8. package/docs/blog/slim-down-to-speed-up.md +269 -0
  9. package/docs/blog/state-of-knip.md +191 -0
  10. package/docs/blog/two-years.mdx +107 -0
  11. package/docs/docs/blog/brief-history.md +30 -0
  12. package/docs/docs/blog/for-editors-and-agents.md +109 -0
  13. package/docs/docs/blog/knip-v3.mdx +88 -0
  14. package/docs/docs/blog/knip-v4.mdx +149 -0
  15. package/docs/docs/blog/knip-v5.mdx +190 -0
  16. package/docs/docs/blog/migration-to-v1.md +65 -0
  17. package/docs/docs/blog/release-notes-v2.md +46 -0
  18. package/docs/docs/blog/slim-down-to-speed-up.md +269 -0
  19. package/docs/docs/blog/state-of-knip.md +191 -0
  20. package/docs/docs/blog/two-years.mdx +107 -0
  21. package/docs/docs/explanations/comparison-and-migration.md +129 -0
  22. package/docs/docs/explanations/entry-files.md +70 -0
  23. package/docs/docs/explanations/plugins.md +318 -0
  24. package/docs/docs/explanations/why-use-knip.md +128 -0
  25. package/docs/docs/features/auto-fix.mdx +333 -0
  26. package/docs/docs/features/compilers.md +172 -0
  27. package/docs/docs/features/integrated-monorepos.md +52 -0
  28. package/docs/docs/features/monorepos-and-workspaces.md +134 -0
  29. package/docs/docs/features/production-mode.md +95 -0
  30. package/docs/docs/features/reporters.md +302 -0
  31. package/docs/docs/features/rules-and-filters.md +102 -0
  32. package/docs/docs/features/script-parser.md +156 -0
  33. package/docs/docs/features/source-mapping.md +100 -0
  34. package/docs/docs/guides/configuring-project-files.md +205 -0
  35. package/docs/docs/guides/contributing.md +24 -0
  36. package/docs/docs/guides/handling-issues.mdx +646 -0
  37. package/docs/docs/guides/issue-reproduction.md +94 -0
  38. package/docs/docs/guides/namespace-imports.md +125 -0
  39. package/docs/docs/guides/performance.md +97 -0
  40. package/docs/docs/guides/troubleshooting.md +127 -0
  41. package/docs/docs/guides/using-knip-in-ci.md +54 -0
  42. package/docs/docs/guides/working-with-commonjs.md +72 -0
  43. package/docs/docs/index.mdx +160 -0
  44. package/docs/docs/overview/configuration.md +104 -0
  45. package/docs/docs/overview/features.md +66 -0
  46. package/docs/docs/overview/getting-started.mdx +195 -0
  47. package/docs/docs/overview/screenshots-videos.md +42 -0
  48. package/docs/docs/playground.mdx +38 -0
  49. package/docs/docs/reference/cli.md +481 -0
  50. package/docs/docs/reference/configuration.md +413 -0
  51. package/docs/docs/reference/dynamic-configuration.mdx +72 -0
  52. package/docs/docs/reference/faq.md +441 -0
  53. package/docs/docs/reference/issue-types.md +43 -0
  54. package/docs/docs/reference/jsdoc-tsdoc-tags.md +122 -0
  55. package/docs/docs/reference/known-issues.md +64 -0
  56. package/docs/docs/reference/plugins/.gitkeep +0 -0
  57. package/docs/docs/reference/plugins.md +238 -0
  58. package/docs/docs/reference/related-tooling.md +46 -0
  59. package/docs/docs/sponsors.mdx +65 -0
  60. package/docs/docs/typescript/unused-dependencies.md +86 -0
  61. package/docs/docs/typescript/unused-exports.md +87 -0
  62. package/docs/docs/writing-a-plugin/argument-parsing.md +202 -0
  63. package/docs/docs/writing-a-plugin/index.md +376 -0
  64. package/docs/docs/writing-a-plugin/inputs.md +162 -0
  65. package/docs/explanations/comparison-and-migration.md +129 -0
  66. package/docs/explanations/entry-files.md +70 -0
  67. package/docs/explanations/plugins.md +318 -0
  68. package/docs/explanations/why-use-knip.md +128 -0
  69. package/docs/features/auto-fix.mdx +333 -0
  70. package/docs/features/compilers.md +172 -0
  71. package/docs/features/integrated-monorepos.md +52 -0
  72. package/docs/features/monorepos-and-workspaces.md +134 -0
  73. package/docs/features/production-mode.md +95 -0
  74. package/docs/features/reporters.md +302 -0
  75. package/docs/features/rules-and-filters.md +102 -0
  76. package/docs/features/script-parser.md +156 -0
  77. package/docs/features/source-mapping.md +100 -0
  78. package/docs/guides/configuring-project-files.md +205 -0
  79. package/docs/guides/contributing.md +24 -0
  80. package/docs/guides/handling-issues.mdx +646 -0
  81. package/docs/guides/issue-reproduction.md +94 -0
  82. package/docs/guides/namespace-imports.md +125 -0
  83. package/docs/guides/performance.md +97 -0
  84. package/docs/guides/troubleshooting.md +127 -0
  85. package/docs/guides/using-knip-in-ci.md +54 -0
  86. package/docs/guides/working-with-commonjs.md +72 -0
  87. package/docs/index.mdx +156 -0
  88. package/docs/overview/configuration.md +104 -0
  89. package/docs/overview/features.md +66 -0
  90. package/docs/overview/getting-started.mdx +195 -0
  91. package/docs/overview/screenshots-videos.md +42 -0
  92. package/docs/playground.mdx +38 -0
  93. package/docs/reference/cli.md +481 -0
  94. package/docs/reference/configuration.md +413 -0
  95. package/docs/reference/dynamic-configuration.mdx +72 -0
  96. package/docs/reference/faq.md +441 -0
  97. package/docs/reference/issue-types.md +43 -0
  98. package/docs/reference/jsdoc-tsdoc-tags.md +122 -0
  99. package/docs/reference/known-issues.md +64 -0
  100. package/docs/reference/plugins/.gitkeep +0 -0
  101. package/docs/reference/plugins.md +238 -0
  102. package/docs/reference/related-tooling.md +46 -0
  103. package/docs/sponsors.mdx +65 -0
  104. package/docs/typescript/unused-dependencies.md +86 -0
  105. package/docs/typescript/unused-exports.md +87 -0
  106. package/docs/writing-a-plugin/argument-parsing.md +202 -0
  107. package/docs/writing-a-plugin/index.md +376 -0
  108. package/docs/writing-a-plugin/inputs.md +162 -0
  109. package/license +15 -0
  110. package/package.json +38 -0
  111. package/src/cli.js +13 -0
  112. package/src/curated-resources.js +62 -0
  113. package/src/server.js +129 -0
  114. package/src/texts.js +76 -0
  115. package/src/tools.js +68 -0
@@ -0,0 +1,160 @@
1
+ ---
2
+ title: Declutter your JavaScript & TypeScript projects
3
+ description: Project linter to find unused dependencies, exports and files
4
+ template: splash
5
+ hero:
6
+ title: Knip
7
+ tagline: Declutter your JavaScript & TypeScript projects
8
+ image:
9
+ file: ../../assets/logo.svg
10
+ actions:
11
+ - text: Let's Get Started
12
+ link: ./overview/getting-started
13
+ icon: right-arrow
14
+ variant: primary
15
+ - text: 'NEW: Knip for Editors & Agents'
16
+ link: /blog/for-editors-and-agents
17
+ icon: rocket
18
+ variant: secondary
19
+ - text: View on GitHub
20
+ link: https://github.com/webpro-nl/knip
21
+ icon: external
22
+ variant: minimal
23
+ ---
24
+
25
+ import { Card, CardGrid } from '@astrojs/starlight/components';
26
+ import { YouTube } from '@astro-community/astro-embed-youtube';
27
+ import Posts from '../../components/Posts.astro';
28
+ import Sponsors from '../../components/Sponsors.astro';
29
+ import Projects from '../../components/Projects.astro';
30
+ import Contributors from '../../components/Contributors.astro';
31
+
32
+ :::section{.badges}
33
+
34
+ [![NPM Version][2]][1] [![NPM Downloads][3]][1] [![GitHub Repo stars][5]][4]
35
+
36
+ :::
37
+
38
+ :::div{.sponsor}
39
+
40
+ [Sponsor Me][6] / [Hire Me][7]
41
+
42
+ :::
43
+
44
+ :a[Sponsored by:]{.sponsors-intro href="/sponsors"}
45
+
46
+ <Sponsors showAll={false} />
47
+
48
+ <CardGrid>
49
+ <Card title="Why use Knip?" icon="approve-check">
50
+ Knip finds and fixes unused dependencies, exports and files. Use it for
51
+ enhanced code and dependency management.
52
+ </Card>
53
+
54
+ <Card title="How does it work?" icon="setting">
55
+ Advanced analysis starting from fine-grained entry points based on the
56
+ actual frameworks and tooling in (mono)repos for accurate and actionable
57
+ results.
58
+ </Card>
59
+
60
+ <Card title="Battle-tested" icon="approve-check">
61
+ Thousands of projects are already using Knip!
62
+ </Card>
63
+
64
+ <Card title="Plugins" icon="open-book">
65
+ Knip comes with [100+ plugins][8] for tools and frameworks like Astro,
66
+ Cypress, ESLint, Jest, GitHub Actions, Next.js, Nx, Remix, Storybook,
67
+ Svelte, Vite, Vitest, Webpack and many, many more.
68
+ </Card>
69
+
70
+ <Card title="Playground" icon="rocket">
71
+ Try Knip on the [playground][9].
72
+ </Card>
73
+
74
+ <Card title="Troubleshooting" icon="warning">
75
+ Need help? [Start troubleshooting][10].
76
+ </Card>
77
+ </CardGrid>
78
+
79
+ ## Trusted by the world's best software teams
80
+
81
+ :::section{.projects}
82
+
83
+ <Projects />
84
+
85
+ :::
86
+
87
+ ## Introduction video
88
+
89
+ [James Shopland][11] has a great introduction and overview of Knip (thanks
90
+ James!):
91
+
92
+ <YouTube id="uhEkgWt-pUM" />
93
+
94
+ ## Created by awesome contributors
95
+
96
+ Special thanks to the wonderful people who have contributed to this project:
97
+
98
+ <Contributors />
99
+
100
+ ## Articles about Knip
101
+
102
+ A curated selection of articles about Knip, most recent first:
103
+
104
+ - Tom McWright: [How to keep package.json under control][12] (2025-09-11)
105
+ - Mohammed Farmaan: [Declutter Your JavaScript and TypeScript Projects][13]
106
+ (2025-08-13)
107
+ - dip Engineer Blog: [Knipで安心してデッドコードを撲滅する][14]
108
+ (2025-04-04/Japanese 🇯🇵)
109
+ - Tom MacWright: [Knip: good software for cleaning up TypeScript tech debt][15]
110
+ (2024-10-25)
111
+ - Neng Apichet: [มาทำความสะอาด Project โค้ดของเราด้วย Knip กัน][16]
112
+ (2024-10-22/Thai 🇹🇭)
113
+ - Anthony Pena: [Knip: l'ultime outil pour faire le ménage dans vos
114
+ projets!][17] (2024-10-08/French 🇫🇷)
115
+ - Taro: [TypeScript/JavaScriptの不要なコードを削除するツール「Knip」の紹介][18]
116
+ (2024-07-25/Japanese 🇯🇵)
117
+ - Kevin Bailey: [Delete Code with Knip][19] (2025-10-31)
118
+ - Maddy Miller: [Using Knip to find dead code in a high-traffic git repo][20]
119
+ (2023-09-17)
120
+ - Josh Goldberg: [Speeding Up Centered Part 4: Unused Code Bloat][21]
121
+ (2023-08-21)
122
+ - Smashing Magazine: [Knip: An Automated Tool For Finding Unused Files, Exports,
123
+ And Dependencies][22] (2023-08-14)
124
+ - Effective TypeScript: [Recommendation Update: ✂️ Use knip to detect dead code
125
+ and types][23] (2023-07-29)
126
+
127
+ ## Don't just take our word for it
128
+
129
+ <Posts />
130
+
131
+ ## Read More
132
+
133
+ - [Unused dependencies][24]
134
+ - [Unused exports][25]
135
+
136
+ [1]: https://www.npmjs.com/package/knip
137
+ [2]: https://img.shields.io/npm/v/knip?color=f56e0f
138
+ [3]: https://img.shields.io/npm/dm/knip?color=f56e0f
139
+ [4]: https://github.com/webpro-nl/knip
140
+ [5]: https://img.shields.io/github/stars/webpro-nl/knip?style=flat&color=f56e0f
141
+ [6]: ./sponsors
142
+ [7]: https://webpro.nl/hire-me
143
+ [8]: ./reference/plugins.md
144
+ [9]: ./playground
145
+ [10]: ./guides/troubleshooting.md
146
+ [11]: https://www.jamesshopland.com
147
+ [12]: https://blog.val.town/gardening-dependencies
148
+ [13]: https://farmaan.dev/writing/using-knip
149
+ [14]: https://developer.dip-net.co.jp/entry/2025/04/04/Knipで安心してデッドコードを撲滅する
150
+ [15]: https://macwright.com/2024/10/25/good-software-knip
151
+ [16]: https://engineering.thinknet.co.th/มาทำความสะอาด-project-โค้ดของเราด้วย-knip-กัน-20dbd65f6b58
152
+ [17]: https://k49.fr.nf/knip-l-ultime-outil-pour-faire-le-menage-dans-vos-projets/
153
+ [18]: https://tech.basemachina.jp/entry/introduction-knip
154
+ [19]: https://kevinabailey.com/delete-code-with-knip
155
+ [20]: https://madelinemiller.dev/blog/knip-dead-code/
156
+ [21]: https://www.joshuakgoldberg.com/blog/speeding-up-centered-part-4-unused-code-bloat/
157
+ [22]: https://www.smashingmagazine.com/2023/08/knip-automated-tool-find-unused-files-exports-dependencies/
158
+ [23]: https://effectivetypescript.com/2023/07/29/knip/
159
+ [24]: ./typescript/unused-dependencies.md
160
+ [25]: ./typescript/unused-exports.md
@@ -0,0 +1,104 @@
1
+ ---
2
+ title: Configuration
3
+ description: config
4
+ ---
5
+
6
+ ## Defaults
7
+
8
+ Knip has good defaults and aims for "zero config". Here's a simplified version
9
+ of the default `entry` and `project` values:
10
+
11
+ ```json
12
+ {
13
+ "entry": ["index.{js,ts}", "src/index.{js,ts}"],
14
+ "project": ["**/*.{js,ts}"]
15
+ }
16
+ ```
17
+
18
+ Entry files are the starting point for Knip to find more source files and
19
+ external dependencies.
20
+
21
+ ## Location
22
+
23
+ By default, Knip will look for a configuration file with the following names:
24
+
25
+ - `knip.json`
26
+ - `knip.jsonc`
27
+ - `.knip.json`
28
+ - `.knip.jsonc`
29
+ - `knip.ts`
30
+ - `knip.js`
31
+ - `knip.config.ts`
32
+ - `knip.config.js`
33
+ - `package.json` (in the `"knip"` property)
34
+
35
+ If you want to use a custom file name or path, use the `--config` flag:
36
+
37
+ ```sh
38
+ knip --config path/to/knip.json
39
+ ```
40
+
41
+ ## Customize
42
+
43
+ Your project structure may not match the default `entry` and `project` files.
44
+ Here's an example custom configuration to include `.js` files in the `scripts`
45
+ folder:
46
+
47
+ ```json title="knip.json"
48
+ {
49
+ "$schema": "https://unpkg.com/knip@5/schema.json",
50
+ "entry": ["src/index.ts", "scripts/{build,create}.js"],
51
+ "project": ["src/**/*.ts", "scripts/**/*.js"]
52
+ }
53
+ ```
54
+
55
+ If you override the `entry` file patterns, you may also want to override
56
+ `project` file patterns. The set of project files is used to determine what
57
+ files are unused. The `project` patterns can also be negated to exclude files
58
+ from the analysis. See [configuring project files][1] for details.
59
+
60
+ The values you set override the default values, they are not merged.
61
+
62
+ :::tip
63
+
64
+ Be specific with `entry` files. Minimize the number of entry files and wildcards
65
+ for better results.
66
+
67
+ Plugins are enabled automatically, and set entry files for you. Such as for
68
+ Next.js, Astro, Remix, Vitest, Playwright and many more.
69
+
70
+ :::
71
+
72
+ Knip looks for entry files in many places. Learn more in the next page about
73
+ [entry files][2].
74
+
75
+ ## Configuration Options
76
+
77
+ See [configuration file options][3].
78
+
79
+ Use JavaScript or TypeScript in a [dynamic configuration file][4].
80
+
81
+ ## What's next?
82
+
83
+ The best way to understand Knip and what it can do for you is to read the pages
84
+ in the "Understanding Knip" sections, starting with [entry files][2].
85
+
86
+ Want to learn more about some of the main features?
87
+
88
+ - Working with [monorepos & workspaces][5].
89
+ - Learn more about [production mode][6].
90
+
91
+ Having trouble configuring Knip?
92
+
93
+ - [Configuring project files][1]
94
+ - [Troubleshooting][7]
95
+
96
+ Search this website using the bar at the top (`Ctrl+K` or `⌘+K`).
97
+
98
+ [1]: ../guides/configuring-project-files.md
99
+ [2]: ../explanations/entry-files.md
100
+ [3]: ../reference/configuration.md
101
+ [4]: ../reference/dynamic-configuration.mdx
102
+ [5]: ../features/monorepos-and-workspaces.md
103
+ [6]: ../features/production-mode.md
104
+ [7]: ../guides/troubleshooting.md
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: Features
3
+ ---
4
+
5
+ Overview of capabilities in support of the core feature: find many [types of
6
+ issues][1].
7
+
8
+ Also see [related tooling][2].
9
+
10
+ ## Overview
11
+
12
+ | Name | Description or example |
13
+ | :--------------------------- | :-------------------------------------------------------------------- |
14
+ | [Auto-fix][3] | Use `--fix` to auto-fix issues |
15
+ | [Cache][4] | Use `--cache` to speed up consecutive runs |
16
+ | Catalog | Report & fix unused catalog entries |
17
+ | [CommonJS][5] | CommonJS is still widely used & supported, but conditions apply |
18
+ | [Compilers][6] | Support for Astro, MDX, Svelte, Vue and custom compilers |
19
+ | Configuration hints | Display configuration hints to keep `knip.json` tidy |
20
+ | [Debug][7] | Use `--debug` for troubleshooting |
21
+ | [Filters][8] | Exclude or focus on specific issue types |
22
+ | [Format][9] | Add `--format` to `--fix` and auto-format modified files |
23
+ | [JSDoc tags][10] | Tag and exclude specific exports from the report |
24
+ | [Memory usage][11] | Use `--memory` for detailed memory usage insights |
25
+ | [Monorepos][12] | Workspaces are first-class citizen |
26
+ | [Performance][13] | Use `--performance` for detailed timing insights |
27
+ | [Plugins][14] | Over 100 plugins with custom entry paths and config parsing |
28
+ | [Plugins: inputs][15] | Inputs are an affective mechanism to add entries, dependencies & more |
29
+ | [Plugins: CLI arguments][16] | Tool-specific CLI argument parsing make plugins go the extra mile |
30
+ | [Preprocessors][17] | Preprocess issues before being reported |
31
+ | [Production mode][18] | Use `--production` to lint only production code |
32
+ | [Reporters][19] | Choose from many built-in reporters or use your own |
33
+ | [Rules][20] | Exclude or focus on specific issue types |
34
+ | [Script parser][21] | Shell scripts and `package.json` contain entry paths and dependencies |
35
+ | [Source mapping][22] | Map `dist` files back to `src` files |
36
+ | [Strict mode][23] | Use `--strict` to isolate workspaces and consider only `dependencies` |
37
+ | [Trace][24] | Trace exports to find where they are used |
38
+ | [Watch mode][25] | Use `--watch` for live updates of unused files and exports |
39
+ | [Workspace][26] | Use `--workspace` to lint a single workspace in a monorepo |
40
+
41
+ [1]: ../reference/issue-types.md
42
+ [2]: ../reference/related-tooling.md
43
+ [3]: ../features/auto-fix.mdx
44
+ [4]: ../reference/cli.md#--cache
45
+ [5]: ../guides/working-with-commonjs.md
46
+ [6]: ../features/compilers.md
47
+ [7]: ../guides/troubleshooting.md#issues-reported-by-knip
48
+ [8]: ../features/rules-and-filters.md#filters
49
+ [9]: ../features/auto-fix.mdx#format
50
+ [10]: ../reference/jsdoc-tsdoc-tags.md
51
+ [11]: ../reference/cli.md#--memory
52
+ [12]: ../features/monorepos-and-workspaces.md
53
+ [13]: ../reference/cli.md#--performance
54
+ [14]: ../explanations/plugins.md
55
+ [15]: ../writing-a-plugin/inputs.md
56
+ [16]: ../writing-a-plugin/argument-parsing.md
57
+ [17]: ../features/reporters.md#preprocessors
58
+ [18]: ../features/production-mode.md
59
+ [19]: ../features/reporters.md
60
+ [20]: ../features/rules-and-filters.md#rules
61
+ [21]: ../features/script-parser.md
62
+ [22]: ../features/source-mapping.md
63
+ [23]: ../features/production-mode.md#strict-mode
64
+ [24]: ../guides/troubleshooting.md#trace
65
+ [25]: ../reference/cli.md#--watch
66
+ [26]: ../features/monorepos-and-workspaces#lint-a-single-workspace
@@ -0,0 +1,195 @@
1
+ ---
2
+ title: Getting Started
3
+ sidebar:
4
+ order: 1
5
+ ---
6
+
7
+ import { Tabs, TabItem } from '@astrojs/starlight/components';
8
+
9
+ ## Requirements
10
+
11
+ Knip v5 requires at least Node.js v18.18.0. Or Bun.
12
+
13
+ Want to try Knip without installation? Visit [the playground][1].
14
+
15
+ ## Installation
16
+
17
+ This is the easiest and recommended way to install Knip:
18
+
19
+ <Tabs syncKey="pm">
20
+ <TabItem label="npm">
21
+ ```shell
22
+ npm init @knip/config
23
+ ```
24
+ </TabItem>
25
+
26
+ <TabItem label="pnpm">
27
+ ```shell
28
+ pnpm create @knip/config
29
+ ```
30
+ </TabItem>
31
+
32
+ <TabItem label="bun">
33
+ ```shell
34
+ bun create @knip/config
35
+ ```
36
+ </TabItem>
37
+
38
+ <TabItem label="yarn">
39
+ ```shell
40
+ yarn create @knip/config
41
+ ```
42
+ </TabItem>
43
+ </Tabs>
44
+
45
+ Now you can run Knip to lint your project:
46
+
47
+ <Tabs syncKey="pm">
48
+ <TabItem label="npm">
49
+ ```shell
50
+ npm run knip
51
+ ```
52
+ </TabItem>
53
+
54
+ <TabItem label="pnpm">
55
+ ```shell
56
+ pnpm knip
57
+ ```
58
+ </TabItem>
59
+
60
+ <TabItem label="bun">
61
+ ```shell
62
+ bun knip
63
+ ```
64
+ </TabItem>
65
+
66
+ <TabItem label="yarn">
67
+ ```shell
68
+ yarn knip
69
+ ```
70
+ </TabItem>
71
+ </Tabs>
72
+
73
+ Knip will lint your project and report unused dependencies, exports and files.
74
+
75
+ If the output makes sense to you, feel free to go to the next page:
76
+ [configuration][2].
77
+
78
+ ## Too Much?
79
+
80
+ In large or complex codebases the output might be overwhelming. Start by
81
+ limiting the number of shown issues per type:
82
+
83
+ <Tabs syncKey="pm">
84
+ <TabItem label="npm">
85
+ ```shell
86
+ npm run knip -- --max-show-issues 5
87
+ ```
88
+ </TabItem>
89
+
90
+ <TabItem label="pnpm">
91
+ ```shell
92
+ pnpm knip --max-show-issues 5
93
+ ```
94
+ </TabItem>
95
+
96
+ <TabItem label="bun">
97
+ ```shell
98
+ bun knip --max-show-issues 5
99
+ ```
100
+ </TabItem>
101
+
102
+ <TabItem label="yarn">
103
+ ```shell
104
+ yarn knip --max-show-issues 5
105
+ ```
106
+ </TabItem>
107
+ </Tabs>
108
+
109
+ The output is easier to digest and may include some configuration hints to get
110
+ an idea of what's left to configure. Many unused files? Go to [configuration][2]
111
+ and follow up with [troubleshooting][3] if needed.
112
+
113
+ :::tip
114
+
115
+ Do not use the `ignore` option just to get rid of unwanted output. Read
116
+ [Configuring Project Files][4] to get the most out of Knip.
117
+
118
+ :::
119
+
120
+ ## Manual
121
+
122
+ Alternatively, manually install Knip using your package manager:
123
+
124
+ <Tabs syncKey="pm">
125
+ <TabItem label="npm">
126
+ ```shell
127
+ npm install -D knip typescript @types/node
128
+ ```
129
+ </TabItem>
130
+
131
+ <TabItem label="pnpm">
132
+ ```shell
133
+ pnpm add -D knip typescript @types/node
134
+ ```
135
+ </TabItem>
136
+
137
+ <TabItem label="bun">
138
+ ```shell
139
+ bun add -D knip typescript @types/node
140
+ ```
141
+ </TabItem>
142
+
143
+ <TabItem label="yarn">
144
+ ```shell
145
+ yarn add -D knip typescript @types/node
146
+ ```
147
+ </TabItem>
148
+ </Tabs>
149
+
150
+ Knip uses `typescript` and ` @types/node` as peer dependencies to increase
151
+ compatibility with your project. No worries, they're probably in your
152
+ `node_modules` already.
153
+
154
+ Then add a `knip` script to your `package.json`:
155
+
156
+ ```json title="package.json"
157
+ {
158
+ "name": "my-project",
159
+ "scripts": {
160
+ "knip": "knip"
161
+ }
162
+ }
163
+ ```
164
+
165
+ ## Without installation
166
+
167
+ To run Knip without adding it to your project:
168
+
169
+ <Tabs syncKey="pm">
170
+ <TabItem label="npm">
171
+ ```shell
172
+ npx knip
173
+ ```
174
+ </TabItem>
175
+
176
+ <TabItem label="pnpm">
177
+ ```shell
178
+ pnpm dlx knip
179
+ ```
180
+ </TabItem>
181
+
182
+ <TabItem label="bun">
183
+ ```shell
184
+ bunx knip
185
+ ```
186
+ </TabItem>
187
+ </Tabs>
188
+
189
+ In this scenario `typescript` and `@types/node` are expected to be installed
190
+ already.
191
+
192
+ [1]: /playground
193
+ [2]: ./configuration.md
194
+ [3]: ../guides/troubleshooting.md
195
+ [4]: ../guides/configuring-project-files.md
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: Screenshots & videos
3
+ ---
4
+
5
+ ## Watch & auto-fix
6
+
7
+ This video demonstrates using the `--watch` and `--fix` options inside Visual
8
+ Studio Code:
9
+
10
+ <video controls width="500">
11
+ <source src="/screenshots/watch-fix.mp4" type="video/mp4" />
12
+
13
+ <source src="/screenshots/watch-fix.webm" type="video/webm" />
14
+ </video>
15
+
16
+ This works in any terminal. See [--watch][1] and [auto-fix][2] for more details.
17
+
18
+ ## Trace
19
+
20
+ Here's an example screenshot that traces the `mapIterator` export in the
21
+ TypeScript codebase:
22
+
23
+ <img src="/screenshots/trace-export.png" alt="trace export" class="mw500" />
24
+
25
+ Inspect complicated import and re-export chains at a glance:
26
+
27
+ <img src="/screenshots/trace-file.png" alt="trace file" class="mw500" />
28
+
29
+ See [Trace][3] for more details.
30
+
31
+ ## Performance
32
+
33
+ An example screenshot showing `--performance` output for the Knip codebase:
34
+
35
+ <img src="/screenshots/performance.png" alt="performance" class="mw500" />
36
+
37
+ Also see [--performance][4].
38
+
39
+ [1]: ../reference/cli.md#--watch
40
+ [2]: ../features/auto-fix.mdx
41
+ [3]: ../guides/troubleshooting.md#trace
42
+ [4]: ../reference/cli.md#--performance
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: 'Playground'
3
+ description: 'Playground for Knip'
4
+ template: splash
5
+ ---
6
+
7
+ Welcome to the Knip playground. The codebases below have linting issues on
8
+ purpose in the codebases, so Knip will report various types of issues.
9
+
10
+ Feel free to play around! There are currently two playgrounds:
11
+
12
+ - [Basic][1]
13
+ - [Monorepo][2]
14
+
15
+ Shoutout to <a href="https://stackblitz.com">StackBlitz</a> for generously
16
+ providing these free dev containers.
17
+
18
+ ## Basic
19
+
20
+ Visit this [Knip playground on StackBlitz][3] to try out Knip:
21
+
22
+ <div class="playground">
23
+ <iframe src="https://stackblitz.com/github/webpro-nl/knip/tree/main/templates/playground/basic?file=README.md&view=editor" />
24
+ </div>
25
+
26
+ ## Monorepo
27
+
28
+ Visit this [Knip playground on StackBlitz][4] to try out Knip in a monorepo
29
+ setting:
30
+
31
+ <div class="playground">
32
+ <iframe src="https://stackblitz.com/github/webpro-nl/knip/tree/main/templates/playground/monorepo?file=README.md&view=editor" />
33
+ </div>
34
+
35
+ [1]: #basic
36
+ [2]: #monorepo
37
+ [3]: https://stackblitz.com/github/webpro-nl/knip/tree/main/templates/playground/basic?file=README.md&view=editor
38
+ [4]: https://stackblitz.com/github/webpro-nl/knip/tree/main/templates/playground/monorepo?file=README.md&view=editor