Created
May 1, 2016 17:15
-
-
Save mnowotnik/ef62083d8a88aed7282445da489e8829 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:Eslint () | |
cclose | |
let out = system('eslint '.expand("%")) | |
let errors = split(out, '\n') | |
let filename = Strip(errors[0]) | |
let errors = errors[1:] | |
let q_list = [] | |
echo errors | |
for err in errors | |
let err_split = split(err,'\ \+') | |
if len(err_split) == 0 | |
continue | |
endif | |
let row_col = split(err_split[0],':') | |
if len(row_col) <= 1 | |
continue | |
endif | |
let q_list += [{'filename': filename, 'lnum': row_col[0], 'col': row_col[1], 'text': join(err_split[2:])}] | |
endfor | |
call setqflist(q_list, 'r') | |
copen | |
endfunction | |
command! Eslint call <SID>Eslint() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment