Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a --types flag feature to detect unused TypeScript types (exported and local). The implementation adds comprehensive type analysis capabilities while standardizing Node.js built-in module imports across the codebase by prefixing them with node:.
Key changes:
- Added type analysis infrastructure with three new core modules for scanning, resolving, and analyzing TypeScript type usage
- Implemented CLI support for the
--typesflag with corresponding output formatting - Standardized all Node.js built-in imports (fs, path, os, child_process) to use the
node:prefix convention
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/type/scanTypeExports.ts | New module to scan and collect type exports from TypeScript files |
| src/core/type/resolveTypeExportGraph.ts | New module to resolve type export chains including barrel re-exports |
| src/core/type/buildTypeUsageGraph.ts | New module to build comprehensive type usage analysis across project files |
| src/core/type/analyzeTypeUsage.ts | New module for per-file type declaration and reference analysis |
| src/cli/typesFormat.ts | New formatting utilities for displaying unused type results |
| src/cli/index.ts | CLI integration for --types flag with conditional type analysis execution |
| tests/cli/cli.types.test.ts | Comprehensive test coverage for --types flag functionality |
| tests/cli/fixtures/types/* | Test fixtures demonstrating type usage scenarios |
| tests/cli/utils/runCLI.ts | Added debug logging and standardized import |
| src/core/usage/buildUsageGraph.ts | Import standardization to node:path |
| src/core/imports/buildImportGraph.ts | Import standardization to node:path |
| src/core/fileSystem/* | Import standardization to node:fs and node:path |
| src/core/exports/resolveExportGraph.ts | Import standardization to node:path |
| src/core/entrypoints/detectEntryPoints.ts | Import standardization to node:fs and node:path |
| src/core/tsconfig/tsconfigLoader.ts | Import standardization to node:path |
| src/cli/internalMode.ts | Import standardization to node:fs |
| tests/**/*.test.ts | Import standardization across all test files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Adds a
--typesCLI flag for detecting unused TypeScript types.Reports unused exported types and unused local types using syntax-based analysis.
Type analysis is isolated behind the
--typesflag and does not affect default behavior.Includes initial CLI integration tests covering: