Describe the Bug
The collectMissingDeps() function repeatedly calls loadInternalAliases(cwd) inside the nested import-processing loop for every imported module in every scanned file.
This causes unnecessary repeated reads and parsing of tsconfig.json / jsconfig.json, which can significantly slow down dependency scanning in larger projects with many files and imports.
Additionally, malformed or dynamically-generated import statements may still be incorrectly matched by the current regex-based parser, leading to potential false positives during dependency validation.
Steps to Reproduce
- Add multiple .js, .ts, or .tsx files inside the src/ directory.
- Include many imports across those files.
- Run the dependency validation script.
- Observe repeated filesystem access and slower execution times due to repeated config parsing
Expected Behavior
- Internal aliases from tsconfig.json / jsconfig.json should be loaded only once during execution.
- The dependency scan should avoid unnecessary filesystem operations.
- Import extraction should remain efficient and reliable for large codebases.
Additional Context
Suggested improvement:
- Move const INTERNAL_ALIASES = loadInternalAliases(cwd); outside the nested loop.
- Cache aliases once before processing files.
- This reduces repeated JSON parsing and improves scalability for larger repositories.
@Priyanshu-byte-coder I would like to contribute a fix for this issue. Kindly this issue to me under GSSoc'26.
Describe the Bug
The collectMissingDeps() function repeatedly calls loadInternalAliases(cwd) inside the nested import-processing loop for every imported module in every scanned file.
This causes unnecessary repeated reads and parsing of tsconfig.json / jsconfig.json, which can significantly slow down dependency scanning in larger projects with many files and imports.
Additionally, malformed or dynamically-generated import statements may still be incorrectly matched by the current regex-based parser, leading to potential false positives during dependency validation.
Steps to Reproduce
Expected Behavior
Additional Context
Suggested improvement:
@Priyanshu-byte-coder I would like to contribute a fix for this issue. Kindly this issue to me under GSSoc'26.