-
Notifications
You must be signed in to change notification settings - Fork 0
JavaScript
Christian Hall edited this page Aug 7, 2018
·
9 revisions
Much of this was inspired by idiomatic-js. Please add to this guide if you find any particular patterns or styles that we've adopted internally.
- We lint all our JavaScript with StandardJS.
- JavaScript hooks should follow the
js-myJsHookpattern. - Testing hooks should follow the
qa-myTestHookpattern. - Do NOT apply styles to
js-orqa-prefixed classes.
- Label
Views withclassNameexclusively, notid. - Order view properties/methods as follows:
- View properties (alphabetically)
- Child view properties (alphabetically)
- Marionette methods (by lifecycle of the view)
- Custom methods (alphabetically)
- Use
static propTypesandstatic defaultPropsat the top of React classes. (This does not work in the teacher app currently)
class MyComponent extends React.Component {
static propTypes = {
...
};
static defaultProps = {
...
};
render() {
...
}
}