Skip to content

fix(deslop): track and expose skipped dependencies with reasons - #1588

Draft
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1587-2e08
Draft

fix(deslop): track and expose skipped dependencies with reasons#1588
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1587-2e08

Conversation

@skoshx

@skoshx skoshx commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1587 by making silent dependency abstentions visible.

Root Cause

The deslop/unused-dependency check deliberately skips analyzing certain dependencies:

  1. Name-based allowlist - Dependencies matching prefixes like @types/, expo-, react-native-, @react-navigation/, etc. (40+ prefixes)
  2. Bin-providing packages - Any package whose package.json has a bin field

These abstentions were completely silent. A scan reporting "No issues found!" could mean either:

  • All dependencies are genuinely used, OR
  • Most dependencies were skipped from analysis

This made it impossible to distinguish between "analyzed and clean" vs. "not analyzed at all."

Solution

  • Added SkippedDependency interface with name, isDevDependency, and reason fields
  • Modified detectStalePackages to return both unusedDependencies and skippedDependencies
  • Tracked skipped dependencies with descriptive reasons:
    • Prefix/suffix matches: "matches allowlisted prefix 'expo-' and is assumed to be used (packages with this prefix typically have side effects...)"
    • Bin providers: "provides a binary and is assumed to be used (binaries are often invoked from scripts, CI, git hooks...)"
  • Threaded through the pipeline: ScanResult → dead code worker → core
  • Added comprehensive unit tests covering allowlisted prefixes, descriptive reasons, and ensuring genuine unused deps are still flagged

Scope Decision

This PR makes the abstention data available but not yet user-visible. The skipped dependencies are:

  • ✅ Tracked in ScanResult.skippedDependencies
  • ✅ Available for programmatic access via deslop's analyze API
  • ✅ Parsed through the dead code worker
  • ❌ Not yet exposed in JSON output (requires renderer changes)
  • ❌ Not yet shown in verbose/summary output (future enhancement)

This is the correct minimal fix: the core tracking is now in place. Future PRs can add:

  • A --strict or --audit flag to report allowlisted-but-unreferenced dependencies
  • Verbose output showing skipped counts
  • JSON report fields for skipped dependencies

Testing

  • ✅ All existing tests pass
  • ✅ New unit tests verify skipped dependencies are tracked correctly
  • ✅ Tests verify descriptive reasons are provided
  • ✅ Tests ensure genuinely unused deps are still flagged
  • ✅ Tested with reproduction case from issue

Verification

The reporter's reproduction case had 5 dead dependencies:

  • lodash - ✅ correctly flagged (not allowlisted)
  • expo-status-bar - now tracked as skipped (reason: expo- prefix)
  • @react-navigation/devtools - now tracked as skipped (reason: @react-navigation/ prefix)
  • @types/url-parse - now tracked as skipped (reason: @types/ prefix)
  • mkdirp - now tracked as skipped (reason: provides binary)

Closes #1587

Open in Web Open in Cursor 

cursoragent and others added 2 commits August 5, 2026 14:24
- Add SkippedDependency interface with name, isDevDependency, and reason
- Modify detectStalePackages to return both unusedDependencies and skippedDependencies
- Track dependencies skipped due to allowlisted prefixes/suffixes with descriptive reasons
- Track bin-providing packages as skipped with explanation
- Add skippedDependencies to ScanResult and thread through generateReport
- Update dead code worker to parse and forward skippedDependencies
- Make skipped dependency data available for programmatic access

This addresses issue #1587 by making silent abstentions visible. The data
is now tracked and available in the deslop ScanResult, laying the foundation
for displaying this information to users via verbose mode or JSON output.

Ref #1587

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
- Add skipped-deps-test fixture with allowlisted dependencies
- Test tracking of dependencies with allowlisted prefixes
- Verify descriptive reasons are provided for each skipped dependency
- Ensure genuinely unused dependencies are still correctly flagged

All tests passing.

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1588
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1588
npm i https://pkg.pr.new/react-doctor@1588

commit: bba8f2f

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

React Doctor interactive terminal recording

Recorded from the built CLI at bba8f2f in a real terminal. The fixture holds Git busy for three seconds, so Scanning... must appear immediately after project selection, then exercises the compact interactive report.

Download the GIF and MP4 artifact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants