Fix pretty printing

Had to roll own pretty printer for consistent results.
Put some code in anonymous functions to avoid capture by `eval`.
Add .eslint config