// bad
const arr = new Array();
// good
const arr = [];
const arr = [];
//bad
arr[0] = 'test';
// good
arr.push('test');
// bad
const obj = new Object();
// good
const obj = {};
// bad (foo만 호이스트됨)
const foo = function() {}
// good (함수 전체 호이스트)
function bar() {}
function foo(a, b = {}) {}
// bad
function foo(name) {
return 'hello my name is ' + name;
}
// good
function bar(name) {
return hello my name is ${name};
}
// 패키지명
my.exampleCode.deepSpace
// 함수명
function myFunction() {...}
// 변수명
let helloString = "Hello World";
// 객체 선언
const thisIsMyObject = {};
// 객체 export
const AirbnbStyleGuide = {
es6: {
},
};
export default AirbnbStyleGuide;
// bad
import SmsContainer from './containers/SmsContainer';
// bad
const HttpRequests = [
// ...
];
// good
import SMSContainer from './containers/SMSContainer';
// good
const HTTPRequests = [
// ...
];
// also good
const httpRequests = [
// ...
];
// best
import TextMessageContainer from './containers/TextMessageContainer';
// best
const requests = [
// ...
];
// bad
const PRIVATE_VARIABLE = 'should not be unnecessarily uppercased within a file';
// bad
export const THING_TO_BE_CHANGED = 'should obviously not be uppercased';
// bad
export let REASSIGNABLE_VARIABLE = 'do not use let with uppercase variables';
// ---
// allowed but does not supply semantic value
export const apiKey = 'SOMEKEY';
// better in most cases
export const API_KEY = 'SOMEKEY';
// ---
// bad - unnecessarily uppercases key while adding no semantic value
export const MAPPING = {
KEY: 'value'
};
// good
export const MAPPING = {
key: 'value'
};
//bad
let delivery_notes = ["one", "two"];
// good
let delivery_note_list = ["one", "two"];
//bad
let del_note = 1;
// good
let delivery_note = 1;