find dead JavaScript code?
Solution 1:
Without looking for anything too complex:
- JSLint (not really a static analyzer, but if you give it your concatenated development code, you'll see what methods are never called, at least in obvious scoping contexts)
- Google Closure Compiler
- Google Closure Linter
Solution 2:
There's grep. Use it to find function calls. Suppose you have a method called dostuff()
. Use grep -r "dostuff()" * --color
on your project's root directory. Unless you find anything other than the definition, you can safely erase it.
ack is also a notable alternative to grep.