Skip to content

fix: enable full knip checks and clean up unused exports and dead code#1102

Merged
fi3ework merged 3 commits intomainfrom
chore/knip-unused-exports-cleanup
Mar 25, 2026
Merged

fix: enable full knip checks and clean up unused exports and dead code#1102
fi3ework merged 3 commits intomainfrom
chore/knip-unused-exports-cleanup

Conversation

@fi3ework
Copy link
Copy Markdown
Member

Summary

Background

The existing check-unused CI step only detected unused dependencies via knip --dependencies. Unused exports, dead functions, and orphan types were invisible, allowing dead code to accumulate (77 items across the monorepo).

Implementation

  1. Upgraded knip from dependency-only (knip --dependencies) to full analysis (knip) by renaming the script from check-unused-deps to check-unused and updating .github/workflows/lint.yml.
  2. Tightened knip.json entry points from broad globs (src/**/*.ts) to precise entries so knip can accurately trace reachability.
  3. Removed 49 redundant export keywords where symbols were only used within the same file.
  4. Deleted 24 truly dead code items (functions, types, constants, re-exports) across @rstest/core, @rstest/browser, @rstest/browser-ui, @rstest/browser-react, @rstest/coverage-istanbul, and @rstest/vscode.
  5. Removed unused clsx dependency from @rstest/browser-ui.
  6. Added VS Code test fixture paths to knip.json to suppress 2 false positives for fixture files read at runtime.

User Impact

None — internal cleanup only.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@fi3ework fi3ework changed the title chore: enable full knip checks and clean up unused exports and dead code fix: enable full knip checks and clean up unused exports and dead code Mar 25, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

Rsdoctor Bundle Diff Analysis

⚠️ Note: The latest commit (ac794ecdac) does not have baseline artifacts. Using commit df8ab2e4b1 for baseline comparison instead. If this seems incorrect, please wait a few minutes and try rerunning the workflow.

Found 12 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
adapter-rsbuild 2.1 KB 0
adapter-rslib 23.1 KB 0
adapter-rspack 5.9 KB 0
browser 2.0 MB 0
browser-react 3.7 KB 0
browser-ui 804.3 KB 0
coverage-istanbul 9.1 KB 0
core/browser 971.6 KB 0
core/loaders 869.0 B 0
core/main 1.5 MB -31.0 B (-0.0%)
vscode/extension 60.2 MB 0
vscode/worker 14.4 KB 0
📋 Detailed Reports (Click to expand)

📁 core/main

Path: packages/core/.rsdoctor/main/rsdoctor-data.json

📌 Baseline Commit: df8ab2e4b1 | PR: #1101

Metric Current Baseline Change
📊 Total Size 1.5 MB 1.5 MB -31.0 B (-0.0%)
📄 JavaScript 1.5 MB 1.5 MB -31.0 B (-0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 75.4 KB 75.4 KB 0

📦 Download Diff Report: core/main Bundle Diff

Generated by Rsdoctor GitHub Action

fi3ework and others added 3 commits March 25, 2026 20:11
- Upgrade knip from dependency-only to full unused code analysis
- Tighten knip.json entry points from broad globs to precise entries
- Remove 49 redundant export keywords (symbols only used within same file)
- Delete 24 truly dead code items (functions, types, constants, re-exports)
- Remove unused clsx dependency from browser-ui
- Add vscode test fixture paths to knip.json to suppress false positives

Amp-Thread-ID: https://ampcode.com/threads/T-019d2420-1729-7178-b659-bfe861cc9c37
Co-authored-by: Amp <amp@ampcode.com>
@fi3ework fi3ework force-pushed the chore/knip-unused-exports-cleanup branch from 3fe8f58 to 26ba9a9 Compare March 25, 2026 12:11
@fi3ework fi3ework requested a review from 9aoy March 25, 2026 12:25
@fi3ework fi3ework merged commit a2bc7b2 into main Mar 25, 2026
17 checks passed
@fi3ework fi3ework deleted the chore/knip-unused-exports-cleanup branch March 25, 2026 13:02
@9aoy 9aoy mentioned this pull request Mar 26, 2026
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.

2 participants