couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wohali <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Added js style guide
Date Sat, 18 Oct 2014 21:18:55 GMT
Github user wohali commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/91#discussion_r19056394
  
    --- Diff: styleguide.md ---
    @@ -0,0 +1,192 @@
    +# JavaScript Style Guide
    +
    +This document attempts to codify the JavaScript code style rules for Fauxton. This has
been patched together from
    +a few sources, including [Pootle's style guide](http://pootle.readthedocs.org/en/latest/developers/styleguide.html#javascript),
    +[Google JS style guide](https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml),
and from
    +reverse-engineering our own codebase.
    +
    +This is intended to be a living document: any disagreements about style should be brought
to the community via IRC,
    +discussed, agreed upon and documented here.
    +
    +Note: We have JSHint running as a grunt task which will catch the more egregious errors
(missing `vars`, missing
    +semicolons etc). See the `Gruntfile.js` for the settings being used.
    +
    +
    +## Programming Style
    +
    +#### Strings
    +Use `'` single quote character for strings, because HTML markup uses `"`. Eg. `var greeting
= 'Hello World!'`;
    +
    +#### Numbers
    +When using `parseInt` always explicitly include the second radix argument (usually 10).
    +
    +#### Indentation
    +- 2-space indentation. Don't use tabs. JSHint will whine if you have mixed tabs and spaces.
    --- End diff --
    
    Thx for the context. @kxepal the mailing list agreed to 4 spaces for all Erlang &
Python (and I do need to get back to that) but I agree with everyone above that we should
stick to 2-space in JS.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message