fix(deslop): track and expose skipped dependencies with reasons - #1588
Draft
skoshx wants to merge 2 commits into
Draft
fix(deslop): track and expose skipped dependencies with reasons#1588skoshx wants to merge 2 commits into
skoshx wants to merge 2 commits into
Conversation
- 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>
commit: |
Contributor
Interactive terminal E2ERecorded from the built CLI at |
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
Fixes #1587 by making silent dependency abstentions visible.
Root Cause
The
deslop/unused-dependencycheck deliberately skips analyzing certain dependencies:@types/,expo-,react-native-,@react-navigation/, etc. (40+ prefixes)package.jsonhas abinfieldThese abstentions were completely silent. A scan reporting "No issues found!" could mean either:
This made it impossible to distinguish between "analyzed and clean" vs. "not analyzed at all."
Solution
SkippedDependencyinterface withname,isDevDependency, andreasonfieldsdetectStalePackagesto return bothunusedDependenciesandskippedDependencies"matches allowlisted prefix 'expo-' and is assumed to be used (packages with this prefix typically have side effects...)""provides a binary and is assumed to be used (binaries are often invoked from scripts, CI, git hooks...)"ScanResult→ dead code worker → coreScope Decision
This PR makes the abstention data available but not yet user-visible. The skipped dependencies are:
ScanResult.skippedDependenciesThis is the correct minimal fix: the core tracking is now in place. Future PRs can add:
--strictor--auditflag to report allowlisted-but-unreferenced dependenciesTesting
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