Fix 2891 - eslint not showing errors.

ESLint errors are contained in an array that can contain different
stuff other than JSON error messages. This patch iterates over the whole
array ignoring any non-json data.
This commit is contained in:
Horacio Sanson
2019-11-26 13:37:25 +09:00
parent b91d82bfaa
commit 5f95d032ee
2 changed files with 26 additions and 7 deletions

View File

@@ -84,11 +84,14 @@ function! s:CheckForBadConfig(buffer, lines) abort
endfunction
function! s:parseJSON(buffer, lines) abort
try
let l:parsed = json_decode(a:lines[-1])
catch
return []
endtry
let l:parsed = []
for l:line in a:lines
try
let l:parsed = extend(l:parsed, json_decode(l:line))
catch
endtry
endfor
if type(l:parsed) != v:t_list || empty(l:parsed)
return []