Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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