airbnb /
javascript
JavaScript Style Guide
Recently updatedPopularActive repository
JavaScriptMIT#arrow-functions#es2015#es2016#es2017
⑂ 26.6K forks◯ 160 issuesUpdated today
Loading repository data…
indec-it / repository
JavaScript Style Guide
A mostly reasonable approach to JavaScript
Note: this guide is base on airbnb guide Airbnb JavaScript Style Guide, it reinforces the most important rules and overwrites some of them.
// bad
function validating() {
//...
};
// good
function validate() {
// ...
};
// bad
if (test) return false;
// good
if (test) {
return false;
}
// bad
function foo() {
∙let name;
}
// bad
function bar() {
∙∙let name;
}
// good
function baz() {
∙∙∙∙let name;
}
async/await instead of then (promises)// bad
const fetchUser = url => getAuthHeader().then(
authorization => fetch(url, { headers: {authorization} })
).then(
response => response.json
).then(
data => new User(data.user)
)catch(
err => console.log(err);
);
// good
const fetchUser = async url => {
try {
const response = await fetch(url, {
credentials: 'same-origin',
headers: {
authorization: await getAuthHeader()
}
});
const data = await response.json();
return new User(data.user);
} catch (err) {
console.log(err);
throw err;
}
}
Selected from shared topics, language and repository description—not editorial ratings.
airbnb /
JavaScript Style Guide
leonidlebedev /
Перевод «JavaScript Style Guide» от Airbnb
parksb /
Airbnb JavaScript 스타일 가이드
dangkyokhoang /
Bản dịch tiếng Việt cho Định hướng Lối viết JavaScript của Airbnb
sugarcrm /
JavaScript Style Guide
igor-h /
JavaScript Style Guide