esbtools / esb-message-admin

GNU General Public License v3.0
5 stars 9 forks source link

Add a style guide (especially for JavaScript) #129

Open alechenninger opened 9 years ago

alechenninger commented 9 years ago

Looking for general formatting rules like tabs vs spaces / 2 vs 4 space tabs / column length, stuff like that, for java and javascript (they don't have to be the same guidelines for each, but just so we have them in any case).

Currently, there is a mix of tabs and spaces and various odd formatting on the JavaScript side in particular.

Personally I would propose, for the JavaScript: 2 space tabs, only spaces, try to keep less than 80 columns but not a hard requirement, and be sane about function argument arrangement / nesting.

Basically I mainly just care about cleaning up some of the JS and having a few basic standards set in place.

derek63 commented 9 years ago

Let's add this as a section to the gitbooks documentation we'll create with https://github.com/esbtools/esb-message-admin/issues/131. I too have wanted to fixe the all-over-the-place formatting that currently exists in the code base, and have been trying to do that a little bit as I go along, but haven't specifically sat down and fixed all of it. +1 to 2 spaces vs 4 and for long column lengths (as I hate having to split relatively short statements across lines).

alechenninger commented 9 years ago

Cool, sounds good. A quick fix might be to start using this: https://github.com/beautify-web/js-beautify

I use it with the Atom editor (via atom-beautify) and it does a good job for the most part

derek63 commented 9 years ago

Will check out that atom-beautify thing. I have started using that app a lot for my text editing, however I have made the full switch away from Eclipse to Intellij for all the Java stuff. Perhaps a good/similar plugin exists there too.