Stellarion
Tools

stellarion_find_unused_code [Pro]

Detect dead code with confidence scoring and framework-aware heuristics
This is a Pro tool. Requires a Stellarion Pro license. A 180-day free trial starts automatically.

Finds functions, classes, and exports that have no callers or consumers in the codebase. Uses confidence scoring to reduce false positives and framework-aware heuristics to avoid flagging convention-based code (e.g., React lifecycle methods, serialization hooks, test fixtures).

When to Use

  • During cleanup sprints to remove dead code safely
  • Before a major refactor to identify code that can be deleted outright
  • To reduce bundle size by finding unused exports
  • To understand how much of a module is actually exercised

Parameters

ParameterTypeRequiredDefaultDescription
uristringNoworkspaceFile or directory to scope the search
scopeenumNofileScope of analysis: file, module, or workspace
includeTestsbooleanNofalseInclude test files in the analysis
confidencenumberNo0.7Minimum confidence threshold (0.0 to 1.0)
summarybooleanNofalseReturn counts and top items instead of full list

Examples

Find unused code in a file

Is there any dead code in src/utils/helpers.ts?

Scans the file and reports functions or exports with no references elsewhere in the project.

Workspace-wide dead code scan

Find all unused functions across the entire project. Only show high-confidence results.

Uses scope: "workspace" and confidence: 0.9 for a thorough sweep with minimal false positives.

Include test utilities

Find unused code in src/testing/ — include test files in the analysis.

Sets includeTests: true to check whether test helpers and fixtures are actually used by test files.

Module-level summary

Give me a summary of unused code in the services/ module.

Uses scope: "module" and summary: true for a quick count of dead code by type.

Output Format

Each finding includes:

  • Symbol name — the function, class, or export that appears unused
  • File path and line number — where it is defined
  • Kindfunction, class, method, constant, or export
  • Confidence — score from 0.0 to 1.0 indicating how likely it is truly unused
  • Reason — why it was flagged (e.g., "no callers found", "exported but never imported")

Confidence scoring:

ScoreMeaning
0.9–1.0Almost certainly unused — no references anywhere
0.7–0.9Likely unused — may have dynamic references
0.5–0.7Possibly unused — framework conventions may apply
< 0.5Uncertain — probably referenced dynamically

Tips

  • Start with confidence: 0.8 or higher to focus on safe deletions
  • Lower to 0.5 when you want a broader view and are willing to manually verify
  • The workspace scope checks cross-file references — more accurate but slower than file
  • Framework-aware heuristics recognize patterns like componentDidMount, serialize, __init__, main, and #[test] — these are not flagged as unused
  • Combine with stellarion_api_surface to find unused exports specifically
  • Re-run after deleting code — removing one function may make others unused too