Skip to content

Instantly share code, notes, and snippets.

@kennyp
Created July 7, 2011 14:38
Show Gist options
  • Save kennyp/1069647 to your computer and use it in GitHub Desktop.
Save kennyp/1069647 to your computer and use it in GitHub Desktop.
JSLint
function! s:JSLint ()
cclose
let out = system('jslint', join(getline(1, '$'), "\n"))
if out != "jslint: No problems found.\n"
let errors = split(out, '[^\n]\n[^\n]\zs')
let error_list = []
for e in errors
let thise = split(e, '|||')
let error_list += [{'filename': expand("%"), 'lnum': thise[0], 'col': thise[1], 'text': thise[2]}]
endfor
call setqflist(error_list, 'r')
copen
else
echo "No Problems."
endif
endfunction
command! JSLint call <SID>JSLint()
map <Leader>js :JSLint<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment