Skip to content

feat: Unused exports detection in /qa (stack-specific tooling) #93

Closed

Description

@admarble

Summary

Add optional unused export detection to /qa phase using stack-specific tooling. Catches dead code that accumulates over time.

Problem

Codebases accumulate unused exports:

  • Functions that were refactored but not removed
  • Types exported "just in case"
  • Components that are no longer used
  • API endpoints with no callers

These increase bundle size, confuse developers, and create maintenance burden.

Proposed Solution

Stack-Specific Tools

Stack Tool Command
TypeScript/JS knip npx knip --reporter compact
TypeScript ts-unused-exports npx ts-unused-exports tsconfig.json
Python vulture vulture src/
Go unused (staticcheck) staticcheck -checks U1000 ./...
Rust cargo-udeps cargo +nightly udeps

Opt-in Configuration

Since this requires tool installation and can be noisy, make it opt-in:

// .sequant/settings.json
{
  "qa": {
    "unusedExports": {
      "enabled": true,
      "tool": "knip",  // or auto-detect
      "ignorePatterns": ["**/*.d.ts", "**/index.ts"]
    }
  }
}

Integration Points

  1. Init time: sequant init asks if user wants unused export detection
  2. First run: If enabled but tool not installed, prompt to install
  3. QA phase: Run tool and report findings

Output Format

## Unused Exports Check

Found 3 unused exports:

| File | Export | Type |
|------|--------|------|
| src/utils/format.ts | `formatCurrency` | function |
| src/types/legacy.ts | `OldUserType` | type |
| src/components/Button.tsx | `ButtonVariant` | type |

**Suggestions:**
- Remove if truly unused
- Add to ignore list if intentionally exported (e.g., public API)
- Check if used in tests only (may indicate missing integration)

Acceptance Criteria

  • Settings schema supports unused export configuration
  • Detection works for TypeScript/JavaScript (primary stack)
  • Tool installation prompted if missing
  • Ignore patterns supported
  • Clear output showing unused exports
  • Documentation for enabling per-stack

Future Enhancements

  • Auto-fix option (remove unused exports)
  • Integration with tree-shaking analysis
  • Historical tracking (new unused exports vs existing)

Notes

This is explicitly opt-in because:

  1. Requires external tool installation
  2. Can be noisy in early development
  3. Some exports are intentionally public API
  4. Different projects have different tolerance

Activity

  1. added
    enhancement
    on Jan 14, 2026
  2. admarble commented on Jan 14, 2026

    @admarble
    ContributorAuthor

    Deferring - adds complexity (external tool dependencies, stack-specific config) for marginal value. Can revisit if dead code becomes a significant problem.

  3. added
    wontfix
    on Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementwontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions