@@ -119,15 +119,15 @@ example,
119
119
reported as unused.
120
120
121
121
Solution: [ create a new plugin] [ 13 ] for the tool or framework that's not [ in the
122
- list] [ 14 ] yet, or [ request it ] [ 15 ] . Or work around it and add ` entry ` patterns
123
- and maybe ignore a dependency or two.
122
+ list] [ 14 ] yet. Or work around it and add ` entry ` patterns and maybe ignore a
123
+ dependency or two.
124
124
125
125
### Incomplete plugin
126
126
127
127
Files may be reported as unused if existing plugins do not include that entry
128
- file pattern yet. See the [ plugins section of entry files] [ 16 ] for more details.
128
+ file pattern yet. See the [ plugins section of entry files] [ 15 ] for more details.
129
129
130
- Solution: [ override plugin configuration] [ 17 ] to customize default patterns for
130
+ Solution: [ override plugin configuration] [ 16 ] to customize default patterns for
131
131
existing plugins. Or even better: send a pull request to improve the plugin.
132
132
133
133
### Integrated monorepos
@@ -136,7 +136,7 @@ Multiple instances of configuration files like `.eslintrc` and
136
136
` jest.config.json ` across the repository may be reported as unused when working
137
137
in a (mono)repo with a single ` package.json ` .
138
138
139
- Solution: see [ integrated monorepos] [ 18 ] for more details and how to configure
139
+ Solution: see [ integrated monorepos] [ 17 ] for more details and how to configure
140
140
plugins to target those configuration files.
141
141
142
142
### Build artifacts and ignored files
@@ -174,13 +174,13 @@ negated `project` patterns:
174
174
175
175
First off: dependencies imported in unused files are reported as unused
176
176
dependencies. That's why it's strongly recommended to try and remedy [ unused
177
- files] [ 19 ] first. Better ` entry ` and ` project ` file coverage will solve many
177
+ files] [ 18 ] first. Better ` entry ` and ` project ` file coverage will solve many
178
178
cases of reported unused dependencies.
179
179
180
180
The most common causes for unused and unlisted dependencies include:
181
181
182
- - [ Missing or incomplete plugin] [ 20 ]
183
- - [ Unreachable code] [ 21 ]
182
+ - [ Missing or incomplete plugin] [ 19 ]
183
+ - [ Unreachable code] [ 20 ]
184
184
185
185
:::caution[ Monorepo]
186
186
@@ -221,7 +221,7 @@ plugin could solve it, a last resort is to ignore it:
221
221
```
222
222
223
223
If a binary (or "executable") is referenced you'll want to use ` ignoreBinaries `
224
- instead. See [ unlisted binaries] [ 22 ] .
224
+ instead. See [ unlisted binaries] [ 21 ] .
225
225
226
226
### Types packages
227
227
@@ -246,7 +246,7 @@ workspaces in a monorepo. This is an issue since we can't "assign" dependencies
246
246
to other workspaces and incorrectly end up having "unlisted dependencies".
247
247
248
248
Most notably, tools like TypeScript, Jest and legacy ESLint suffer from this.
249
- The new [ ESLint flat config system] [ 23 ] does not have this issue, so it's
249
+ The new [ ESLint flat config system] [ 22 ] does not have this issue, so it's
250
250
recommended to migrate if you haven't already.
251
251
252
252
## Unlisted dependencies
@@ -276,7 +276,7 @@ installed that includes that binary. It looks up the `bin` field in the
276
276
reported as an unlisted binary as there is no package listed that contains it.
277
277
278
278
Except for binaries that are most likely meant to be installed on the OS already
279
- and not installed from npm (details: [ list in source] [ 24 ] ).
279
+ and not installed from npm (details: [ list in source] [ 23 ] ).
280
280
281
281
### Missing binaries
282
282
@@ -287,7 +287,7 @@ dependencies and binaries, or by not running Knip from the root of the
287
287
repository.
288
288
289
289
Solution: run Knip from the project root. From there you can [ lint individual
290
- workspaces] [ 25 ] .
290
+ workspaces] [ 24 ] .
291
291
292
292
### Example
293
293
@@ -329,8 +329,8 @@ By default, Knip does not report unused exports of `entry` files.
329
329
330
330
The most common causes for unused exports include:
331
331
332
- - [ Enumerations] [ 26 ]
333
- - [ External libraries] [ 27 ]
332
+ - [ Enumerations] [ 25 ]
333
+ - [ External libraries] [ 26 ]
334
334
335
335
Use the ` --exports ` flag to [ filter] [ 10 ] and focus on issues related to exports:
336
336
@@ -372,7 +372,7 @@ implicitly referenced in an enumeration like the following example:
372
372
</TabItem >
373
373
</Tabs >
374
374
375
- See [ namepace imports] [ 28 ] to see what patterns Knip does consider to be used
375
+ See [ namepace imports] [ 27 ] to see what patterns Knip does consider to be used
376
376
exports.
377
377
378
378
### External libraries
@@ -413,22 +413,22 @@ Knip does not include external type definitions by default so it won't see the
413
413
export being referenced .
414
414
415
415
To include the type definitions of external libraries, use the
416
- [ --include-libs] [ 29 ] flag:
416
+ [ --include-libs] [ 28 ] flag:
417
417
418
418
``` shell
419
419
knip --include-libs
420
420
```
421
421
422
422
This comes at a performance and memory penalty, but should give better results
423
- if you need it. This flag is implied when [ classMembers] [ 30 ] are included (that
423
+ if you need it. This flag is implied when [ classMembers] [ 29 ] are included (that
424
424
feature comes with roughly the same performance penalty).
425
425
426
426
### Exclude exports from the report
427
427
428
428
To exclude unused exports from the report, there are a few options:
429
429
430
- - [ Ignore exports used in file] [ 31 ] for exports used internally.
431
- - Individual exports can be [ tagged using JSDoc syntax] [ 32 ] .
430
+ - [ Ignore exports used in file] [ 30 ] for exports used internally.
431
+ - Individual exports can be [ tagged using JSDoc syntax] [ 31 ] .
432
432
- Have the export in an entry file:
433
433
- Add the file to the ` entry ` file patterns array in the configuration.
434
434
- Move the export(s) to an entry file.
@@ -438,7 +438,7 @@ To exclude unused exports from the report, there are a few options:
438
438
## Missing exports?
439
439
440
440
Did you expect certain exports in the report, but are they missing? They might
441
- be exported from an entry file. In that case, use [ --include-entry-exports] [ 33 ]
441
+ be exported from an entry file. In that case, use [ --include-entry-exports] [ 32 ]
442
442
to make Knip also report unused exports in entry files.
443
443
444
444
The exports of non-standard extensions like ` .astro ` , ` .mdx ` , ` .vue ` or
@@ -456,10 +456,10 @@ knip --include classMembers
456
456
This option is also available in the Knip configuration file. Note that this
457
457
feature comes at a cost: linting will take more time and more memory.
458
458
459
- Individual class members can be [ tagged using JSDoc syntax] [ 32 ] .
459
+ Individual class members can be [ tagged using JSDoc syntax] [ 31 ] .
460
460
461
461
Classes exported from entry files are ignored, and so are their members. Use
462
- [ --include-entry-exports] [ 33 ] to make Knip also report members of unused exports
462
+ [ --include-entry-exports] [ 32 ] to make Knip also report members of unused exports
463
463
in entry files.
464
464
465
465
## Enum members
@@ -471,18 +471,18 @@ members can also be disabled altogether, for example:
471
471
knip --exclude enumMembers
472
472
```
473
473
474
- Individual enum members can be [ tagged using JSDoc syntax] [ 32 ] .
474
+ Individual enum members can be [ tagged using JSDoc syntax] [ 31 ] .
475
475
476
476
Enums exported from entry files are ignored, and so are their members. Use
477
- [ --include-entry-exports] [ 33 ] to make Knip also report members of unused exports
477
+ [ --include-entry-exports] [ 32 ] to make Knip also report members of unused exports
478
478
in entry files.
479
479
480
480
## Feedback or false positives?
481
481
482
482
If you believe Knip incorrectly reports something as unused (i.e. there's a
483
- false positive), feel free to create a [ minimal reproduction] [ 34 ] and open an
483
+ false positive), feel free to create a [ minimal reproduction] [ 33 ] and open an
484
484
issue on GitHub. It'll make Knip better for everyone! Join the [ Discord
485
- channel] [ 35 ] to discuss any feedback or questions you may have.
485
+ channel] [ 34 ] to discuss any feedback or questions you may have.
486
486
487
487
[ 1 ] : #dynamic-import-specifiers
488
488
[ 2 ] : #unsupported-arguments-in-scripts
@@ -498,25 +498,24 @@ channel][35] to discuss any feedback or questions you may have.
498
498
[ 12 ] : ../features/compilers.md
499
499
[ 13 ] : ./writing-a-plugin.md
500
500
[ 14 ] : ../reference/plugins.md
501
- [ 15 ] : https://github.com/webpro-nl/knip/issues/483
502
- [ 16 ] : ../explanations/plugins.md#entry-files
503
- [ 17 ] : ../explanations/entry-files.md#plugins
504
- [ 18 ] : ../features/integrated-monorepos.md
505
- [ 19 ] : #unused-files
506
- [ 20 ] : #missing-or-incomplete-plugin
507
- [ 21 ] : #unreachable-code
508
- [ 22 ] : #unlisted-binaries
509
- [ 23 ] : https://eslint.org/docs/latest/use/configure/configuration
510
- [ 24] :
501
+ [ 15 ] : ../explanations/plugins.md#entry-files
502
+ [ 16 ] : ../explanations/entry-files.md#plugins
503
+ [ 17 ] : ../features/integrated-monorepos.md
504
+ [ 18 ] : #unused-files
505
+ [ 19 ] : #missing-or-incomplete-plugin
506
+ [ 20 ] : #unreachable-code
507
+ [ 21 ] : #unlisted-binaries
508
+ [ 22 ] : https://eslint.org/docs/latest/use/configure/configuration
509
+ [ 23] :
511
510
https://github.com/webpro-nl/knip/blob/6f561ff09b4f1bf36585b64210ee34ea27ae04ea/packages/knip/src/constants.ts#L32-L133
512
- [ 25 ] : ../features/monorepos-and-workspaces.md#lint-a-single-workspace
513
- [ 26 ] : #enumerations
514
- [ 27 ] : #external-libraries
515
- [ 28 ] : ../guides/namespace-imports.md
516
- [ 29 ] : ../reference/cli#--include-libs
517
- [ 30 ] : #class-members
518
- [ 31 ] : ../reference/configuration.md#ignoreexportsusedinfile
519
- [ 32 ] : ../reference/jsdoc-tsdoc-tags.md
520
- [ 33 ] : ../reference/configuration.md#includeentryexports
521
- [ 34 ] : ../guides/issue-reproduction
522
- [ 35 ] : https://discord.gg/r5uXTtbTpc
511
+ [ 24 ] : ../features/monorepos-and-workspaces.md#lint-a-single-workspace
512
+ [ 25 ] : #enumerations
513
+ [ 26 ] : #external-libraries
514
+ [ 27 ] : ../guides/namespace-imports.md
515
+ [ 28 ] : ../reference/cli#--include-libs
516
+ [ 29 ] : #class-members
517
+ [ 30 ] : ../reference/configuration.md#ignoreexportsusedinfile
518
+ [ 31 ] : ../reference/jsdoc-tsdoc-tags.md
519
+ [ 32 ] : ../reference/configuration.md#includeentryexports
520
+ [ 33 ] : ../guides/issue-reproduction
521
+ [ 34 ] : https://discord.gg/r5uXTtbTpc
0 commit comments