Support .tsx files
I have a large React code base written in TypeScript (with files named like src/common/components/MyComponent.tsx).
delete-react-zombies does not detect any component:
$ ./node_modules/.bin/delete-react-zombies
⠋ Searching zombie components
0 components found!
0 unused components found!
Bye bye!
I've tried to add .tsx extension here: https://github.com/CVarisco/delete-react-zombies/blob/15cdc2f9f35a48875c698acfd972ef95a99a7bd9/src/index.ts#L38 and here: https://github.com/CVarisco/delete-react-zombies/blob/15cdc2f9f35a48875c698acfd972ef95a99a7bd9/src/utils.ts#L16 without luck
Hi @tkrotoff !
I'll publish a new version with tsx extension included
Thank you for the feedback!
Hi @tkrotoff! Published the new version of the package. If you have a problem, I'm here to help you with.
Hey @tkrotoff, do you have any news?
Tested with [email protected], "0 components found!" :-/
You only detect default exports: https://github.com/CVarisco/delete-react-zombies/blob/22aaaab93b77cb1de874ecf710efb13f265904da/src/utils.ts#L6
That's why.
We don't use them, here some reasons: https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
Hi @tkrotoff !
sorry for the delay in the response. Anyway, I'm not using that line of code to detect if a component is exported. I'm using https://github.com/reactjs/react-docgen that should find also the not default exported components (I tried with the examples and in my test code).
Are you sure that are you executing the tool in the right directory? If you want I'm available to see with you what's the problem.
Im also having a similar issue. A .js component is being imported by a tsx component, but DRZ recognises it as being unused