Webstorm find dead/orphaned files
Hi
In a large react javascript project, if there a way to find all the files that have never been imported to any places? I tried the "find unused declaration" under code inspection but it deosn't actually return anything since we don't have unused imports, but we do have a lot of scenarios of A import B import C imports D. but "A" is never been imported or used anywhere.
Not sure if this is possible
Please sign in to leave a comment.
If A is exported (like
export default class A {}), but not imported anywhere, the IDE normally reports "Unused default export" error for it
I tried but for some reason it's not working
eg. here I clearly have a unused export:
however after running code analyze, I get
and I don't see the screen you posted.
Also in my case, would 'counts-wrapper.tsx' shows in the list? what I want the the actual file that is unused, not just the export so I can safetly delete it.
>I don't see the screen you posted
did you try running Inspect Code... for the project?
>Also in my case, would 'counts-wrapper.tsx' shows in the list?
please see my screenshot - the file hhh.js that has this unused export is shown in the tree
with Inspect Code I get the screen but not "unused declaration"
the 'hhh.js' you showed, is that the actual unused file or it's just the index file that exports an unused file?
please share a sample project that shows up your issue