Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  79] [ 3]  / answers: 1 / hits: 77550  / 5 Years ago, fri, january 11, 2019, 12:00:00

In order to refactor a client-side project, i'm looking for a safe way to find (and delete) unused code.



What tools do you use to find unused/dead code in large react projects? Our product has been in development for some years, and it is getting very hard to manually detect code that is no longer in use. We do however try to delete as much unused code as possible.



Suggestions for general strategies/techniques (other than specific tools) are also appreciated.



Thank you


More From » reactjs

 Answers
9

First of all, very good question, in large project coders usually try many lines of code test and at the end of result, hard to find the unused code.


There is two possible that must be work for you - i usually do whenever i need to remove and reduce the unused code into my project.


1st way WebStorm IDE:


If you're using the web-storm IDE for JS development or React JS / React Native or Vue js etc it's tell us and indicate us alote of mention with different color or red warning as unused code inside the editor


but it's not works in your particular scenario there is another way to remove the unused code .


2nd Way unrequired Library: (JSX is not supported)


The second way to remove the unused code inside the project is unrequired library you can visit here : unrequired github


another library called depcheck under NPM & github here


Just follow their appropriate method - how to use them you will fix this unused issue easily


Hopefully that helps you


[#52783] Tuesday, January 8, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
johnniejarend

Total Points: 84
Total Questions: 91
Total Answers: 91

Location: British Indian Ocean Territory
Member since Tue, Feb 22, 2022
2 Years ago
;