- Encoding: use
UTF-8 - Indentation: use 2 spaces
- Naming:
myFunction,myVariable,myConstant,MyClass. - Use
undefined. Do not usenullexcept for representing a SQLnull. - Do not use class inheritance.
- Only use ES5 getters or setters when you are absolutely sure that no exceptions can be thrown.
- Prefer
++iand--ioveri++andi--. - Avoid using
bind(). - Loop and conditional bodies: Curly braces can be omitted only with a one line and one instruction block. Statements on the same line are not allowed.
- Prefer
new Error()overError(). - In generics, type have single-letter names, such as
T,K, etc. - Do not use semicolons at the end of statements
- Use double quotes for strings.
- Prefer
constoverlet. - Never use
==or!=.
- Do not use:
enum,abstract,protected. - Do not use the
publickeyword, except as a shorthand in the constructor. - Do not use "I" as a prefix for interface names.
- We use Pleasant BEM;
- Sort CSS properties alphabetically;
- Prefer double quotes over single quotes.
- In a markup, write the attribute
classfirst, and non-attributeshat last position.
Here are rules that apply to other teams:
- Camel case from Google: Read this section of the Java guide.
- JSON from Google: https://google.github.io/styleguide/jsoncstyleguide.xml
- HTML and CSS from Google: https://google.github.io/styleguide/htmlcssguide.html