@knip/mcp 0.0.1 → 0.0.2

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 (64) hide show
  1. package/docs/blog/brief-history.md +1 -1
  2. package/docs/blog/knip-v3.mdx +1 -1
  3. package/docs/blog/knip-v4.mdx +1 -1
  4. package/docs/blog/knip-v5.mdx +1 -1
  5. package/docs/blog/release-notes-v2.md +1 -1
  6. package/docs/blog/slim-down-to-speed-up.md +1 -1
  7. package/docs/blog/state-of-knip.md +1 -1
  8. package/docs/blog/two-years.mdx +1 -1
  9. package/docs/index.mdx +4 -0
  10. package/package.json +2 -2
  11. package/docs/docs/blog/brief-history.md +0 -30
  12. package/docs/docs/blog/knip-v3.mdx +0 -88
  13. package/docs/docs/blog/knip-v4.mdx +0 -149
  14. package/docs/docs/blog/knip-v5.mdx +0 -190
  15. package/docs/docs/blog/migration-to-v1.md +0 -65
  16. package/docs/docs/blog/release-notes-v2.md +0 -46
  17. package/docs/docs/blog/slim-down-to-speed-up.md +0 -269
  18. package/docs/docs/blog/state-of-knip.md +0 -191
  19. package/docs/docs/blog/two-years.mdx +0 -107
  20. package/docs/docs/explanations/comparison-and-migration.md +0 -129
  21. package/docs/docs/explanations/entry-files.md +0 -70
  22. package/docs/docs/explanations/plugins.md +0 -318
  23. package/docs/docs/explanations/why-use-knip.md +0 -128
  24. package/docs/docs/features/auto-fix.mdx +0 -333
  25. package/docs/docs/features/compilers.md +0 -172
  26. package/docs/docs/features/integrated-monorepos.md +0 -52
  27. package/docs/docs/features/monorepos-and-workspaces.md +0 -134
  28. package/docs/docs/features/production-mode.md +0 -95
  29. package/docs/docs/features/reporters.md +0 -302
  30. package/docs/docs/features/rules-and-filters.md +0 -102
  31. package/docs/docs/features/script-parser.md +0 -156
  32. package/docs/docs/features/source-mapping.md +0 -100
  33. package/docs/docs/guides/configuring-project-files.md +0 -205
  34. package/docs/docs/guides/contributing.md +0 -24
  35. package/docs/docs/guides/handling-issues.mdx +0 -646
  36. package/docs/docs/guides/issue-reproduction.md +0 -94
  37. package/docs/docs/guides/namespace-imports.md +0 -125
  38. package/docs/docs/guides/performance.md +0 -97
  39. package/docs/docs/guides/troubleshooting.md +0 -127
  40. package/docs/docs/guides/using-knip-in-ci.md +0 -54
  41. package/docs/docs/guides/working-with-commonjs.md +0 -72
  42. package/docs/docs/index.mdx +0 -160
  43. package/docs/docs/overview/configuration.md +0 -104
  44. package/docs/docs/overview/features.md +0 -66
  45. package/docs/docs/overview/getting-started.mdx +0 -195
  46. package/docs/docs/overview/screenshots-videos.md +0 -42
  47. package/docs/docs/playground.mdx +0 -38
  48. package/docs/docs/reference/cli.md +0 -481
  49. package/docs/docs/reference/configuration.md +0 -413
  50. package/docs/docs/reference/dynamic-configuration.mdx +0 -72
  51. package/docs/docs/reference/faq.md +0 -441
  52. package/docs/docs/reference/issue-types.md +0 -43
  53. package/docs/docs/reference/jsdoc-tsdoc-tags.md +0 -122
  54. package/docs/docs/reference/known-issues.md +0 -64
  55. package/docs/docs/reference/plugins/.gitkeep +0 -0
  56. package/docs/docs/reference/plugins.md +0 -238
  57. package/docs/docs/reference/related-tooling.md +0 -46
  58. package/docs/docs/sponsors.mdx +0 -65
  59. package/docs/docs/typescript/unused-dependencies.md +0 -86
  60. package/docs/docs/typescript/unused-exports.md +0 -87
  61. package/docs/docs/writing-a-plugin/argument-parsing.md +0 -202
  62. package/docs/docs/writing-a-plugin/index.md +0 -376
  63. package/docs/docs/writing-a-plugin/inputs.md +0 -162
  64. /package/docs/{docs/blog → blog}/for-editors-and-agents.md +0 -0
@@ -1,413 +0,0 @@
1
- ---
2
- title: Configuration
3
- ---
4
-
5
- This page lists all configuration file options.
6
-
7
- ## File Types
8
-
9
- ### JSON Schema
10
-
11
- A `$schema` field is a URL that you put at the top of your JSON file. This
12
- allows you to get red squiggly lines inside of your IDE when you make a typo or
13
- provide an otherwise invalid configuration option.
14
-
15
- In JSON, use the provided JSON schema:
16
-
17
- ```json title="knip.json"
18
- {
19
- "$schema": "https://unpkg.com/knip@5/schema.json"
20
- }
21
- ```
22
-
23
- ### JSONC
24
-
25
- In JSONC, use the provided JSONC schema:
26
-
27
- ```json title="knip.jsonc"
28
- {
29
- "$schema": "https://unpkg.com/knip@5/schema-jsonc.json"
30
- }
31
- ```
32
-
33
- Use JSONC if you want to use comments and/or trailing commas.
34
-
35
- ### TypeScript
36
-
37
- See [dynamic configuration][1] about dynamic and typed configuration files.
38
-
39
- ## Project
40
-
41
- ### `entry`
42
-
43
- Array of glob patterns to find entry files. Prefix with `!` for negation.
44
- Example:
45
-
46
- ```json title="knip.json"
47
- {
48
- "entry": ["src/index.ts", "scripts/*.ts", "!scripts/except-this-one.ts"]
49
- }
50
- ```
51
-
52
- Also see [configuration][2] and [entry files][3].
53
-
54
- ### `project`
55
-
56
- Array of glob patterns to find project files. Example:
57
-
58
- ```json title="knip.json"
59
- {
60
- "project": ["src/**/*.ts", "scripts/**/*.ts"]
61
- }
62
- ```
63
-
64
- Also see [configuration][2] and [entry files][3].
65
-
66
- ### `paths`
67
-
68
- Tools like TypeScript, webpack and Babel support import aliases in various ways.
69
- Knip automatically includes `compilerOptions.paths` from the TypeScript
70
- configuration, but does not automatically use other types of import aliases.
71
- They can be configured manually:
72
-
73
- ```json title="knip.json"
74
- {
75
- "paths": {
76
- "@lib": ["./lib/index.ts"],
77
- "@lib/*": ["./lib/*"]
78
- }
79
- }
80
- ```
81
-
82
- Each workspace can have its own `paths` configured. Knip `paths` follow the
83
- TypeScript semantics:
84
-
85
- - Path values are an array of relative paths.
86
- - Paths without an `*` are exact matches.
87
-
88
- ## Workspaces
89
-
90
- Individual workspace configurations may contain all other options listed on this
91
- page, except for the following root-only options:
92
-
93
- - `exclude` / `include`
94
- - `ignoreExportsUsedInFile`
95
- - `ignoreWorkspaces`
96
- - `workspaces`
97
-
98
- Workspaces can't be nested in a Knip configuration, but they can be nested in a
99
- monorepo folder structure.
100
-
101
- Also see [Monorepos and workspaces][4].
102
-
103
- ## Plugins
104
-
105
- There are a few options to modify the behavior of a plugin:
106
-
107
- - Override a plugin's `config` or `entry` location
108
- - Force-enable a plugin by setting its value to `true`
109
- - Disable a plugin by setting its value to `false`
110
-
111
- ```json title="knip.json"
112
- {
113
- "mocha": {
114
- "config": "config/mocha.config.js",
115
- "entry": ["**/*.spec.js"]
116
- },
117
- "playwright": true,
118
- "webpack": false
119
- }
120
- ```
121
-
122
- It should be rarely necessary to override the `entry` patterns, since plugins
123
- also read custom entry file patterns from the tooling configuration (see
124
- [Plugins → entry files][5]).
125
-
126
- Plugin configuration can be set on root and on a per-workspace level. If enabled
127
- on root level, it can be disabled on workspace level by setting it to `false`
128
- there, and vice versa.
129
-
130
- Also see [Plugins][6].
131
-
132
- ## Rules & Filters
133
-
134
- ### `rules`
135
-
136
- See [Rules & Filters][7].
137
-
138
- ### `include`
139
-
140
- See [Rules & Filters][7].
141
-
142
- ### `exclude`
143
-
144
- See [Rules & Filters][7].
145
-
146
- ### `tags`
147
-
148
- Exports can be tagged with known or arbitrary JSDoc/TSDoc tags:
149
-
150
- ```ts
151
- /**
152
- * Description of my exported value
153
- *
154
- * @type number
155
- * @internal Important matters
156
- * @lintignore
157
- */
158
- export const myExport = 1;
159
- ```
160
-
161
- And then include (`+`) or exclude (`-`) these tagged exports from the report
162
- like so:
163
-
164
- ```json
165
- {
166
- "tags": ["-lintignore"]
167
- }
168
- ```
169
-
170
- This way, you can either focus on or ignore specific tagged exports with tags
171
- you define yourself. This also works for individual class or enum members.
172
-
173
- The default directive is `+` (include) and the `@` prefix is ignored, so the
174
- notation below is valid and will report only exports tagged `@lintignore` or
175
- `@internal`:
176
-
177
- ```json
178
- {
179
- "tags": ["@lintignore", "@internal"]
180
- }
181
- ```
182
-
183
- Also see [JSDoc & TSDoc Tags][8].
184
-
185
- ### `treatConfigHintsAsErrors`
186
-
187
- Exit with non-zero code (1) if there are any configuration hints.
188
-
189
- ```json title="knip.json"
190
- {
191
- "treatConfigHintsAsErrors": true
192
- }
193
- ```
194
-
195
- ## Ignore Issues
196
-
197
- ### `ignore`
198
-
199
- :::tip
200
-
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.
204
-
205
- :::
206
-
207
- Array of glob patterns to ignore issues from matching files. Example:
208
-
209
- ```json title="knip.json"
210
- {
211
- "ignore": ["src/generated.ts", "fixtures/**"]
212
- }
213
- ```
214
-
215
- ### `ignoreFiles`
216
-
217
- Array of glob patterns of files to exclude from the "Unused files" section only.
218
-
219
- Unlike `ignore`, which suppresses all issue types for matching files,
220
- `ignoreFiles` only affects the `files` issue type. Use this when a file should
221
- remain analyzed for other issues (exports, dependencies, unresolved) but should
222
- not be considered for unused file detection.
223
-
224
- ```json title="knip.json"
225
- {
226
- "ignoreFiles": ["src/generated/**", "fixtures/**"]
227
- }
228
- ```
229
-
230
- Suffix an item with `!` to enable it only in production mode.
231
-
232
- ### `ignoreBinaries`
233
-
234
- Exclude binaries that are used but not provided by any dependency from the
235
- report. Value is an array of binary names or regular expressions. Example:
236
-
237
- ```json title="knip.json"
238
- {
239
- "ignoreBinaries": ["zip", "docker-compose", "pm2-.+"]
240
- }
241
- ```
242
-
243
- Actual regular expressions can be used in dynamic configurations:
244
-
245
- ```ts title="knip.ts"
246
- export default {
247
- ignoreBinaries: [/^pm2-.+/],
248
- };
249
- ```
250
-
251
- Suffix an item with `!` to enable it only in production mode.
252
-
253
- ### `ignoreDependencies`
254
-
255
- Array of package names to exclude from the report. Regular expressions allowed.
256
- Example:
257
-
258
- ```json title="knip.json"
259
- {
260
- "ignoreDependencies": ["hidden-package", "@org/.+"]
261
- }
262
- ```
263
-
264
- Actual regular expressions can be used in dynamic configurations:
265
-
266
- ```ts title="knip.ts"
267
- export default {
268
- ignoreDependencies: [/@org\/.*/, /^lib-.+/],
269
- };
270
- ```
271
-
272
- Suffix an item with `!` to enable it only in production mode.
273
-
274
- ### `ignoreMembers`
275
-
276
- Array of class and enum members to exclude from the report. Regular expressions
277
- allowed. Example:
278
-
279
- ```json title="knip.json"
280
- {
281
- "ignoreMembers": ["render", "on.+"]
282
- }
283
- ```
284
-
285
- Actual regular expressions can be used in dynamic configurations.
286
-
287
- ### `ignoreUnresolved`
288
-
289
- Array of specifiers to exclude from the report. Regular expressions allowed.
290
- Example:
291
-
292
- ```json title="knip.json"
293
- {
294
- "ignoreUnresolved": ["ignore-unresolved-import", "#virtual/.+"]
295
- }
296
- ```
297
-
298
- Actual regular expressions can be used in dynamic configurations:
299
-
300
- ```ts title="knip.ts"
301
- export default {
302
- ignoreUnresolved: [/^#/.+/],
303
- };
304
- ```
305
-
306
- ### `ignoreWorkspaces`
307
-
308
- Array of workspaces to ignore, globs allowed. Example:
309
-
310
- ```json title="knip.json"
311
- {
312
- "ignoreWorkspaces": [
313
- "packages/go-server",
314
- "packages/flat/*",
315
- "packages/deep/**"
316
- ]
317
- }
318
- ```
319
-
320
- Suffix an item with `!` to enable it only in production mode.
321
-
322
- Prefix an item with `!` to override an earlier wildcard.
323
-
324
- ### `ignoreIssues`
325
-
326
- Ignore specific issue types for specific file patterns. Keys are glob patterns
327
- and values are arrays of issue types to ignore for matching files. This allows
328
- ignoring specific issues (like unused exports) in generated files while still
329
- reporting other issues in those same files.
330
-
331
- ```json title="knip.json"
332
- {
333
- "ignoreIssues": {
334
- "src/generated/**": ["exports", "types"],
335
- "**/*.generated.ts": ["exports", "classMembers"]
336
- }
337
- }
338
- ```
339
-
340
- ## Exports
341
-
342
- ### `ignoreExportsUsedInFile`
343
-
344
- In files with multiple exports, some of them might be used only internally. If
345
- these exports should not be reported, there is a `ignoreExportsUsedInFile`
346
- option available. With this option enabled, when something is also no longer
347
- used internally, it will be reported as unused.
348
-
349
- ```json title="knip.json"
350
- {
351
- "ignoreExportsUsedInFile": true
352
- }
353
- ```
354
-
355
- In a more fine-grained manner, to ignore only specific issue types:
356
-
357
- ```json title="knip.json"
358
- {
359
- "ignoreExportsUsedInFile": {
360
- "interface": true,
361
- "type": true
362
- }
363
- }
364
- ```
365
-
366
- ### `includeEntryExports`
367
-
368
- By default, Knip does not report unused exports in entry files. When a
369
- repository (or workspace) is self-contained or private, you may want to include
370
- entry files when reporting unused exports:
371
-
372
- ```json title="knip.json"
373
- {
374
- "includeEntryExports": true
375
- }
376
- ```
377
-
378
- If enabled, Knip will report unused exports in entry source files. But not in
379
- entry and configuration files as configured by plugins, such as `next.config.js`
380
- or `src/routes/+page.svelte`.
381
-
382
- This will also enable reporting unused members of exported classes and enums.
383
-
384
- Set this option at root level to enable this globally, or within workspace
385
- configurations individually.
386
-
387
- ## Compilers
388
-
389
- Knip supports custom compilers to transform files before analysis.
390
-
391
- :::note
392
-
393
- Since compilers are functions, they can only be used in dynamic configuration
394
- files (`.js` or `.ts`), not in JSON configuration files.
395
-
396
- :::
397
-
398
- ### `compilers`
399
-
400
- Override built-in compilers or add custom compilers for additional file types.
401
-
402
- Also see [Compilers][10].
403
-
404
- [1]: ../reference/dynamic-configuration.mdx
405
- [2]: ../overview/configuration.md
406
- [3]: ../explanations/entry-files.md
407
- [4]: ../features/monorepos-and-workspaces.md
408
- [5]: ../explanations/plugins.md#entry-files
409
- [6]: ../explanations/plugins.md
410
- [7]: ../features/rules-and-filters.md#filters
411
- [8]: ./jsdoc-tsdoc-tags.md
412
- [9]: ../guides/configuring-project-files.md
413
- [10]: ../features/compilers.md
@@ -1,72 +0,0 @@
1
- ---
2
- title: Dynamic Configuration
3
- ---
4
-
5
- import { Tabs, TabItem } from '@astrojs/starlight/components';
6
-
7
- ## TypeScript
8
-
9
- Instead of a JSON file, you can use a JavaScript or TypeScript file for a
10
- dynamic configuration and type annotations:
11
-
12
- <Tabs syncKey="lang">
13
- <TabItem label="TypeScript">
14
- ```ts title="knip.ts"
15
- import type { KnipConfig } from 'knip';
16
-
17
- const config: KnipConfig = {
18
- entry: ['src/index.ts'],
19
- project: ['src/**/*.ts'],
20
- };
21
-
22
- export default config;
23
- ```
24
- </TabItem>
25
-
26
- <TabItem label="JavaScript">
27
- ```js title="knip.js"
28
- /** @type {import('knip').KnipConfig} */
29
- const config = {
30
- entry: ['src/index.ts'],
31
- project: ['src/**/*.ts'],
32
- };
33
-
34
- export default config;
35
- ```
36
- </TabItem>
37
- </Tabs>
38
-
39
- ## Function
40
-
41
- You can export a regular or async function that returns the configuration object
42
- as well:
43
-
44
- <Tabs syncKey="lang">
45
- <TabItem label="TypeScript">
46
- ```ts title="knip.ts"
47
- import type { KnipConfig } from 'knip';
48
-
49
- const config = async (): Promise<KnipConfig> => {
50
- const items = await fetchRepoInfo();
51
-
52
- return {
53
- entry: ['src/index.ts', ...items],
54
- project: ['src/**/*.ts'],
55
- };
56
- };
57
-
58
- export default config;
59
- ```
60
- </TabItem>
61
-
62
- <TabItem label="JavaScript">
63
- ```ts title="knip.js"
64
- const config = async () => ({
65
- entry: ['src/index.ts'],
66
- project: ['src/**/*.ts'],
67
- });
68
-
69
- export default config;
70
- ```
71
- </TabItem>
72
- </Tabs>