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 committed 2019-11-26 13:37:25 +09:00
1 parent b91d82bfaa
commit 5f95d032ee
2 files changed
+26 -7

No files matched your search

+8 -5
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 []