Skip to content

chore(ui): add knip for dead code detection#10654

Open
pfe-nazaries wants to merge 2 commits intomasterfrom
chore/knip-base-setup
Open

chore(ui): add knip for dead code detection#10654
pfe-nazaries wants to merge 2 commits intomasterfrom
chore/knip-base-setup

Conversation

@pfe-nazaries
Copy link
Copy Markdown
Contributor

@pfe-nazaries pfe-nazaries commented Apr 10, 2026

Summary

  • Install knip and create initial configuration tailored to the Next.js 16 / React 19 project structure
  • Add lint:knip and lint:knip:fix scripts to package.json
  • Configure entry points for Next.js app conventions, Auth.js, Sentry instrumentation, and build scripts
  • Ignore @heroui/* sub-package imports (resolved transitively via @heroui/react)

Baseline report

Running pnpm lint:knip surfaces ~504 issues across the UI codebase:

Category Count
Unused files 37
Unused dependencies 13
Unused devDependencies 9
Unlisted dependencies 1
Unresolved imports 2
Unused exports 399
Unused exported types 37
Unused exported enum members 5
Duplicate exports 1

These findings will be addressed in follow-up PRs (dependency cleanup, dead export removal, config refinement).

Roadmap

This is the first step in a series of incremental PRs to reduce dead code in the UI:

  1. Base knip setup ← this PR
  2. Remove unused npm dependencies — drop packages flagged as unused by knip
  3. Remove unused exports — clean up barrel re-exports and dead utility functions
  4. Refine config for Next.js 16 — tighten entry points for route groups, metadata exports, instrumentation
  5. Enforce issue ceiling — lock the clean state with --max-issues in healthcheck
  6. CI integration & docs — add dedicated knip step to CI and contributor guidance in AGENTS.md

Dependencies

Note: This PR requires #10653

Test plan

  • pnpm typecheck passes
  • pnpm lint:check passes
  • pnpm build passes
  • pnpm lint:knip runs and produces the baseline report (exits non-zero as expected)
  • No changes to existing code — config and tooling only

Install knip and create initial configuration tailored to the Next.js 16
project structure. Adds `lint:knip` and `lint:knip:fix` scripts to surface
unused files, dependencies, and exports.

Baseline: ~504 issues (37 unused files, 22 unused deps, 399 unused
exports, 37 unused types, 5 unused enum members, 2 unresolved imports,
1 duplicate export). These will be addressed in follow-up PRs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pfe-nazaries pfe-nazaries requested a review from a team as a code owner April 10, 2026 12:07
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

✅ All necessary CHANGELOG.md files have been updated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

🔒 Container Security Scan

Image: prowler-ui:965515e
Last scan: 2026-04-10 12:38:50 UTC

✅ No Vulnerabilities Detected

The container image passed all security checks. No known CVEs were found.

📋 Resources:

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant