Skip to content

Instantly share code, notes, and snippets.

@eborden
Created March 20, 2017 17:12
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 eborden/0fd936e7167a638ec295feddf4c90009 to your computer and use it in GitHub Desktop.
Save eborden/0fd936e7167a638ec295feddf4c90009 to your computer and use it in GitHub Desktop.
Enable Neomake eslint per buffer per project
" Enable eslint for given project buffer
" Store current cwd
let s:prev_cwd = getcwd()
" change path to project root for current buffer
let s:project_cwd = split(expand('%:p:h'), "js")[0]
lcd `=s:project_cwd`
" Assign proper eslint vars for this buffer
let s:eslint_path = system('PATH=$(npm bin):$PATH && which eslint')
let b:neomake_javascript_eslint_exe = substitute(s:eslint_path, '^\n*\s*\(.\{-}\)\n*\s*$', '\1', '')
let b:neomake_javascript_enabled_makers = ['eslint']
" change back to previous cwd
lcd `=s:prev_cwd`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment