CLJ Commons: Building a formatter like gofmt for Clojure

I’d be all for a tool like that, although I’d prefer one with more options than a no options version. For me, the gold standard for code formatters is clang because almost every possible thing it formats can be customized. The main reason I code ClojureScript in VSCode is because it’ll format it without needing a REPL connection, which is a pain to get set up. Whatever VSCode is doing, I’d be ok if that could be done in other editors. I think it uses cljfmt, but I’m not sure how it gets by without the REPL. I’ve tried with vim and emacs and they both want a REPL to do formatting. I have a couple issues with how it formats things, but I’d rather have that than nothing.

Having source control format the code is how we did things back in the 2000’s before git took over. The more popular source control tools had server side formatting, so things got formatted when checked in. If somebody didn’t like the format, they would have a client side formatter on their machine to convert it to what they wanted. There’s no good way to do that with git, though.

1 Like