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?
Was this article missing something?
Was it not quite what you were looking for?
Do you have suggestions on how we could improve this article or your experience in general?
If so, please take a moment to let us know!
Your invaluable feedback will help everyone better understand the platform!