jonorthwash / ud-annotatrix

GNU General Public License v3.0
59 stars 49 forks source link

Add javascript autoformatting #410

Open keggsmurph21 opened 4 years ago

keggsmurph21 commented 4 years ago

At the moment, the formatting of the javascript files is pretty ugly and inconsistent (which is my fault). On notatrix, one of our dependencies, I started using clang-format to automatically reformat on save (here's the commit where I introduced it).

Does anyone have objections? I would have just gone ahead and done this, but I wanted to make sure @JPJPJPOPOP is aware of this potential, since it seems like they're doing active work in this repo.

If there is interest, I'll add a basic config file, and write up a short summary of how to integrate it into your editor of choice (post what you've been developing with below and I'll do a bit of digging).

Plus we can use this issue as a forum for style nitpicks :^)

keggsmurph21 commented 4 years ago

If there is interest, I'll add a basic config file, and write up a short summary of how to integrate it into your editor of choice (post what you've been developing with below and I'll do a bit of digging).

I personally like developing in vim, and I've been using vim-clang-format. To set it up, you'll need to make sure you have clang-format installed on your system (e.g., with sudo apt install clang-format), then see their installation instructions.

I also have this line in my .vimrc, which automatically reformats on save

autocmd FileType javascript ClangFormatAutoEnable
JPJPJPOPOP commented 4 years ago

@keggsmurph21 go ahead. I disabled my own linter (was using eslint) when doing my work.

keggsmurph21 commented 4 years ago

k, first formatting commit is 05f5c42

JPJPJPOPOP commented 4 years ago

@keggsmurph21 My PR got merged. Could you help me with formatting the files that I changed? I was unfortunately not able to get clang-format working on my computer.

keggsmurph21 commented 4 years ago

Sure, what operating system and editor are you using?