@@ -31,51 +31,51 @@ The dots don't connect themselves. This is where Knip comes in:
31
31
32
32
Knip shines in both small and large projects. It's a fresh take on keeping your projects clean & tidy!
33
33
34
- [ ![ An orange cow with scissors, Van Gogh style] [ 10 ]] [ 9 ] <sup >_ “An orange cow with scissors, Van Gogh style” - generated
35
- with OpenAI_ </sup >
34
+ ![ An orange cow with scissors, Van Gogh style] [ 9 ] <sup >_ “An orange cow with scissors, Van Gogh style” - generated with
35
+ OpenAI_ </sup >
36
36
37
- For updates or questions, come hang out in [ The Knip Barn (Discord)] [ 11 ] , or follow [ @webprolific (Twitter)] [ 12 ] or
38
- [ @webpro (fosstodon.org)] [ 13 ] . Please use GitHub to [ report issues] [ 14 ] .
37
+ For updates or questions, come hang out in [ The Knip Barn (Discord)] [ 10 ] , or follow [ @webprolific (Twitter)] [ 11 ] or
38
+ [ @webpro (fosstodon.org)] [ 12 ] . Please use GitHub to [ report issues] [ 13 ] .
39
39
40
40
## Contents
41
41
42
- - [ Getting Started] [ 15 ]
43
- - [ Installation] [ 16 ]
44
- - [ Default Configuration] [ 17 ]
45
- - [ Let's Go!] [ 18 ]
46
- - [ Configuration] [ 19 ]
47
- - [ Entry Files] [ 20 ]
42
+ - [ Getting Started] [ 14 ]
43
+ - [ Installation] [ 15 ]
44
+ - [ Default Configuration] [ 16 ]
45
+ - [ Let's Go!] [ 17 ]
46
+ - [ Configuration] [ 18 ]
47
+ - [ Entry Files] [ 19 ]
48
48
- [ Workspaces] [ 1 ]
49
49
- [ Plugins] [ 2 ]
50
50
- [ Compilers] [ 3 ]
51
- - [ Ignore files, binaries, dependencies and workspaces] [ 21 ]
52
- - [ Public exports] [ 22 ]
53
- - [ Ignore exports used in file] [ 23 ]
54
- - [ Include exports in entry files] [ 24 ]
55
- - [ Paths] [ 25 ]
51
+ - [ Ignore files, binaries, dependencies and workspaces] [ 20 ]
52
+ - [ Public exports] [ 21 ]
53
+ - [ Ignore exports used in file] [ 22 ]
54
+ - [ Include exports in entry files] [ 23 ]
55
+ - [ Paths] [ 24 ]
56
56
- [ Production Mode] [ 4 ]
57
- - [ Strict] [ 26 ]
58
- - [ Ignore ` @internal ` exports] [ 27 ]
59
- - [ Plugins] [ 28 ]
60
- - [ Output] [ 29 ]
61
- - [ Screenshots] [ 30 ]
62
- - [ Reading the report] [ 31 ]
63
- - [ Rules & Filters] [ 32 ]
57
+ - [ Strict] [ 25 ]
58
+ - [ Ignore ` @internal ` exports] [ 26 ]
59
+ - [ Plugins] [ 27 ]
60
+ - [ Output] [ 28 ]
61
+ - [ Screenshots] [ 29 ]
62
+ - [ Reading the report] [ 30 ]
63
+ - [ Rules & Filters] [ 31 ]
64
64
- [ Reporters] [ 5 ]
65
- - [ Fixing Issues] [ 33 ]
65
+ - [ Fixing Issues] [ 32 ]
66
66
- [ JSDoc tags] [ 8 ]
67
- - [ Command Line Options] [ 34 ]
68
- - [ Potential boost with ` --no-gitignore ` ] [ 35 ]
69
- - [ Comparison & Migration] [ 36 ]
70
- - [ depcheck] [ 37 ]
71
- - [ unimported] [ 38 ]
72
- - [ ts-unused-exports] [ 39 ]
73
- - [ ts-prune] [ 40 ]
74
- - [ Projects using Knip] [ 41 ]
75
- - [ Articles, etc.] [ 42 ]
76
- - [ Why "Knip"?] [ 43 ]
77
- - [ Really, another unused file/dependency/export finder?] [ 44 ]
78
- - [ Contributors] [ 45 ]
67
+ - [ Command Line Options] [ 33 ]
68
+ - [ Potential boost with ` --no-gitignore ` ] [ 34 ]
69
+ - [ Comparison & Migration] [ 35 ]
70
+ - [ depcheck] [ 36 ]
71
+ - [ unimported] [ 37 ]
72
+ - [ ts-unused-exports] [ 38 ]
73
+ - [ ts-prune] [ 39 ]
74
+ - [ Projects using Knip] [ 40 ]
75
+ - [ Articles, etc.] [ 41 ]
76
+ - [ Why "Knip"?] [ 42 ]
77
+ - [ Really, another unused file/dependency/export finder?] [ 43 ]
78
+ - [ Contributors] [ 44 ]
79
79
80
80
## Getting Started
81
81
@@ -100,7 +100,7 @@ Knip has good defaults and aims for no or little configuration. The (simplified)
100
100
}
101
101
```
102
102
103
- There's more, jump to [ Entry Files] [ 20 ] for details.
103
+ There's more, jump to [ Entry Files] [ 19 ] for details.
104
104
105
105
Knip looks for this configuration file (ordered by priority):
106
106
@@ -156,7 +156,7 @@ Then use `npm run knip` to analyze the project and output unused files, dependen
156
156
157
157
Knip works just fine with ` yarn ` or ` pnpm ` or ` bun ` .
158
158
159
- See [ Command Line Options] [ 34 ] for an overview of available CLI options.
159
+ See [ Command Line Options] [ 33 ] for an overview of available CLI options.
160
160
161
161
## Configuration
162
162
@@ -219,7 +219,7 @@ Here's an example `knip.json` configuration with some custom `entry` and `projec
219
219
```
220
220
221
221
It might be useful to run Knip first with no or little configuration to see where it needs custom ` entry ` and/or
222
- ` project ` files. Each workspace has the same [ default configuration] [ 19 ] .
222
+ ` project ` files. Each workspace has the same [ default configuration] [ 18 ] .
223
223
224
224
The root workspace is named ` "." ` under ` workspaces ` (like in the example).
225
225
@@ -320,7 +320,7 @@ themselves and/or `entry` files for Knip to analyze.
320
320
321
321
See each plugin's documentation for its default values.
322
322
323
- In an Astro, Svelte or Vue project? Make sure to see [ compilers] [ 46 ] and add some extra configuration.
323
+ In an Astro, Svelte or Vue project? Make sure to see [ compilers] [ 45 ] and add some extra configuration.
324
324
325
325
#### ` config `
326
326
@@ -359,7 +359,7 @@ level by setting it to `false` there, and vice versa.
359
359
#### Multi-project repositories
360
360
361
361
Some repositories have a single ` package.json ` , but consist of multiple projects with configuration files across the
362
- repository (such as the [ Nx "intregrated repo" style] [ 47 ] ). Let's assume some of these projects are apps and have their
362
+ repository (such as the [ Nx "intregrated repo" style] [ 46 ] ). Let's assume some of these projects are apps and have their
363
363
own Cypress configuration and test files. In that case, we could configure the Cypress plugin like this:
364
364
365
365
``` json
@@ -372,7 +372,7 @@ own Cypress configuration and test files. In that case, we could configure the C
372
372
373
373
#### Create a new plugin
374
374
375
- Getting false positives because a plugin is missing? Want to help out? Please read more at [ writing a plugin] [ 48 ] . This
375
+ Getting false positives because a plugin is missing? Want to help out? Please read more at [ writing a plugin] [ 47 ] . This
376
376
guide also contains more details if you want to learn more about plugins and why they are useful.
377
377
378
378
### Compilers
@@ -395,7 +395,7 @@ export default {
395
395
};
396
396
```
397
397
398
- Read [ Compilers] [ 46 ] for more details and examples.
398
+ Read [ Compilers] [ 45 ] for more details and examples.
399
399
400
400
### Ignore files, binaries, dependencies and workspaces
401
401
@@ -567,7 +567,7 @@ Note that `devDependencies` is covered within a single key for all `dependencies
567
567
568
568
When an issue type has zero issues, it is not shown.
569
569
570
- Getting too many reported issues and false positives? Read more about [ handling issues] [ 49 ] .
570
+ Getting too many reported issues and false positives? Read more about [ handling issues] [ 48 ] .
571
571
572
572
### Rules & Filters
573
573
@@ -594,7 +594,7 @@ Example:
594
594
}
595
595
```
596
596
597
- See [ reading the report] [ 31 ] for the list of issue types.
597
+ See [ reading the report] [ 30 ] for the list of issue types.
598
598
599
599
The rules are modeled after the ESLint ` rules ` configuration, and could be extended in the future. For instance, to
600
600
apply filters or configurations only to a specific issue type.
@@ -619,7 +619,7 @@ knip --include files --exclude classMembers,enumMembers
619
619
620
620
Use ` --dependencies ` or ` --exports ` as shortcuts to combine groups of related types.
621
621
622
- See [ reading the report] [ 31 ] for the list of issue types.
622
+ See [ reading the report] [ 30 ] for the list of issue types.
623
623
624
624
#### When to use rules or filters
625
625
@@ -643,13 +643,13 @@ Knip provides the following built-in reporters:
643
643
644
644
When the provided built-in reporters are not sufficient, a custom reporter can be implemented.
645
645
646
- Find more details in [ reporters and preprocessors] [ 50 ] .
646
+ Find more details in [ reporters and preprocessors] [ 49 ] .
647
647
648
648
#### Preprocessers
649
649
650
650
Use preprocessers to modify the results before they're passed to the reporter(s).
651
651
652
- Find more details in [ reporters and preprocessors] [ 50 ] .
652
+ Find more details in [ reporters and preprocessors] [ 49 ] .
653
653
654
654
## Fixing Issues
655
655
@@ -667,7 +667,7 @@ Tip: back up files or use an VCS like Git before deleting files or making change
667
667
668
668
Repeat the process to reveal new unused files and exports. It's so liberating to remove unused things!
669
669
670
- Getting too many reported issues and false positives? Read more about [ handling issues] [ 49 ] describing potential causes
670
+ Getting too many reported issues and false positives? Read more about [ handling issues] [ 48 ] describing potential causes
671
671
for false positives, and how to handle them.
672
672
673
673
## JSDoc tags
@@ -733,13 +733,13 @@ $ npx knip --help
733
733
734
734
## Potential boost with ` --no-gitignore `
735
735
736
- To increase performance in a large monorepo, check out [ Potential boost with ` --no-gitignore ` ] [ 51 ] .
736
+ To increase performance in a large monorepo, check out [ Potential boost with ` --no-gitignore ` ] [ 50 ] .
737
737
738
738
## Comparison & Migration
739
739
740
740
This table is an ongoing comparison. Based on their docs (please report any mistakes):
741
741
742
- | Feature | ** knip** | [ depcheck] [ 52 ] | [ unimported] [ 53 ] | [ ts-unused-exports] [ 54 ] | [ ts-prune] [ 55 ] |
742
+ | Feature | ** knip** | [ depcheck] [ 51 ] | [ unimported] [ 52 ] | [ ts-unused-exports] [ 53 ] | [ ts-prune] [ 54 ] |
743
743
| :---------------------- | :------: | :------------: | :--------------: | :---------------------: | :------------: |
744
744
| Unused files | ✅ | - | ✅ | - | - |
745
745
| Unused dependencies | ✅ | ✅ | ✅ | - | - |
@@ -805,25 +805,25 @@ knip --exports # Adds unused exports/types in namespaces and unused enum/class
805
805
806
806
Many thanks to some of the early adopters of Knip:
807
807
808
- - [ Block Protocol] [ 56 ]
809
- - [ DeepmergeTS] [ 57 ]
810
- - [ eslint-plugin-functional] [ 58 ]
811
- - [ freeCodeCamp.org] [ 59 ]
812
- - [ is-immutable-type] [ 60 ]
813
- - [ IsaacScript] [ 61 ]
814
- - [ Nuxt] [ 62 ]
815
- - [ Owncast] [ 63 ]
816
- - [ release-it] [ 64 ]
817
- - [ Template TypeScript Node Package] [ 65 ]
818
- - [ Tipi] [ 66 ]
808
+ - [ Block Protocol] [ 55 ]
809
+ - [ DeepmergeTS] [ 56 ]
810
+ - [ eslint-plugin-functional] [ 57 ]
811
+ - [ freeCodeCamp.org] [ 58 ]
812
+ - [ is-immutable-type] [ 59 ]
813
+ - [ IsaacScript] [ 60 ]
814
+ - [ Nuxt] [ 61 ]
815
+ - [ Owncast] [ 62 ]
816
+ - [ release-it] [ 63 ]
817
+ - [ Template TypeScript Node Package] [ 64 ]
818
+ - [ Tipi] [ 65 ]
819
819
820
820
## Articles, etc.
821
821
822
- - Discord: hang out in [ The Knip Barn] [ 11 ]
823
- - Ask your questions in the [ Knip knowledge base] [ 67 ] (powered by OpenAI and [ 7-docs] [ 68 ] , experimental!)
824
- - Smashing Magazine: [ Knip: An Automated Tool For Finding Unused Files, Exports, And Dependencies] [ 69 ]
825
- - Effective TypeScript: [ Recommendation Update: ✂️ Use knip to detect dead code and types] [ 70 ]
826
- - Josh Goldberg: [ Speeding Up Centered Part 4: Unused Code Bloat] [ 71 ]
822
+ - Discord: hang out in [ The Knip Barn] [ 10 ]
823
+ - Ask your questions in the [ Knip knowledge base] [ 66 ] (powered by OpenAI and [ 7-docs] [ 67 ] , experimental!)
824
+ - Smashing Magazine: [ Knip: An Automated Tool For Finding Unused Files, Exports, And Dependencies] [ 68 ]
825
+ - Effective TypeScript: [ Recommendation Update: ✂️ Use knip to detect dead code and types] [ 69 ]
826
+ - Josh Goldberg: [ Speeding Up Centered Part 4: Unused Code Bloat] [ 70 ]
827
827
828
828
## Why "Knip"?
829
829
@@ -841,7 +841,7 @@ each file, and traversing all of this, why not collect the various issues in one
841
841
842
842
Special thanks to the wonderful people who have contributed to this project:
843
843
844
- [ ![ Contributors] [ 73 ]] [ 72 ]
844
+ [ ![ Contributors] [ 72 ]] [ 71 ]
845
845
846
846
[ 1 ] : #workspaces
847
847
[ 2 ] : #plugins
@@ -851,71 +851,70 @@ Special thanks to the wonderful people who have contributed to this project:
851
851
[ 6 ] : #custom-reporters
852
852
[ 7 ] : #preprocessers
853
853
[ 8 ] : #jsdoc-tags
854
- [ 9 ] : https://labs.openai.com/s/xZQACaLepaKya0PRUPtIN5dC
855
- [ 10 ] : ./assets/cow-with-orange-scissors-van-gogh-style.webp
856
- [ 11 ] : https://discord.gg/r5uXTtbTpc
857
- [ 12 ] : https://twitter.com/webprolific
858
- [ 13 ] : https://fosstodon.org/@webpro
859
- [ 14 ] : https://github.com/webpro/knip/issues
860
- [ 15 ] : #getting-started
861
- [ 16 ] : #installation
862
- [ 17 ] : #default-configuration
863
- [ 18 ] : #lets-go
864
- [ 19 ] : #configuration
865
- [ 20 ] : #entry-files
866
- [ 21 ] : #ignore-files-binaries-dependencies-and-workspaces
867
- [ 22 ] : #public-exports
868
- [ 23 ] : #ignore-exports-used-in-file
869
- [ 24 ] : #include-exports-in-entry-files
870
- [ 25 ] : #paths
871
- [ 26 ] : #strict
872
- [ 27 ] : #ignore-internal-exports
873
- [ 28 ] : #plugins-1
874
- [ 29 ] : #output
875
- [ 30 ] : #screenshots
876
- [ 31 ] : #reading-the-report
877
- [ 32 ] : #rules--filters
878
- [ 33 ] : #fixing-issues
879
- [ 34 ] : #command-line-options
880
- [ 35 ] : #potential-boost-with---no-gitignore
881
- [ 36 ] : #comparison--migration
882
- [ 37 ] : #depcheck
883
- [ 38 ] : #unimported
884
- [ 39 ] : #ts-unused-exports
885
- [ 40 ] : #ts-prune
886
- [ 41 ] : #projects-using-knip
887
- [ 42 ] : #articles-etc
888
- [ 43 ] : #why-knip
889
- [ 44 ] : #really-another-unused-filedependencyexport-finder
890
- [ 45 ] : #contributors
891
- [ 46 ] : ./docs/compilers.md
892
- [ 47 ] : https://nx.dev/concepts/integrated-vs-package-based
893
- [ 48 ] : ./docs/writing-a-plugin.md
894
- [ 49 ] : ./docs/handling-issues.md
895
- [ 50 ] : ./docs/reporters-and-preprocessors.md
896
- [ 51 ] : ./docs/perf-boost-with-no-gitignore.md
897
- [ 52 ] : https://github.com/depcheck/depcheck
898
- [ 53 ] : https://github.com/smeijer/unimported
899
- [ 54 ] : https://github.com/pzavolinsky/ts-unused-exports
900
- [ 55 ] : https://github.com/nadeesha/ts-prune
901
- [ 56 ] : https://github.com/blockprotocol/blockprotocol
902
- [ 57 ] : https://github.com/RebeccaStevens/deepmerge-ts
903
- [ 58 ] : https://github.com/eslint-functional/eslint-plugin-functional
904
- [ 59 ] : https://github.com/freeCodeCamp/freeCodeCamp
905
- [ 60 ] : https://github.com/RebeccaStevens/is-immutable-type
906
- [ 61 ] : https://github.com/IsaacScript/isaacscript
907
- [ 62 ] : https://github.com/nuxt/nuxt
908
- [ 63 ] : https://github.com/owncast/owncast
909
- [ 64 ] : https://github.com/release-it/release-it
910
- [ 65 ] : https://github.com/JoshuaKGoldberg/template-typescript-node-package
911
- [ 66 ] : https://github.com/meienberger/runtipi
912
- [ 67 ] : https://knip.deno.dev
913
- [ 68 ] : https://github.com/7-docs/7-docs
914
- [ 69 ] : https://www.smashingmagazine.com/2023/08/knip-automated-tool-find-unused-files-exports-dependencies/
915
- [ 70 ] : https://effectivetypescript.com/2023/07/29/knip/
916
- [ 71 ] : https://www.joshuakgoldberg.com/blog/speeding-up-centered-part-4-unused-code-bloat/
917
- [ 72 ] : https://github.com/webpro/knip/graphs/contributors
918
- [ 73 ] : https://contrib.rocks/image?repo=webpro/knip
854
+ [ 9 ] : ./assets/cow-with-orange-scissors-van-gogh-style.webp
855
+ [ 10 ] : https://discord.gg/r5uXTtbTpc
856
+ [ 11 ] : https://twitter.com/webprolific
857
+ [ 12 ] : https://fosstodon.org/@webpro
858
+ [ 13 ] : https://github.com/webpro/knip/issues
859
+ [ 14 ] : #getting-started
860
+ [ 15 ] : #installation
861
+ [ 16 ] : #default-configuration
862
+ [ 17 ] : #lets-go
863
+ [ 18 ] : #configuration
864
+ [ 19 ] : #entry-files
865
+ [ 20 ] : #ignore-files-binaries-dependencies-and-workspaces
866
+ [ 21 ] : #public-exports
867
+ [ 22 ] : #ignore-exports-used-in-file
868
+ [ 23 ] : #include-exports-in-entry-files
869
+ [ 24 ] : #paths
870
+ [ 25 ] : #strict
871
+ [ 26 ] : #ignore-internal-exports
872
+ [ 27 ] : #plugins-1
873
+ [ 28 ] : #output
874
+ [ 29 ] : #screenshots
875
+ [ 30 ] : #reading-the-report
876
+ [ 31 ] : #rules--filters
877
+ [ 32 ] : #fixing-issues
878
+ [ 33 ] : #command-line-options
879
+ [ 34 ] : #potential-boost-with---no-gitignore
880
+ [ 35 ] : #comparison--migration
881
+ [ 36 ] : #depcheck
882
+ [ 37 ] : #unimported
883
+ [ 38 ] : #ts-unused-exports
884
+ [ 39 ] : #ts-prune
885
+ [ 40 ] : #projects-using-knip
886
+ [ 41 ] : #articles-etc
887
+ [ 42 ] : #why-knip
888
+ [ 43 ] : #really-another-unused-filedependencyexport-finder
889
+ [ 44 ] : #contributors
890
+ [ 45 ] : ./docs/compilers.md
891
+ [ 46 ] : https://nx.dev/concepts/integrated-vs-package-based
892
+ [ 47 ] : ./docs/writing-a-plugin.md
893
+ [ 48 ] : ./docs/handling-issues.md
894
+ [ 49 ] : ./docs/reporters-and-preprocessors.md
895
+ [ 50 ] : ./docs/perf-boost-with-no-gitignore.md
896
+ [ 51 ] : https://github.com/depcheck/depcheck
897
+ [ 52 ] : https://github.com/smeijer/unimported
898
+ [ 53 ] : https://github.com/pzavolinsky/ts-unused-exports
899
+ [ 54 ] : https://github.com/nadeesha/ts-prune
900
+ [ 55 ] : https://github.com/blockprotocol/blockprotocol
901
+ [ 56 ] : https://github.com/RebeccaStevens/deepmerge-ts
902
+ [ 57 ] : https://github.com/eslint-functional/eslint-plugin-functional
903
+ [ 58 ] : https://github.com/freeCodeCamp/freeCodeCamp
904
+ [ 59 ] : https://github.com/RebeccaStevens/is-immutable-type
905
+ [ 60 ] : https://github.com/IsaacScript/isaacscript
906
+ [ 61 ] : https://github.com/nuxt/nuxt
907
+ [ 62 ] : https://github.com/owncast/owncast
908
+ [ 63 ] : https://github.com/release-it/release-it
909
+ [ 64 ] : https://github.com/JoshuaKGoldberg/template-typescript-node-package
910
+ [ 65 ] : https://github.com/meienberger/runtipi
911
+ [ 66 ] : https://knip.deno.dev
912
+ [ 67 ] : https://github.com/7-docs/7-docs
913
+ [ 68 ] : https://www.smashingmagazine.com/2023/08/knip-automated-tool-find-unused-files-exports-dependencies/
914
+ [ 69 ] : https://effectivetypescript.com/2023/07/29/knip/
915
+ [ 70 ] : https://www.joshuakgoldberg.com/blog/speeding-up-centered-part-4-unused-code-bloat/
916
+ [ 71 ] : https://github.com/webpro/knip/graphs/contributors
917
+ [ 72 ] : https://contrib.rocks/image?repo=webpro/knip
919
918
[ plugin-angular ] : ./src/plugins/angular
920
919
[ plugin-astro ] : ./src/plugins/astro
921
920
[ plugin-ava ] : ./src/plugins/ava
0 commit comments