by JacksonGariety · 12y ago · 0 comments
It ought to work at the editor level, and would be really easy to make this work with Emacs with a little lisp magic and the Emacs js interpreter.
From my vimrc:
> au FileType javascript setlocal equalprg=/usr/local/share/npm/bin/js-beautify\ -f\ -\ -q\ -t\ -j\ -w\ 140\ --good-stuff\ -b\ \"end-expand\"
edit: The same event (BufWritePre) is what I've got set for go fmt too. That IS a plugin, but it makes no significant difference as compared to js-beautify.
https://github.com/mooz/js2-mode/blob/master/js2-mode.el
11k amazing loc
One of my favorite things installed on my computer.