https://github.com/tableflip/code-style
tableflip code style guidelines. Intended to be a working document. Changes MUST be discussed before pushed.
https://github.com/tableflip/code-style
Last synced: 5 months ago
JSON representation
tableflip code style guidelines. Intended to be a working document. Changes MUST be discussed before pushed.
- Host: GitHub
- URL: https://github.com/tableflip/code-style
- Owner: tableflip
- Created: 2013-12-28T18:40:49.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-01-21T12:11:01.000Z (over 12 years ago)
- Last Synced: 2025-04-09T20:46:19.895Z (about 1 year ago)
- Homepage:
- Size: 129 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
JavaScript
===
* Indent with two spaces
* No trailing whitespace
* Block open curlys (`{`) start on the same line
* `else` and `else if` continue on same line as block closing curly e.g. `} else if (foo) {`
* _Always_ use curlys with conditionals and loops
* Single space before opening parens and after closing parens e.g. `function () {`, `if (x) {`
* No semicolons, except when necessary
* Comma last
* Double quotes for strings, where it makes sense
* Short variable names for short lived variables, longer descriptive names for variables with long lives
* Use standard parameter names: `er` Error, `cb` Function callback, `opts` options Object, `e` Event
* Callback functions should _always_ receive error object as first parameter
* Write small functions
* Return early from functions to avoid deep nesting of if-statements
* Use lowerCamelCase for variables, properties and function names
* Use UpperCamelCase for class names
* Use UPPERCASE for Constants
HTML
===
* Doctype always ``
* Indent with two spaces
* Self closing tags have no trailing slash. i.e. `/>` is wrong
* Boolean attributes have no value e.g. ``
CSS
===
* Indent with two spaces
* Block open curlys (`{`) start on the same line
* Use hyphen seperated class names and ids e.g. "#main-nav", ".last-item"