Knip is a tool to find unused files, dependencies and exports. It has 7.7K stars on GitHub.
Here's the doc, https://knip.dev/overview/getting-started