Are you tired of manually tracking down unused exports in your project? So was I. With power of ChatGPT I, a total bash newbie, created a bash script for modern javascript projects that can help you.
How to use. First, clone the gist. Then, make the script executable by running the command "chmod +x unusedExports.sh" in terminal. Next, navigate to the target directory and run the script using the command "./unusedExports.sh". The script will search your project for unused exports and create a report in a file named unusedExports.txt. Script can be inaccurate with default exported modules, since they can be imported with different name!
To exclude certain files or directories from the search, specify them in the EXCLUDE variable. While there is certainly room for improvement - for example, by making the code less repetitive and allowing for situational EXCLUDE arguments - this script is already a valuable tool for spring cleaning.
Top comments (0)