knip 2.19.7 → 2.19.9

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/README.md CHANGED
@@ -32,45 +32,46 @@ Knip shines in both small and large projects. It's a fresh take on keeping your
32
32
  [![An orange cow with scissors, Van Gogh style][7]][6] <sup>_“An orange cow with scissors, Van Gogh style” - generated
33
33
  with OpenAI_</sup>
34
34
 
35
- 📡 For updates, watch this repository or follow [@webprolific (Twitter)][8] or [@webpro (fosstodon.org)][9].
35
+ For updates or questions, come hang out in [The Knip Barn (Discord)][8], or follow [@webprolific (Twitter)][9] or
36
+ [@webpro (fosstodon.org)][10]. Please use GitHub to [report issues][11].
36
37
 
37
38
  ## Contents
38
39
 
39
- - [Getting Started][10]
40
- - [Installation][11]
41
- - [Default Configuration][12]
42
- - [Let's Go!][13]
43
- - [Configuration][14]
44
- - [Entry Files][15]
40
+ - [Getting Started][12]
41
+ - [Installation][13]
42
+ - [Default Configuration][14]
43
+ - [Let's Go!][15]
44
+ - [Configuration][16]
45
+ - [Entry Files][17]
45
46
  - [Workspaces][1]
46
47
  - [Plugins][2]
47
48
  - [Compilers][3]
48
- - [Ignore files, binaries, dependencies and workspaces][16]
49
- - [Public exports][17]
50
- - [Ignore exports used in file][18]
51
- - [Include exports in entry files][19]
52
- - [Paths][20]
53
- - [Production Mode][21]
54
- - [Strict][22]
55
- - [Plugins][23]
56
- - [Output][24]
57
- - [Screenshots][25]
58
- - [Reading the report][26]
59
- - [Rules & Filters][27]
49
+ - [Ignore files, binaries, dependencies and workspaces][18]
50
+ - [Public exports][19]
51
+ - [Ignore exports used in file][20]
52
+ - [Include exports in entry files][21]
53
+ - [Paths][22]
54
+ - [Production Mode][23]
55
+ - [Strict][24]
56
+ - [Plugins][25]
57
+ - [Output][26]
58
+ - [Screenshots][27]
59
+ - [Reading the report][28]
60
+ - [Rules & Filters][29]
60
61
  - [Reporters][4]
61
- - [Fixing Issues][28]
62
- - [Command Line Options][29]
63
- - [Potential boost with `--no-gitignore`][30]
64
- - [Comparison & Migration][31]
65
- - [depcheck][32]
66
- - [unimported][33]
67
- - [ts-unused-exports][34]
68
- - [ts-prune][35]
69
- - [Projects using Knip][36]
70
- - [Articles, etc.][37]
71
- - [Why "Knip"?][38]
72
- - [Really, another unused file/dependency/export finder?][39]
73
- - [Contributors][40]
62
+ - [Fixing Issues][30]
63
+ - [Command Line Options][31]
64
+ - [Potential boost with `--no-gitignore`][32]
65
+ - [Comparison & Migration][33]
66
+ - [depcheck][34]
67
+ - [unimported][35]
68
+ - [ts-unused-exports][36]
69
+ - [ts-prune][37]
70
+ - [Projects using Knip][38]
71
+ - [Articles, etc.][39]
72
+ - [Why "Knip"?][40]
73
+ - [Really, another unused file/dependency/export finder?][41]
74
+ - [Contributors][42]
74
75
 
75
76
  ## Getting Started
76
77
 
@@ -91,7 +92,7 @@ Knip has good defaults and you can run it without any configuration. The (simpli
91
92
  }
92
93
  ```
93
94
 
94
- There's more, jump to [Entry Files][15] for details.
95
+ There's more, jump to [Entry Files][17] for details.
95
96
 
96
97
  Places where Knip looks for configuration (ordered by priority):
97
98
 
@@ -133,7 +134,7 @@ Run the checks with `npx knip`. Or first add this script to `package.json`:
133
134
  Then use `npm run knip` to analyze the project and output unused files, dependencies and exports. Knip works just fine
134
135
  with `yarn` or `pnpm` as well.
135
136
 
136
- See [Command Line Options][29] for an overview of available CLI options.
137
+ See [Command Line Options][31] for an overview of available CLI options.
137
138
 
138
139
  ## Configuration
139
140
 
@@ -196,7 +197,7 @@ Here's an example `knip.json` configuration with some custom `entry` and `projec
196
197
  ```
197
198
 
198
199
  It might be useful to run Knip first with no or little configuration to see where it needs custom `entry` and/or
199
- `project` files. Each workspace has the same [default configuration][14].
200
+ `project` files. Each workspace has the same [default configuration][16].
200
201
 
201
202
  The root workspace is named `"."` under `workspaces` (like in the example).
202
203
 
@@ -319,7 +320,7 @@ has them at `e2e-tests/*.spec.ts`. Here's how to configure this:
319
320
  #### Multi-project repositories
320
321
 
321
322
  Some repositories have a single `package.json`, but consist of multiple projects with configuration files across the
322
- repository (such as the [Nx "intregrated repo" style][41]). Let's assume some of these projects are apps and have their
323
+ repository (such as the [Nx "intregrated repo" style][43]). Let's assume some of these projects are apps and have their
323
324
  own Cypress configuration and test files. In that case, we could configure the Cypress plugin like this:
324
325
 
325
326
  ```json
@@ -336,7 +337,7 @@ In case a plugin causes issues, it can be disabled by using `false` as its value
336
337
 
337
338
  #### Create a new plugin
338
339
 
339
- Getting false positives because a plugin is missing? Want to help out? Please read more at [writing a plugin][42]. This
340
+ Getting false positives because a plugin is missing? Want to help out? Please read more at [writing a plugin][44]. This
340
341
  guide also contains more details if you want to learn more about plugins and why they are useful.
341
342
 
342
343
  ### Compilers
@@ -359,7 +360,7 @@ export default {
359
360
  };
360
361
  ```
361
362
 
362
- Read [Compilers][43] for more details and examples.
363
+ Read [Compilers][45] for more details and examples.
363
364
 
364
365
  ### Ignore files, binaries, dependencies and workspaces
365
366
 
@@ -521,7 +522,7 @@ The report contains the following types of issues:
521
522
 
522
523
  When an issue type has zero issues, it is not shown.
523
524
 
524
- Getting too many reported issues and false positives? Read more about [handling issues][44].
525
+ Getting too many reported issues and false positives? Read more about [handling issues][46].
525
526
 
526
527
  ### Rules & Filters
527
528
 
@@ -548,7 +549,7 @@ Example:
548
549
  }
549
550
  ```
550
551
 
551
- See [reading the report][26] for the list of issue types.
552
+ See [reading the report][28] for the list of issue types.
552
553
 
553
554
  The rules are modeled after the ESLint `rules` configuration, and could be extended in the future. For instance, to
554
555
  apply filters or configurations only to a specific issue type.
@@ -569,7 +570,7 @@ Use `--exclude` to ignore reports you're not interested in:
569
570
 
570
571
  Use `--dependencies` or `--exports` as shortcuts to combine groups of related types.
571
572
 
572
- See [reading the report][26] for the list of issue types.
573
+ See [reading the report][28] for the list of issue types.
573
574
 
574
575
  #### When to use rules or filters
575
576
 
@@ -596,7 +597,7 @@ When the provided built-in reporters are not sufficient, a custom reporter can b
596
597
  Pass something like `--reporter ./my-reporter` from the command line. The results are passed to the function from its
597
598
  default export and can be used to write issues to `stdout`, a JSON or CSV file, or sent to a service.
598
599
 
599
- Find more details and ideas in [custom reporters][45].
600
+ Find more details and ideas in [custom reporters][47].
600
601
 
601
602
  ## Fixing Issues
602
603
 
@@ -614,7 +615,7 @@ Tip: back up files or use an VCS like Git before deleting files or making change
614
615
 
615
616
  Repeat the process to reveal new unused files and exports. It's so liberating to remove unused things!
616
617
 
617
- Getting too many reported issues and false positives? Read more about [handling issues][46] describing potential causes
618
+ Getting too many reported issues and false positives? Read more about [handling issues][48] describing potential causes
618
619
  for false positives, and how to handle them.
619
620
 
620
621
  ## Command Line Options
@@ -663,13 +664,13 @@ for false positives, and how to handle them.
663
664
 
664
665
  ## Potential boost with `--no-gitignore`
665
666
 
666
- To increase performance in a large monorepo, check out [Potential boost with `--no-gitignore`][47].
667
+ To increase performance in a large monorepo, check out [Potential boost with `--no-gitignore`][49].
667
668
 
668
669
  ## Comparison & Migration
669
670
 
670
671
  This table is an ongoing comparison. Based on their docs (please report any mistakes):
671
672
 
672
- | Feature | **knip** | [depcheck][48] | [unimported][49] | [ts-unused-exports][50] | [ts-prune][51] |
673
+ | Feature | **knip** | [depcheck][50] | [unimported][51] | [ts-unused-exports][52] | [ts-prune][53] |
673
674
  | :---------------------- | :------: | :------------: | :--------------: | :---------------------: | :------------: |
674
675
  | Unused files | ✅ | - | ✅ | - | - |
675
676
  | Unused dependencies | ✅ | ✅ | ✅ | - | - |
@@ -705,7 +706,7 @@ The following commands are similar:
705
706
  unimported
706
707
  knip --production --dependencies --include files
707
708
 
708
- Also see [production mode][21].
709
+ Also see [production mode][23].
709
710
 
710
711
  ### ts-unused-exports
711
712
 
@@ -727,28 +728,30 @@ The following commands are similar:
727
728
 
728
729
  Many thanks to some of the early adopters of Knip:
729
730
 
730
- - [Block Protocol][52]
731
- - [DeepmergeTS][53]
732
- - [eslint-plugin-functional][54]
733
- - [freeCodeCamp.org][55]
734
- - [is-immutable-type][56]
735
- - [IsaacScript][57]
736
- - [Nuxt][58]
737
- - [Owncast][59]
738
- - [release-it][60]
739
- - [Template TypeScript Node Package][61]
740
- - [Tipi][62]
731
+ - [Block Protocol][54]
732
+ - [DeepmergeTS][55]
733
+ - [eslint-plugin-functional][56]
734
+ - [freeCodeCamp.org][57]
735
+ - [is-immutable-type][58]
736
+ - [IsaacScript][59]
737
+ - [Nuxt][60]
738
+ - [Owncast][61]
739
+ - [release-it][62]
740
+ - [Template TypeScript Node Package][63]
741
+ - [Tipi][64]
741
742
 
742
743
  ## Articles, etc.
743
744
 
744
- - Ask your questions in the [Knip knowledge base][63] (powered by OpenAI and [7-docs][64], experimental!)
745
- - Smashing Magazine: [Knip: An Automated Tool For Finding Unused Files, Exports, And Dependencies][65]
746
- - Effective TypeScript: [Recommendation Update: ✂️ Use knip to detect dead code and types][66]
745
+ - Discord: hang out in [The Knip Barn][8]
746
+ - Ask your questions in the [Knip knowledge base][65] (powered by OpenAI and [7-docs][66], experimental!)
747
+ - Smashing Magazine: [Knip: An Automated Tool For Finding Unused Files, Exports, And Dependencies][67]
748
+ - Effective TypeScript: [Recommendation Update: ✂️ Use knip to detect dead code and types][68]
749
+ - Josh Goldberg: [Speeding Up Centered Part 4: Unused Code Bloat][69]
747
750
 
748
751
  ## Why "Knip"?
749
752
 
750
- Knip is Dutch for a "cut". A Dutch expression is "to be ge**knip**t for something", which means to be perfectly suited
751
- for the job. I'm motivated to make Knip perfectly suited for the job of cutting projects to perfection! ✂️
753
+ Knip is Dutch for a "cut". A Dutch expression is "ergens ge**knip**t voor zijn", which means to be perfectly suited for
754
+ the job. I'm motivated to make Knip perfectly suited for the job of cutting projects to perfection! ✂️
752
755
 
753
756
  ## Really, another unused file/dependency/export finder?
754
757
 
@@ -761,7 +764,7 @@ each file, and traversing all of this, why not collect the various issues in one
761
764
 
762
765
  Special thanks to the wonderful people who have contributed to this project:
763
766
 
764
- [![Contributors][68]][67]
767
+ [![Contributors][71]][70]
765
768
 
766
769
  [1]: #workspaces
767
770
  [2]: #plugins
@@ -770,67 +773,70 @@ Special thanks to the wonderful people who have contributed to this project:
770
773
  [5]: #custom-reporters
771
774
  [6]: https://labs.openai.com/s/xZQACaLepaKya0PRUPtIN5dC
772
775
  [7]: ./assets/cow-with-orange-scissors-van-gogh-style.webp
773
- [8]: https://twitter.com/webprolific
774
- [9]: https://fosstodon.org/@webpro
775
- [10]: #getting-started
776
- [11]: #installation
777
- [12]: #default-configuration
778
- [13]: #lets-go
779
- [14]: #configuration
780
- [15]: #entry-files
781
- [16]: #ignore-files-binaries-dependencies-and-workspaces
782
- [17]: #public-exports
783
- [18]: #ignore-exports-used-in-file
784
- [19]: #include-exports-in-entry-files
785
- [20]: #paths
786
- [21]: #production-mode
787
- [22]: #strict
788
- [23]: #plugins-1
789
- [24]: #output
790
- [25]: #screenshots
791
- [26]: #reading-the-report
792
- [27]: #rules--filters
793
- [28]: #fixing-issues
794
- [29]: #command-line-options
795
- [30]: #potential-boost-with---no-gitignore
796
- [31]: #comparison--migration
797
- [32]: #depcheck
798
- [33]: #unimported
799
- [34]: #ts-unused-exports
800
- [35]: #ts-prune
801
- [36]: #projects-using-knip
802
- [37]: #articles-etc
803
- [38]: #why-knip
804
- [39]: #really-another-unused-filedependencyexport-finder
805
- [40]: #contributors
806
- [41]: https://nx.dev/concepts/integrated-vs-package-based
807
- [42]: ./docs/writing-a-plugin.md
808
- [43]: ./docs/compilers.md
809
- [44]: #handling-issues
810
- [45]: ./docs/custom-reporters.md
811
- [46]: ./docs/handling-issues.md
812
- [47]: ./docs/perf-boost-with-no-gitignore.md
813
- [48]: https://github.com/depcheck/depcheck
814
- [49]: https://github.com/smeijer/unimported
815
- [50]: https://github.com/pzavolinsky/ts-unused-exports
816
- [51]: https://github.com/nadeesha/ts-prune
817
- [52]: https://github.com/blockprotocol/blockprotocol
818
- [53]: https://github.com/RebeccaStevens/deepmerge-ts
819
- [54]: https://github.com/eslint-functional/eslint-plugin-functional
820
- [55]: https://github.com/freeCodeCamp/freeCodeCamp
821
- [56]: https://github.com/RebeccaStevens/is-immutable-type
822
- [57]: https://github.com/IsaacScript/isaacscript
823
- [58]: https://github.com/nuxt/nuxt
824
- [59]: https://github.com/owncast/owncast
825
- [60]: https://github.com/release-it/release-it
826
- [61]: https://github.com/JoshuaKGoldberg/template-typescript-node-package
827
- [62]: https://github.com/meienberger/runtipi
828
- [63]: https://knip.deno.dev
829
- [64]: https://github.com/7-docs/7-docs
830
- [65]: https://www.smashingmagazine.com/2023/08/knip-automated-tool-find-unused-files-exports-dependencies/
831
- [66]: https://effectivetypescript.com/2023/07/29/knip/
832
- [67]: https://github.com/webpro/knip/graphs/contributors
833
- [68]: https://contrib.rocks/image?repo=webpro/knip
776
+ [8]: https://discord.gg/ya5yktTq
777
+ [9]: https://twitter.com/webprolific
778
+ [10]: https://fosstodon.org/@webpro
779
+ [11]: https://github.com/webpro/knip/issues
780
+ [12]: #getting-started
781
+ [13]: #installation
782
+ [14]: #default-configuration
783
+ [15]: #lets-go
784
+ [16]: #configuration
785
+ [17]: #entry-files
786
+ [18]: #ignore-files-binaries-dependencies-and-workspaces
787
+ [19]: #public-exports
788
+ [20]: #ignore-exports-used-in-file
789
+ [21]: #include-exports-in-entry-files
790
+ [22]: #paths
791
+ [23]: #production-mode
792
+ [24]: #strict
793
+ [25]: #plugins-1
794
+ [26]: #output
795
+ [27]: #screenshots
796
+ [28]: #reading-the-report
797
+ [29]: #rules--filters
798
+ [30]: #fixing-issues
799
+ [31]: #command-line-options
800
+ [32]: #potential-boost-with---no-gitignore
801
+ [33]: #comparison--migration
802
+ [34]: #depcheck
803
+ [35]: #unimported
804
+ [36]: #ts-unused-exports
805
+ [37]: #ts-prune
806
+ [38]: #projects-using-knip
807
+ [39]: #articles-etc
808
+ [40]: #why-knip
809
+ [41]: #really-another-unused-filedependencyexport-finder
810
+ [42]: #contributors
811
+ [43]: https://nx.dev/concepts/integrated-vs-package-based
812
+ [44]: ./docs/writing-a-plugin.md
813
+ [45]: ./docs/compilers.md
814
+ [46]: #handling-issues
815
+ [47]: ./docs/custom-reporters.md
816
+ [48]: ./docs/handling-issues.md
817
+ [49]: ./docs/perf-boost-with-no-gitignore.md
818
+ [50]: https://github.com/depcheck/depcheck
819
+ [51]: https://github.com/smeijer/unimported
820
+ [52]: https://github.com/pzavolinsky/ts-unused-exports
821
+ [53]: https://github.com/nadeesha/ts-prune
822
+ [54]: https://github.com/blockprotocol/blockprotocol
823
+ [55]: https://github.com/RebeccaStevens/deepmerge-ts
824
+ [56]: https://github.com/eslint-functional/eslint-plugin-functional
825
+ [57]: https://github.com/freeCodeCamp/freeCodeCamp
826
+ [58]: https://github.com/RebeccaStevens/is-immutable-type
827
+ [59]: https://github.com/IsaacScript/isaacscript
828
+ [60]: https://github.com/nuxt/nuxt
829
+ [61]: https://github.com/owncast/owncast
830
+ [62]: https://github.com/release-it/release-it
831
+ [63]: https://github.com/JoshuaKGoldberg/template-typescript-node-package
832
+ [64]: https://github.com/meienberger/runtipi
833
+ [65]: https://knip.deno.dev
834
+ [66]: https://github.com/7-docs/7-docs
835
+ [67]: https://www.smashingmagazine.com/2023/08/knip-automated-tool-find-unused-files-exports-dependencies/
836
+ [68]: https://effectivetypescript.com/2023/07/29/knip/
837
+ [69]: https://www.joshuakgoldberg.com/blog/speeding-up-centered-part-4-unused-code-bloat/
838
+ [70]: https://github.com/webpro/knip/graphs/contributors
839
+ [71]: https://contrib.rocks/image?repo=webpro/knip
834
840
  [plugin-ava]: ./src/plugins/ava
835
841
  [plugin-babel]: ./src/plugins/babel
836
842
  [plugin-capacitor]: ./src/plugins/capacitor
@@ -6,4 +6,6 @@ export const ENTRY_FILE_PATTERNS = ['next.config.{js,ts,cjs,mjs}'];
6
6
  export const PRODUCTION_ENTRY_FILE_PATTERNS = [
7
7
  '{app,pages}/**/*.{js,jsx,ts,tsx}',
8
8
  'src/{app,pages}/**/*.{js,jsx,ts,tsx}',
9
+ 'middleware.{js,ts}',
10
+ 'src/middleware.{js,ts}',
9
11
  ];
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.19.7";
1
+ export declare const version = "2.19.9";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.19.7';
1
+ export const version = '2.19.9';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "2.19.7",
3
+ "version": "2.19.9",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://github.com/webpro/knip",
6
6
  "repository": "github:webpro/knip",
@@ -56,13 +56,13 @@
56
56
  "strip-json-comments": "^5.0.0",
57
57
  "summary": "^2.1.0",
58
58
  "tree-sitter": "0.20.5",
59
- "tree-sitter-bash": "0.20.0",
59
+ "tree-sitter-bash": "0.19.0",
60
60
  "typescript": "^5.0.2",
61
61
  "zod": "^3.22.2",
62
62
  "zod-validation-error": "^1.5.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@jest/types": "29.6.1",
65
+ "@jest/types": "29.6.3",
66
66
  "@npmcli/package-json": "5.0.0",
67
67
  "@release-it/bumper": "5.1.0",
68
68
  "@swc/cli": "0.1.62",
@@ -74,13 +74,13 @@
74
74
  "@types/node": "20.5.1",
75
75
  "@types/npmcli__map-workspaces": "3.0.1",
76
76
  "@types/webpack": "5.28.1",
77
- "@typescript-eslint/eslint-plugin": "6.4.0",
78
- "@typescript-eslint/parser": "6.4.0",
77
+ "@typescript-eslint/eslint-plugin": "6.4.1",
78
+ "@typescript-eslint/parser": "6.4.1",
79
79
  "c8": "8.0.1",
80
80
  "eslint": "8.47.0",
81
81
  "eslint-import-resolver-typescript": "3.6.0",
82
82
  "eslint-plugin-import": "2.28.1",
83
- "eslint-plugin-n": "16.0.1",
83
+ "eslint-plugin-n": "16.0.2",
84
84
  "prettier": "3.0.2",
85
85
  "release-it": "16.1.5",
86
86
  "remark-cli": "11.0.0",