You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
713 B
Markdown
44 lines
713 B
Markdown
|
5 years ago
|
# Javascript
|
||
|
|
|
||
|
|
## Code Style
|
||
|
|
|
||
|
|
* [Info](https://javascript.info/coding-style)
|
||
|
|
* [Google Style](https://google.github.io/styleguide/jsguide.html)
|
||
|
|
* [StandardJS](https://standardjs.com/)
|
||
|
|
* General guide
|
||
|
|
* Indentation : +2 spaces
|
||
|
|
* A line space between code block
|
||
|
|
* Column limit : 80
|
||
|
|
* Use single quote `'` for strings
|
||
|
|
* Use `===` for equality check
|
||
|
|
* A space between `:` and value in key-value pair
|
||
|
|
|
||
|
|
### [ESLint](https://eslint.org/)
|
||
|
|
|
||
|
|
* Install package
|
||
|
|
|
||
|
|
```sh
|
||
|
|
$ npm install -g eslint
|
||
|
|
|
||
|
|
```
|
||
|
|
|
||
|
|
* Create `.eslintrc` config file
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"extends": "eslint:recommended",
|
||
|
|
"env": {
|
||
|
|
"browser": true,
|
||
|
|
"node": true,
|
||
|
|
"es6": true
|
||
|
|
},
|
||
|
|
"rules": {
|
||
|
|
"no-console": 0,
|
||
|
|
"indent": 2
|
||
|
|
}
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
*
|