]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/syntax_checkers/javascript/jslint.vim
Update the stuff
[rbdr/dotfiles] / vim / syntax_checkers / javascript / jslint.vim
CommitLineData
0d23b6e5
BB
1"============================================================================
2"File: jslint.vim
3"Description: Javascript syntax checker - using jslint
4"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
5"License: This program is free software. It comes without any warranty,
6" to the extent permitted by applicable law. You can redistribute
7" it and/or modify it under the terms of the Do What The Fuck You
8" Want To Public License, Version 2, as published by Sam Hocevar.
9" See http://sam.zoy.org/wtfpl/COPYING for more details.
10"
11"Tested with jslint 0.1.4.
12"============================================================================
13if !exists("g:syntastic_javascript_jslint_conf")
14 let g:syntastic_javascript_jslint_conf = "--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars"
15endif
16
17function! SyntaxCheckers_javascript_HighlightTerm(error)
18 let unexpected = matchstr(a:error['text'], 'Expected.*and instead saw \'\zs.*\ze\'')
19 if len(unexpected) < 1 | return '' | end
20 return '\V'.split(unexpected, "'")[1]
21endfunction
22
23function! SyntaxCheckers_javascript_GetLocList()
24 let makeprg = "jslint " . g:syntastic_javascript_jslint_conf . " " . shellescape(expand('%'))
25 let errorformat='%E %##%n %m,%-Z%.%#Line %l\, Pos %c,%-G%.%#'
26 let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
27 call SyntasticHighlightErrors(errors, function('SyntaxCheckers_javascript_HighlightTerm'))
28
29 return errors
30endfunction
31