Skip to content

Instantly share code, notes, and snippets.

@dalpo
Forked from potomak/style_guide.markdown
Last active August 29, 2015 14:21
Show Gist options
  • Save dalpo/c01eafdc5471a5027886 to your computer and use it in GitHub Desktop.
Save dalpo/c01eafdc5471a5027886 to your computer and use it in GitHub Desktop.

Javascript

  • Indent using 2 spaces
  • Use single quotes, unless you are writing JSON
  • Declare one variable per var statement
  • Variables and properties should use lower camel case capitalization
  • Class names should be capitalized using upper camel case
  • Constants should be declared as regular variables or static class properties, using all uppercase letters
  • Use the triple equality operator

References

Git

Commit messages

  • Write the summary line and description of what you have done in the imperative mode, that is as if you were commanding someone. * Write “fix”, “add”, “change” instead of “fixed”, “added”, “changed”.
  • Always leave the second line blank.
  • Line break the commit message (to make the commit message readable without having to scroll horizontally in gitk).
  • The first line should always be 50 characters or less.
  • Answer the following questions:
    1. Why is this change necessary?
    2. How does it address the issue?
    3. What side effects does this change have?
  • Consider including a link to the issue/story/card in the commit message a standard for your project. Full URLs are more useful than issue numbers, as they are more permanent and avoid confusion over which issue tracker it references. This is generally done as the first paragraph after the summary, on line 3.

General

  • Avoid unrelated changes in a single commit.
  • Always be cleaning up your history before pushing.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment