Where static analysis can't work, the JS community is exploring libraries declaring that they're pure: https://github.com/webpack/webpack/blob/master/examples/side-effects/README.md
miniblog.
Related Posts
Infer, a static analysis tool, has a DSL for declaring forbidden patterns: https://code.facebook.com/posts/277643589367408/ (it models ASTs with *temporal* logic!)
