Short link: https://git.io/hapi-style
npm install --save-dev eslint
npm install --save-dev eslint-plugin-hapi
npm install --save-dev eslint-config-hapi
vim .eslintrc.json
{
"extends": "eslint-config-hapi",
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
}
}
vim package.json
"scripts": {
"lint": "eslint ."
...
},
Optional: eslint-plugin-security
Optional:
vim ~/.vimrc
" Add this to your vimrc.
:set tabstop=4 shiftwidth=4 expandtab
" Highlight unwanted whitespace.
:highlight ExtraWhitespace ctermbg=red guibg=red
:autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+\%#\@<!$\|^\t\+/
:autocmd InsertLeave * redraw!