I have a scenario where I have a local .eslintrc
and the local eslint
package installed. However, I notice that it does not populate a loclist
on a file called app.js
when I open the file and when I run :SyntasticCheck
.
I have included the Syntastic config below. The complete .vimrc is hosted on github for more info.
I can confirm that ./node_modules/.bin/eslint app.js
works as expected.
The output from :SyntasticInfo
:
Syntastic version: 3.8.0-26 (Vim 704, Linux, GUI)
Info for filetype: javascript.jsx
Global mode: active
Filetype javascript.jsx is active
The current file will be checked automatically
Available checkers: -
Currently enabled checkers: -
This is my Syntastic
config:
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0 "skip checking on save and exit
"use locally installed version of eslint with syntastic, extracted from mtscout6/syntastic-local-eslint.vim
let s:lcd = fnameescape(getcwd())
silent! exec "lcd" expand('%:p:h')
let s:eslint_path = system('PATH=$(npm bin):$PATH && which eslint')
exec "lcd" s:lcd
let b:syntastic_javascript_eslint_exec = substitute(s:eslint_path, '^\n*\s*\(.\{-}\)\n*\s*$', '\1', '')
let g:syntastic_javascript_flowtype_exe = 'flow'
let g:syntastic_javascript_checkers = ['eslint', 'flow']
"aggregate errors from all checkers for a file type
let g:syntastic_aggregate_errors = 1
"automatically open and close error list when an error is detected
let g:syntastic_always_populate_loc_list = 1
"add rubocop to syntastic as a ruby checker
let g:syntastic_ruby_checkers = ['mri','rubocop']
"check if a file exists
function! HasConfig(file, dir)
return findfile(a:file,escape(a:dir,' ') . ';') !=# ''
endfunction
" Merge commands into augroup vimrc
augroup vimrc
"checks for .eslintrc and .jshintrc before falling back to standard
autocmd BufNewFile,BufReadPre *.js let b:syntastic_checkers =
\ HasConfig('.eslintrc', expand('<amatch>:h')) ? ['eslint'] :
\ HasConfig('.jshintrc', expand('<amatch>:h')) ? ['jshint'] :
\ ['standard']
augroup end
" Typescript syntax checking using tsuqoyami
let g:tsuqoyami_disable_quickfix = 1
let g:syntastic_typescript_checkers = ['tslint', 'tsuquyomi']