Skip to content

chore: add Knip - #3346

Open
boneskull wants to merge 1 commit into
masterfrom
boneskull/knip
Open

chore: add Knip#3346
boneskull wants to merge 1 commit into
masterfrom
boneskull/knip

Conversation

@boneskull

@boneskull boneskull commented Aug 14, 2026

Copy link
Copy Markdown
Member

This adds Knip, which is essentially a linter for packages. It reports many different types of problems and is library-and-tool-aware. Enumerating its capabilities is beyond the scope of this description, however.

I've configured Knip to run as a non-failing step in our lint job. This will show all of the issues it detects. The major ones I'm seeing are unused exports and unused dependencies & dev dependencies.

Tip

Knip-surfaced issues can typically be suppressed inline via use of a @knipignore (configurable) tag in a docstring.

This should help us garden our honkin' monorepo.

@boneskull

boneskull commented Aug 14, 2026

Copy link
Copy Markdown
Member Author

📚 Pull Request Stack


Managed by gh-stack

@changeset-bot

changeset-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4d89251

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@boneskull

boneskull commented Aug 15, 2026

Copy link
Copy Markdown
Member Author

Example output from Knip follows. It shows unused files, unused dependencies/devdeps, unused exported types, unknown bins/scripts, and duplicate exports (aliases):

Unused files (6)
packages/bundle-source/bin/bundle-source.cjs  
packages/bundle-source/src/is-entrypoint.js   
packages/daemon/src/networks/tcp-netstring.js 
packages/daemon/src/serve-private-port-http.js
packages/module-source/src/parse-babel.js     
packages/ses/lockdown.js                      
Unused dependencies (3)
@endo/pass-style                packages/cli/package.json:43:6               
@endo/harden                    packages/compartment-mapper/package.json:65:6
@eslint-community/eslint-utils  packages/eslint-plugin/package.json:26:6     
Unused devDependencies (143)
@changesets/cli                   package.json:13:6                                  
@endo/ses-ava                     package.json:18:6                                  
@lavamoat/allow-scripts           package.json:20:6                                  
@lavamoat/preinstall-always-fail  package.json:21:6                                  
@typescript-eslint/eslint-plugin  package.json:23:6                                  
@typescript-eslint/parser         package.json:24:6                                  
eslint-config-jessie              package.json:27:6                                  
eslint-config-prettier            package.json:28:6                                  
eslint-plugin-import              package.json:30:6                                  
eslint-plugin-jsdoc               package.json:31:6                                  
eslint-plugin-unicorn             package.json:32:6                                  
type-coverage                     package.json:42:6                                  
typescript-eslint                 package.json:46:6                                  
babel-eslint                      packages/base64/package.json:44:6                  
prettier                          packages/base64/package.json:47:6                  
@endo/lockdown                    packages/benchmark/package.json:37:6               
@rollup/plugin-commonjs           packages/benchmark/package.json:39:6               
@types/rollup                     packages/benchmark/package.json:41:6               
c8                                packages/benchmark/package.json:42:6               
eshost-cli                        packages/benchmark/package.json:43:6               
tsd                               packages/benchmark/package.json:46:6               
c8                                packages/bundle-source/package.json:38:6           
@endo/eventual-send               packages/bytes/package.json:47:6                   
@endo/init                        packages/bytes/package.json:48:6                   
ava                               packages/bytes/package.json:51:6                   
babel-eslint                      packages/bytes/package.json:52:6                   
prettier                          packages/bytes/package.json:55:6                   
ses                               packages/bytes/package.json:56:6                   
tsd                               packages/cache-map/package.json:46:6               
ava                               packages/captp/package.json:52:6                   
c8                                packages/captp/package.json:53:6                   
ses                               packages/captp/package.json:55:6                   
@endo/eventual-send               packages/chacha12-fast-check-test/package.json:44:6
@endo/init                        packages/chacha12-fast-check-test/package.json:45:6
arrayPrototype                                              packages/ses/src/commons.js:149:36                        
mapPrototype                                                packages/ses/src/commons.js:152:27                        
proxyRevocable                                              packages/ses/src/commons.js:153:27                        
setPrototype                                                packages/ses/src/commons.js:155:27                        
stringPrototype                                             packages/ses/src/commons.js:156:27                        
weakmapPrototype                                            packages/ses/src/commons.js:157:27                        
weaksetPrototype                                            packages/ses/src/commons.js:158:27                        
promisePrototype                                            packages/ses/src/commons.js:160:27                        
generatorPrototype                                          packages/ses/src/commons.js:161:27                        
setDelete                                                   packages/ses/src/commons.js:243:14                        
stringMatch                                                 packages/ses/src/commons.js:318:14                        
stringSearch                                                packages/ses/src/commons.js:322:14                        
promiseAll                                                  packages/ses/src/commons.js:351:14                        
promiseCatch                                                packages/ses/src/commons.js:352:14                        
finalizationRegistryUnregister                              packages/ses/src/commons.js:360:14                        
provideCompartmentEvaluator                                 packages/ses/src/compartment-evaluate.js:15:14            
CompartmentPrototype                                        packages/ses/src/compartment.js:142:14                    
unredactedDetails                                           packages/ses/src/error/assert.js:212:10                   
sanitizeError                                               packages/ses/src/error/assert.js:310:14                   
pumpLogToConsole                                            packages/ses/src/error/console.js:328:14                  
enJoin                                                      packages/ses/src/error/stringify-utils.js:32:14           
instantiate                                                 packages/ses/src/module-link.js:104:14                    
uniqueGlobalPropertyNames                                   packages/ses/src/permits.js:213:14                        
AsyncFunctionInstance                                       packages/ses/src/permits.js:315:14                        
isValidIdentifierName                                       packages/ses/src/scope-constants.js:103:14                
writeZipRecords                                   function  packages/zip/src/format-writer.js:148:17                  
ZIP64_CENTRAL_DIRECTORY_LOCATOR        signature            packages/zip/src/signature.js:19:14                       
ZIP64_CENTRAL_DIRECTORY_END            signature            packages/zip/src/signature.js:20:14                       
DATA_DESCRIPTOR                        signature            packages/zip/src/signature.js:21:14                       
Unused exported types (20)
ComputeSha512                       type       packages/bundle-source/src/types.ts:8:13                      
BundleMetaModuleSource              interface  packages/bundle-source/src/types.ts:36:18                     
BundleMetaContent                   interface  packages/bundle-source/src/types.ts:41:18                     
BundlePowers                        interface  packages/bundle-source/src/types.ts:215:18                    
BundleSourceSimple                  type       packages/bundle-source/src/types.ts:221:13                    
BundleSourceWithFormat              type       packages/bundle-source/src/types.ts:225:13                    
BundleSourceWithOptions             type       packages/bundle-source/src/types.ts:231:13                    
BundleSourceGeneral                 type       packages/bundle-source/src/types.ts:239:13                    
ScopedPackageName                   type       packages/compartment-mapper/src/types/canonical-name.ts:88:13 
UnscopedPackageName                 type       packages/compartment-mapper/src/types/canonical-name.ts:107:13
NpmPackageName                      type       packages/compartment-mapper/src/types/canonical-name.ts:117:13
SplitOnDelimiter                    type       packages/compartment-mapper/src/types/canonical-name.ts:125:13
AllValidPackageNames                type       packages/compartment-mapper/src/types/canonical-name.ts:134:13
ExportConditions                    type       packages/compartment-mapper/src/types/node-modules.ts:27:13   
CommonDependencyDescriptorsOptions  type       packages/compartment-mapper/src/types/node-modules.ts:68:13   
PackageDependenciesHookOption       type       packages/compartment-mapper/src/types/node-modules.ts:78:13   
LanguageDefinition                  interface  packages/parser-pipeline/src/types/internal.ts:128:18         
TerminateFn                         type       packages/parser-pipeline/src/types/worker.ts:57:13            
BaseWorkerMessage                   interface  packages/parser-pipeline/src/types/worker.ts:65:18            
BaseWorkerPoolTask                  interface  packages/parser-pipeline/src/types/worker.ts:163:18           
Duplicate exports (7)
bare|b                               packages/errors/index.js           
details|X|redacted                   packages/errors/index.js           
quote|q                              packages/errors/index.js           
note|annotateError                   packages/errors/index.js           
Fail|throwRedacted                   packages/errors/index.js           
importBundle|typedImportBundle       packages/import-bundle/src/index.js
makeNetstringWriter|netstringWriter  packages/netstring/writer.js      

Notes:

  • packages/ses/lockdown.js is unused because it's not a package entry point and is never referenced by other files within the package.
  • babel-eslint is a devDependency which isn't used anywhere
  • Some of these are false positives and require more configuration to address. For example, we want to keep @changesets/cli, but it's not referenced anywhere in package.json.

@boneskull
boneskull force-pushed the boneskull/knip branch 2 times, most recently from 2a0615d to b218fd3 Compare August 15, 2026 01:23
This adds [Knip](https://knip.dev), which is essentially a linter for packages. It reports many different types of problems and is library-and-tool-aware. Enumerating its capabilities is beyond the scope of this description, however.

I've configured Knip to run as a _non-failing_ step in our `lint` job. This will show all of the issues it detects. The major ones I'm seeing are unused exports and unused dependencies & dev dependencies.

This should help us garden our honkin' monorepo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant