-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add initial JavaScript style guide * Add ES6 to best practices via babel
- Loading branch information
1 parent
f71de09
commit d175383
Showing
4 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
JavaScript | ||
========== | ||
|
||
[Sample](sample.js) | ||
|
||
* Prefer ES6 classes over prototypes. | ||
* Use strict equality checks (`===` and `!==`) except when comparing against | ||
(`null` or `undefined`). | ||
* Prefer [arrow functions] `=>`, over the `function` keyword except when | ||
defining classes or methods. | ||
* Use semicolons at the end of each statement. | ||
* Prefer double quotes. | ||
* Use `PascalCase` for classes, `lowerCamelCase` for variables and functions, | ||
`SCREAMING_SNAKE_CASE` for constants, `_singleLeadingUnderscore` for private | ||
variables and functions. | ||
* Prefer [template strings] over string concatenation. | ||
* Prefer promises over callbacks. | ||
* Prefer array functions like `map` and `forEach` over `for` loops. | ||
* Use `const` for declaring variables that will never be re-assigned, and `let` | ||
otherwise. | ||
* Avoid `var` to declare variables. | ||
|
||
[template strings]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings | ||
[arrow functions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
object = { spacing: true } | ||
|
||
class Cat { | ||
canBark() { | ||
return false; | ||
} | ||
} |