ud-annotatrix icon indicating copy to clipboard operation
ud-annotatrix copied to clipboard

Add javascript autoformatting

Open keggsmurph21 opened this issue 4 years ago • 5 comments

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 avatar May 31 '20 22:05 keggsmurph21

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

keggsmurph21 avatar May 31 '20 22:05 keggsmurph21

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

JPJPJPOPOP avatar Jun 01 '20 03:06 JPJPJPOPOP

k, first formatting commit is 05f5c42

keggsmurph21 avatar Jun 01 '20 04:06 keggsmurph21

@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.

JPJPJPOPOP avatar Jun 08 '20 05:06 JPJPJPOPOP

Sure, what operating system and editor are you using?

keggsmurph21 avatar Jun 08 '20 22:06 keggsmurph21