Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Syntastic setup:

Install:

vim-syntastic/syntastic

Add the following to ~/.eslintrc

{
  "root": true,
  "parserOptions": {
    "ecmaVersion": 6,
      "sourceType": "module"
  },
  "extends": "eslint:recommended",
  "env": {
    "browser": true
  },
  "rules": {
  }
}

Run the following command to install eslint:

npm -g install eslint eslint_d

Add the following to ~/.vimrc.local

filetype plugin indent on
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exec = 'eslint_d'

Restart Vim our source ~/.vimrc

info

the g:syntastic_always_populate_loc_list=1 is ensuring that the error list will always be sent to the locations panel. But, this is important, does not open it automatically. Instead you must open said list with :lopen. Much less jarring to open this way.

Eslint will look in your current project for an .eslintrc file. Failing that it will search your $HOME, which is why we create an .eslintrc in $HOME.

@zeyangxu
Copy link

zeyangxu commented May 8, 2019

Thank you, this is helpful

@wdog
Copy link

wdog commented Jun 10, 2020

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment