Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Clean up codebase for style consistency #95

Open
dglol opened this Issue · 2 comments

2 participants

@dglol

The codebase is growing and it would definitely help to fix and enforce style consistency before it becomes a bigger problem. Opening a wiki for this type of stuff would be great too.

Main concerns:
1. Choose " over ' for javascript strings to make sure JSON is valid as well (http://json.org/)
2. Single line if statements should have curly braces
3. Use obj[name] for property access and obj.functionName for function calls
4. Choose const over var when initializing modules using require
5. Anonymous functions (i.e functions without names) should have a space between function and the bracket
(e.g. function ()).
6. Functions for objects should be declared as follows: functionName: function objectName_functionName() { ... };

Feel free to make suggestions and comments. I'll try to keep this issue updated but we should really have a wiki for this.

Personal Suggestions:

Style-guide priority:
1. Memchaser established rules
2. https://developer.mozilla.org/En/Mozilla_Coding_Style_Guide
3. http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml

@whimboo
Owner

Would be good to have on the FAQ page of the MemChaser project. I have only one note:

Whether it's a single or not, we should wrap everything in brackets. That applies to if conditions or loops.

@dglol

I have made changes to the first two concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.