In addition to using a standard module structure, modules generally follow the coding style of Douglas Crockford.
To enforce code style rules, we use ESLint.
npm install -g eslint
Each Workarea gem includes a
.eslintrc file to configure ESLint. The following rules are also observed:
- Unless unavoidable, do not use the keyword
this. Functions passed to jQuery's
eachmethods include parameters that provide access to relevent DOM elements and data, so
thisis almost never required in Workarea modules. Avoid jQuery iteration methods that do not pass the current element as an argument to the iterator, such as the function form of
- When chaining methods across multiple lines, indent/outdent only when the return value changes.
$('.product-form') .find('fieldset') .first() .attr('id', 'first') .end() .end() .attr('id', 'cart-form') .serializeArray();
How'd We Do?
If you found this article was missing information or wasn't quite what you were looking for, we are open to any suggestions or feedback on what we could do better.Help Us Out