forked from csegames/CSE-UI
-
Notifications
You must be signed in to change notification settings - Fork 25
Style Guide
JB codecorsair edited this page Jul 29, 2016
·
4 revisions
We mostly follow the AirBnb JavaScript style guide. I'll be fully writing up everything eventually for our own. For now, I'll write down some deviations for our source from AirBnb.
-
Braces
Do not put a space between curly braces when using object destructuring, or inline declarations of objects.
// good import {client} from 'camelot-unchained'; // bad import { client } from 'camelot-unchained';
-
Declaration
Use an expression for member functions.
// good class foo { public sayHello = () => { console.log('Hello'); } } // bad class foo { public sayHello() { console.log('Hello'); } }
Use a named function declaration outside of class scope.
// good function sayHello() { console.log('Hello'); } // bad const sayHello = () => console.log('Hello');