chore: add knip dead-code analysis and clean up unused deps#868
Draft
ugcodrr wants to merge 4 commits into
Draft
chore: add knip dead-code analysis and clean up unused deps#868ugcodrr wants to merge 4 commits into
ugcodrr wants to merge 4 commits into
Conversation
- Install knip@6 as root devDependency - Add knip.json with per-workspace entry points covering NestJS controllers/modules, dynamically-loaded Discord commands/events/ arguments, Next.js app-router pages, and standalone scripts - Suppress known structural false positives: @swc/helpers (SWC compile- time runtime), reflect-metadata (side-effect-only dep in discord-bot), @vitest/coverage-v8 (vitest loads implicitly), skin-renderer NAPI platform binaries, and tooling deps not imported in source - Add "knip" script to root package.json
- apps/api: @nestjs/testing (no test files exist) - apps/scripts: @types/inquirer (inquirer v10 ships bundled types) - apps/support-bot: @types/luxon (luxon not imported directly) - packages/discord: @types/i18next-fs-backend (i18next-fs-backend v2 ships bundled types) - root: @types/eslint__js (@eslint/js ships its own type declarations)
- apps/api: toad-scheduler (no imports; scheduler was removed without cleaning up the dep) - apps/discord-bot: @typegoose/typegoose, mongoose (used only transitively via @statsify/schemas; not imported directly) - apps/scripts: skia-canvas (rank-emojis.js renders via @statsify/rendering; never imports skia-canvas directly) - apps/support-bot: axios, luxon (neither imported directly; both arrive transitively through workspace deps) - packages/assets: @statsify/logger, axios (neither imported in packages/assets/src) - packages/rendering: @statsify/assets (not imported in packages/rendering/src) - packages/schemas: @statsify/logger (not imported in packages/schemas/src)
- Add mongoose@^8.18.0 and luxon@^3.7.1 to apps/scripts dependencies; both were imported directly in delete-sessions.js and timestamp.js but only accessible via hoisting from discord-bot - Add ignoreBinaries for blur (local mjs script) and wasm-pack (Rust toolchain), neither of which are npm packages - Make packages/rendering jsxs a thin wrapper over jsx instead of a direct alias so knip does not flag the duplicate export; the JSX transform requires both names but this runtime treats them identically pnpm knip now exits 0 with no findings.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apps/scriptspnpm knipnow exits 0 — clean baseline for ongoing checksWhat was found and removed
Unused devDependencies (5):
apps/api:@nestjs/testing— no test files existapps/scripts:@types/inquirer— inquirer v10 ships bundled typesapps/support-bot:@types/luxon— luxon not imported directly in support-botpackages/discord:@types/i18next-fs-backend— i18next-fs-backend v2 ships bundled types@types/eslint__js—@eslint/js9.34.0 ships its own type declarationsUnused runtime dependencies (10):
apps/api:toad-scheduler— imported nowhere; likely a leftover from a removed schedulerapps/discord-bot:@typegoose/typegoose,mongoose— only used transitively via@statsify/schemas; not imported directlyapps/scripts:skia-canvas—rank-emojis.jsuses canvas via@statsify/rendering, never directlyapps/support-bot:axios,luxon— neither imported directly in support-bot sourcepackages/assets:@statsify/logger,axios— neither imported in packages/assets/srcpackages/rendering:@statsify/assets— not imported in packages/rendering/srcpackages/schemas:@statsify/logger— not imported in packages/schemas/srcUnlisted (fixed) —
apps/scriptsimportedmongooseandluxondirectly without declaring them, surviving only via hoisting fromdiscord-bot. Added as explicit deps.JSX runtime —
jsxswas a direct alias ofjsx(same value, flagged as duplicate export). Changed to a thin wrapper; identical runtime behavior, no duplicate.knip.json design notes
packages/*) usesrc/**/*.tsas entries so knip follows the full source graph, not just the barrel index. This is necessary becauseexport * from "./file.js"chains under NodeNext aren't traversed when only the index is declared.@swc/helpers(SWC compile-time runtime),reflect-metadata(side-effect dep in discord-bot),@vitest/coverage-v8(vitest loads implicitly via--coverage), skin-renderer NAPI platform binaries, andblur/wasm-packlocal toolchain binaries.CI snippet (non-blocking, add when ready)
Drop
--no-exit-codeto make it a hard gate once the report stays clean.Test plan
pnpm knipexits 0 with no findingstsc --noEmitpasses for all modified packages: api, discord-bot, support-bot, @statsify/discord, @statsify/assets, @statsify/rendering, @statsify/schemas