Skip to content

Instantly share code, notes, and snippets.

@rondale-sc
Created March 13, 2017 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rondale-sc/83c68611b29a516300a912347367a0d6 to your computer and use it in GitHub Desktop.
Save rondale-sc/83c68611b29a516300a912347367a0d6 to your computer and use it in GitHub Desktop.

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