knip 1.15.0 → 1.17.0

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
@@ -271,39 +271,43 @@ Here's some example output when running Knip in a workspace:
271
271
 
272
272
  Knip contains a growing list of plugins:
273
273
 
274
- - [Babel][13]
275
- - [Capacitor][14]
276
- - [Changesets][15]
277
- - [commitlint][16]
278
- - [cspell][17]
279
- - [Cypress][18]
280
- - [ESLint][19]
281
- - [Gatsby][20]
282
- - [GitHub Actions][21]
283
- - [husky][22]
284
- - [Jest][23]
285
- - [Lefthook][24]
286
- - [lint-staged][25]
287
- - [markdownlint][26]
288
- - [Mocha][27]
289
- - [Next.js][28]
290
- - [npm-package-json-lint][29]
291
- - [Nx][30]
292
- - [nyc][31]
293
- - [Playwright][32]
294
- - [PostCSS][33]
295
- - [Prettier][34]
296
- - [Release It][35]
297
- - [Remark][36]
298
- - [Remix][37]
299
- - [Rollup][38]
300
- - [Sentry][39]
301
- - [Storybook][40]
302
- - [Stryker][41]
303
- - [TypeDoc][42]
304
- - [TypeScript][43]
305
- - [Vitest][44]
306
- - [Webpack][45]
274
+ - [Ava][plugin-ava]
275
+ - [Babel][plugin-babel]
276
+ - [Capacitor][plugin-capacitor]
277
+ - [Changesets][plugin-changesets]
278
+ - [Commitizen][plugin-commitizen]
279
+ - [commitlint][plugin-commitlint]
280
+ - [cspell][plugin-cspell]
281
+ - [Cypress][plugin-cypress]
282
+ - [ESLint][plugin-eslint]
283
+ - [Gatsby][plugin-gatsby]
284
+ - [GitHub Actions][plugin-github-actions]
285
+ - [husky][plugin-husky]
286
+ - [Jest][plugin-jest]
287
+ - [Lefthook][plugin-lefthook]
288
+ - [lint-staged][plugin-lint-staged]
289
+ - [markdownlint][plugin-markdownlint]
290
+ - [Mocha][plugin-mocha]
291
+ - [Next.js][plugin-next]
292
+ - [npm-package-json-lint][plugin-npm-package-json-lint]
293
+ - [Nx][plugin-nx]
294
+ - [nyc][plugin-nyc]
295
+ - [Playwright][plugin-playwright]
296
+ - [PostCSS][plugin-postcss]
297
+ - [Prettier][plugin-prettier]
298
+ - [Release It][plugin-release-it]
299
+ - [Remark][plugin-remark]
300
+ - [Remix][plugin-remix]
301
+ - [Rollup][plugin-rollup]
302
+ - [Semantic Release][plugin-semantic-release]
303
+ - [Sentry][plugin-sentry]
304
+ - [Storybook][plugin-storybook]
305
+ - [Stryker][plugin-stryker]
306
+ - [Tailwind][plugin-tailwind]
307
+ - [TypeDoc][plugin-typedoc]
308
+ - [TypeScript][plugin-typescript]
309
+ - [Vitest][plugin-vitest]
310
+ - [Webpack][plugin-webpack]
307
311
 
308
312
  Plugins are automatically activated. Each plugin is automatically enabled based on simple heuristics. Most of them check
309
313
  whether one or one of a few (dev) dependencies are listed in `package.json`. Once enabled, they add a set of
@@ -311,7 +315,7 @@ configuration and/or entry files for Knip to analyze. These defaults can be over
311
315
 
312
316
  Most plugins use one or both of the following file types:
313
317
 
314
- - `config` - custom dependency resolvers are applied to the [config files][46]
318
+ - `config` - custom dependency resolvers are applied to the [config files][13]
315
319
  - `entry` - files to include with the analysis of the rest of the source code
316
320
 
317
321
  See each plugin's documentation for its default values.
@@ -337,7 +341,7 @@ Other configuration files use `require` or `import` statements to use dependenci
337
341
  rest of the source files. These configuration files are also considered `entry` files.
338
342
 
339
343
  For plugins related to test files, it's good to know that the following glob patterns are always included by default
340
- (see [TEST_FILE_PATTERNS in constants.ts][47]):
344
+ (see [TEST_FILE_PATTERNS in constants.ts][14]):
341
345
 
342
346
  - `**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs}`
343
347
  - `**/__tests__/**/*.{js,jsx,ts,tsx,mjs,cjs}`
@@ -419,10 +423,10 @@ Each workspace can also have its own `paths` configured. Note that Knip `paths`
419
423
 
420
424
  Knip provides the following built-in reporters:
421
425
 
422
- - [`codeowners`][48]
423
- - [`compact`][49]
424
- - [`json`][50]
425
- - [`symbol`][51] (default)
426
+ - `codeowners`
427
+ - `compact`
428
+ - `json`
429
+ - `symbol` (default)
426
430
 
427
431
  The `compact` reporter shows the sorted files first, and then a list of symbols:
428
432
 
@@ -449,7 +453,7 @@ type ReporterOptions = {
449
453
 
450
454
  The data can then be used to write issues to `stdout`, a JSON or CSV file, or sent to a service.
451
455
 
452
- Find more details and ideas in [custom reporters][52].
456
+ Find more details and ideas in [custom reporters][15].
453
457
 
454
458
  ## Libraries and "unused" exports
455
459
 
@@ -503,11 +507,11 @@ instance by ignoring specific folders that are not related to the source code im
503
507
  Dependencies that are only imported in unused files are also marked as unused. So a long list of unused files would be
504
508
  good to remedy first.
505
509
 
506
- When unused dependencies are related to dependencies having a Knip [plugin][1], maybe the `config` and/or `entry` files
510
+ When unused dependencies are related to dependencies having a Knip [plugin][2], maybe the `config` and/or `entry` files
507
511
  for that dependency are at custom locations. The default values are at the plugin's documentation, and can be overridden
508
512
  to match the custom location(s).
509
513
 
510
- When the dependencies don't have a Knip plugin yet, please file an issue or [create a new plugin][53].
514
+ When the dependencies don't have a Knip plugin yet, please file an issue or [create a new plugin][16].
511
515
 
512
516
  #### Too many unused exports
513
517
 
@@ -515,7 +519,7 @@ When the project is a library and the exports are meant to be used by consumers
515
519
 
516
520
  1. By default, unused exports of `entry` files are not reported. You could re-export from an existing entry file, or
517
521
  add the containing file to the `entry` array in the configuration.
518
- 2. The exported values or types can be marked [using the JSDoc `@public` tag][54].
522
+ 2. The exported values or types can be marked [using the JSDoc `@public` tag][17].
519
523
 
520
524
  ### How to start using Knip in CI while having too many issues to sort out?
521
525
 
@@ -535,22 +539,22 @@ All of this is hiding problems, so please make sure to plan for fixing them and/
535
539
 
536
540
  This table is an ongoing comparison. Based on their docs (please report any mistakes):
537
541
 
538
- | Feature | **knip** | [depcheck][55] | [unimported][56] | [ts-unused-exports][57] | [ts-prune][58] |
539
- | :--------------------------------- | :------: | :------------: | :--------------: | :---------------------: | :------------: |
540
- | Unused files | ✅ | - | ✅ | - | - |
541
- | Unused dependencies | ✅ | ✅ | ✅ | - | - |
542
- | Unlisted dependencies | ✅ | ✅ | ✅ | - | - |
543
- | [Plugins][1] | ✅ | ✅ | ❌ | - | - |
544
- | Unused exports | ✅ | - | - | ✅ | ✅ |
545
- | Unused class members | ✅ | - | - | - | - |
546
- | Unused enum members | ✅ | - | - | - | - |
547
- | Duplicate exports | ✅ | - | - | ❌ | ❌ |
548
- | Search namespaces | ✅ | - | - | ✅ | ❌ |
549
- | Custom reporters | ✅ | - | - | - | - |
550
- | JavaScript support | ✅ | ✅ | ✅ | - | - |
551
- | Configure entry files | ✅ | ❌ | ✅ | ❌ | ❌ |
552
- | [Support workspaces/monorepos][52] | ✅ | ❌ | ❌ | - | - |
553
- | ESLint plugin available | - | - | - | ✅ | - |
542
+ | Feature | **knip** | [depcheck][18] | [unimported][19] | [ts-unused-exports][20] | [ts-prune][21] |
543
+ | :-------------------------------- | :------: | :------------: | :--------------: | :---------------------: | :------------: |
544
+ | Unused files | ✅ | - | ✅ | - | - |
545
+ | Unused dependencies | ✅ | ✅ | ✅ | - | - |
546
+ | Unlisted dependencies | ✅ | ✅ | ✅ | - | - |
547
+ | [Plugins][2] | ✅ | ✅ | ❌ | - | - |
548
+ | Unused exports | ✅ | - | - | ✅ | ✅ |
549
+ | Unused class members | ✅ | - | - | - | - |
550
+ | Unused enum members | ✅ | - | - | - | - |
551
+ | Duplicate exports | ✅ | - | - | ❌ | ❌ |
552
+ | Search namespaces | ✅ | - | - | ✅ | ❌ |
553
+ | Custom reporters | ✅ | - | - | - | - |
554
+ | JavaScript support | ✅ | ✅ | ✅ | - | - |
555
+ | Configure entry files | ✅ | ❌ | ✅ | ❌ | ❌ |
556
+ | [Support workspaces/monorepos][1] | ✅ | ❌ | ❌ | - | - |
557
+ | ESLint plugin available | - | - | - | ✅ | - |
554
558
 
555
559
  ✅ = Supported, ❌ = Not supported, - = Out of scope
556
560
 
@@ -570,7 +574,7 @@ The following commands are similar:
570
574
  unimported
571
575
  knip --production --dependencies --include files
572
576
 
573
- Also see [production mode][59].
577
+ Also see [production mode][22].
574
578
 
575
579
  ### ts-unused-exports
576
580
 
@@ -600,6 +604,12 @@ userland territory, much like code linters.
600
604
  Knip is Dutch for a "cut". A Dutch expression is "to be ge**knip**t for something", which means to be perfectly suited
601
605
  for the job. I'm motivated to make knip perfectly suited for the job of cutting projects to perfection! ✂️
602
606
 
607
+ ## Contributors
608
+
609
+ Special thanks to the wonderful people who have contributed to this project:
610
+
611
+ [![Contributors][24]][23]
612
+
603
613
  [1]: #workspaces--monorepos
604
614
  [2]: #plugins
605
615
  [3]: #reporters
@@ -612,50 +622,52 @@ for the job. I'm motivated to make knip perfectly suited for the job of cutting
612
622
  [10]: https://github.com/webpro/knip/issues
613
623
  [11]: #faq
614
624
  [12]: #ignore
615
- [13]: ./src/plugins/babel
616
- [14]: ./src/plugins/capacitor
617
- [15]: ./src/plugins/changesets
618
- [16]: ./src/plugins/commitlint
619
- [17]: ./src/plugins/cspell
620
- [18]: ./src/plugins/cypress
621
- [19]: ./src/plugins/eslint
622
- [20]: ./src/plugins/gatsby
623
- [21]: ./src/plugins/github-actions
624
- [22]: ./src/plugins/husky
625
- [23]: ./src/plugins/jest
626
- [24]: ./src/plugins/lefthook
627
- [25]: ./src/plugins/lint-staged
628
- [26]: ./src/plugins/markdownlint
629
- [27]: ./src/plugins/mocha
630
- [28]: ./src/plugins/next
631
- [29]: ./src/plugins/npm-package-json-lint
632
- [30]: ./src/plugins/nx
633
- [31]: ./src/plugins/nyc
634
- [32]: ./src/plugins/playwright
635
- [33]: ./src/plugins/postcss
636
- [34]: ./src/plugins/prettier
637
- [35]: ./src/plugins/release-it
638
- [36]: ./src/plugins/remark
639
- [37]: ./src/plugins/remix
640
- [38]: ./src/plugins/rollup
641
- [39]: ./src/plugins/sentry
642
- [40]: ./src/plugins/storybook
643
- [41]: ./src/plugins/stryker
644
- [42]: ./src/plugins/typedoc
645
- [43]: ./src/plugins/typescript
646
- [44]: ./src/plugins/vitest
647
- [45]: ./src/plugins/webpack
648
- [46]: #config
649
- [47]: https://github.com/webpro/knip/blob/main/src/constants.ts
650
- [48]: #code-owners
651
- [49]: #compact
652
- [50]: #json
653
- [51]: #symbol-default
654
- [52]: ./docs/custom-reporters.md
655
- [53]: #create-a-new-plugin
656
- [54]: #libraries-and-unused-exports
657
- [55]: https://github.com/depcheck/depcheck
658
- [56]: https://github.com/smeijer/unimported
659
- [57]: https://github.com/pzavolinsky/ts-unused-exports
660
- [58]: https://github.com/nadeesha/ts-prune
661
- [59]: #production-mode
625
+ [13]: #config
626
+ [14]: https://github.com/webpro/knip/blob/main/src/constants.ts
627
+ [15]: ./docs/custom-reporters.md
628
+ [16]: #create-a-new-plugin
629
+ [17]: #libraries-and-unused-exports
630
+ [18]: https://github.com/depcheck/depcheck
631
+ [19]: https://github.com/smeijer/unimported
632
+ [20]: https://github.com/pzavolinsky/ts-unused-exports
633
+ [21]: https://github.com/nadeesha/ts-prune
634
+ [22]: #production-mode
635
+ [23]: https://github.com/webpro/knip/graphs/contributors
636
+ [24]: https://contrib.rocks/image?repo=webpro/knip
637
+ [plugin-ava]: ./src/plugins/ava
638
+ [plugin-babel]: ./src/plugins/babel
639
+ [plugin-capacitor]: ./src/plugins/capacitor
640
+ [plugin-changesets]: ./src/plugins/changesets
641
+ [plugin-commitizen]: ./src/plugins/commitizen
642
+ [plugin-commitlint]: ./src/plugins/commitlint
643
+ [plugin-cspell]: ./src/plugins/cspell
644
+ [plugin-cypress]: ./src/plugins/cypress
645
+ [plugin-eslint]: ./src/plugins/eslint
646
+ [plugin-gatsby]: ./src/plugins/gatsby
647
+ [plugin-github-actions]: ./src/plugins/github-actions
648
+ [plugin-husky]: ./src/plugins/husky
649
+ [plugin-jest]: ./src/plugins/jest
650
+ [plugin-lefthook]: ./src/plugins/lefthook
651
+ [plugin-lint-staged]: ./src/plugins/lint-staged
652
+ [plugin-markdownlint]: ./src/plugins/markdownlint
653
+ [plugin-mocha]: ./src/plugins/mocha
654
+ [plugin-next]: ./src/plugins/next
655
+ [plugin-npm-package-json-lint]: ./src/plugins/npm-package-json-lint
656
+ [plugin-nx]: ./src/plugins/nx
657
+ [plugin-nyc]: ./src/plugins/nyc
658
+ [plugin-playwright]: ./src/plugins/playwright
659
+ [plugin-postcss]: ./src/plugins/postcss
660
+ [plugin-prettier]: ./src/plugins/prettier
661
+ [plugin-release-it]: ./src/plugins/release-it
662
+ [plugin-remark]: ./src/plugins/remark
663
+ [plugin-remix]: ./src/plugins/remix
664
+ [plugin-rollup]: ./src/plugins/rollup
665
+ [plugin-semantic-release]: ./src/plugins/semantic-release
666
+ [plugin-sentry]: ./src/plugins/sentry
667
+ [plugin-storybook]: ./src/plugins/storybook
668
+ [plugin-stryker]: ./src/plugins/stryker
669
+ [plugin-tailwind]: ./src/plugins/tailwind
670
+ [plugin-typedoc]: ./src/plugins/typedoc
671
+ [plugin-typescript]: ./src/plugins/typescript
672
+ [plugin-vitest]: ./src/plugins/vitest
673
+ [plugin-webpack]: ./src/plugins/webpack