- Use the latest stable JavaScript syntax with a transpiler, such as babel.
- Use ESLint and Prettier for auto-formatting and auto-fixing
- Use Jest for unit testing
- Prefer ES6 classes over prototypes.
- Use strict equality checks (
===
and!==
) except when comparing against (null
orundefined
). - Prefer arrow functions
=>
, over thefunction
keyword except when defining classes or methods. - Use semicolons at the end of each statement.
- Prefer single quotes.
- Prefer ES6 destructuring over object literal notation.
- Use ES6 spread and rest operator wherever possible for a cleaner code.
- Use
PascalCase
for classes,lowerCamelCase
for variables and functions,SCREAMING_SNAKE_CASE
for constants,_singleLeadingUnderscore
for private variables and functions. - Prefer template strings over string concatenation.
- Prefer promises over callbacks.
- Prefer array functions like
map
andforEach
overfor
loops. - Use
const
for declaring variables that will never be re-assigned, andlet
otherwise. - Avoid
var
to declare variables. - Use a trailing comma after each item in a multi-line array or object literal, including the last item.
- Include a
to_param
orhref
attribute when serializing ActiveRecord models, and use that when constructing URLs client side, rather than the ID. - Prefer
data-*
attributes overid
andclass
attributes when targeting HTML elements. #462 - Avoid targeting HTML elements using classes intended for styling purposes. #462
javascript
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||