Summary
When a directory or file name contains a trailing space, and the import path also includes that trailing space, foresthouse fails to resolve the module path. As a result, the component is completely missing from the react usage tree.
Reproduction
Given a directory structure where the folder name has a trailing space:
src/features/Hero / ← note trailing space
├── index.ts
└── Hero.tsx
And an import like:
import Hero from 'Features/Hero ' // trailing space matches the directory name
Running foresthouse react on a file that renders <Hero /> will not include it in the output.
Expected: <Hero /> appears in the tree
Actual: <Hero /> is completely absent
Notes
While having a trailing space in a directory name is unusual, it does happen in real-world projects. The import resolves correctly at build time (Next.js/TypeScript), so foresthouse should handle it as well.
Summary
When a directory or file name contains a trailing space, and the import path also includes that trailing space, foresthouse fails to resolve the module path. As a result, the component is completely missing from the react usage tree.
Reproduction
Given a directory structure where the folder name has a trailing space:
And an import like:
Running
foresthouse reacton a file that renders<Hero />will not include it in the output.Expected:
<Hero />appears in the treeActual:
<Hero />is completely absentNotes
While having a trailing space in a directory name is unusual, it does happen in real-world projects. The import resolves correctly at build time (Next.js/TypeScript), so foresthouse should handle it as well.