How to find dead code in a large react project?

后端 未结 8 593
执笔经年
执笔经年 2020-12-25 12:47

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 re

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-25 13:15

    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:

    The second way to remove the unused code inside the project is unrequited 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

提交回复
热议问题