vim with syntastic and eslint: show warnings

I'm using Vim with the syntastic plugin and eslint.

When I save a JavaScript file, I can see errors come up just fine, but I can't get the warnings to show.

Here's what I have in my .vimrc:

let g:syntastic_javascript_checkers = ['eslint']

I installed eslint with:

npm install eslint -g

I'm running Linux Mint 17

How do I get warnings to appear?



It turns out the issue here was that the "warnings" I thought I had in my file were not actually warnings. When I put an actual warning in my file it showed up correctly.

Some advice I learned though was to first run the file on the command-line directly using eslint similar to this:

eslint /path/to/file.js

Then compare those results to what you see in Vim.

Another tip is that you can change rules on the fly with comment syntax like this:

/*eslint <rule>=1*/

I really don't know if it will help you, but I will put it here. I had a similar problem but in my case it was related to the version of syntastic, so a simple git pull solved it. My vim configuration is somewhat canonical, so I will share that:

let g:syntastic_mode_map = { 'mode': 'active',
                            \ 'active_filetypes': ['python', 'javascript'],
                            \ 'passive_filetypes': [] }

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

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
let g:syntastic_javascript_checkers = ['eslint']

When you open your file that contains some mistakes, it should show that into the error window.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.