Write consistency JavaScript without losing your brain
Install ESLint either locally or globally.
$ npm install eslint --save-devIf you installed ESLint globally, you have to install eslint-config plugin globally too. Otherwise, install it locally.
$ npm install @chtijs/eslint-config --save-devIn your .eslintrc:
{
"extends": "@chtijs"
}Extends the default eslint config, parses with Babel, and adds the import plugin. Includes these hot rules:
- Two spaces for indentation.
- Single quotes.
- More rigit JSDoc enforcement.
- Allow functions to be defined after they're first referenced. (Yay hoisting!)
if/elsego on separate lines.- Consistent return values optional.
- Prefer
const, thenlet, but nevervar. - Capitalize the first word in a comment.
- Put spaces around inline objects.
- Always use
===and!==. - Class methods must use
this(otherwise they can be static).
git clone https://github.com/chtijs/eslint-config
cd eslint-configMIT © Hacked from Geoff Kimball