How to install Airbnb EsLint easily And Vim configure.

Guide to install EsLint, EsFormatter and scrooloose/syntastic.

EsLint with Airbnb installation.

  1. Download script files above.
  2. run script install_eslint (script is run NPM install -g with sudo).
  3. run script gen_eslintrc.sh PATH (path must be your root project you wanna use EsLint.) run it always you create new project to use EsLint.
  4. Now you can use command line. eslint *.js, And esformatter *.js to test it.
  5. done.

VIM

  1. scrooloose/syntastic https://github.com/scrooloose/syntastic
  2. vim-esformatter (if u run script install_eslint, esformatter installed) https://github.com/millermedeiros/vim-esformatter

Installation with Vundle

Recommend configure for Syntastic

Recommend configure for EsFormatter

Modify configure EsFormatter for match to Airbnb

I found some wrong space when formatting.

Such as Destructuring.

const {firstName, lastName} = user;

Should be has spaces.

const { firstName, lastName } = user;

I fixed it with change some default config file.

sudo vi /usr/local/lib/node_modules/esformatter/lib/preset/default.json