Skip to content

Instantly share code, notes, and snippets.

@ilyaigpetrov
Last active January 26, 2020 14:56
Show Gist options
  • Save ilyaigpetrov/deb8be86e64eb93fb35ad5fbb0d0df05 to your computer and use it in GitHub Desktop.
Save ilyaigpetrov/deb8be86e64eb93fb35ad5fbb0d0df05 to your computer and use it in GitHub Desktop.
How to Configure Hapi Style Guide | by https://git.io/ilyaigpetrov

Short link: https://git.io/hapi-style

How to Configure Hapi Style Guide

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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment