Search code examples
dependenciesamdjshint

Detect unused AMD dependencies


Is there any tool that can analyze my files for unused AMD modules so that I can clean up my code if I remove a previously used dependency?

I know to a certain degree jshint can do this with the unused option, but setting it to true ignores unused deps followed by a used one. As well as it does not actually analyze the deps array, just the function arguments.

Also setting it to strict isn't really practical for other parts of my code as I need that.


Solution

  • I've made good use of grunt-amdcheck. While it defaults to automatically removing unused dependencies, that doesn't work for me. So I run it with removeUnusedDependencies: false, which just lists the unused deps to standard out.