diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim index 43ece55..e9b3164 100644 --- a/ale_linters/typescript/tslint.vim +++ b/ale_linters/typescript/tslint.vim @@ -14,6 +14,10 @@ endfunction function! ale_linters#typescript#tslint#Handle(buffer, lines) abort let l:output = [] + if empty(a:lines) + return [] + endif + for l:error in json_decode(join(a:lines, '')) if ale#path#IsBufferPath(a:buffer, l:error.name) call add(l:output, { diff --git a/test/handler/test_tslint_handler.vader b/test/handler/test_tslint_handler.vader index ae87c52..704123d 100644 --- a/test/handler/test_tslint_handler.vader +++ b/test/handler/test_tslint_handler.vader @@ -117,3 +117,8 @@ Execute(The tslint handler should parse lines correctly): \ } \ }, \])]) + +Execute(The tslint handler should handle empty output): + AssertEqual + \ [], + \ ale_linters#typescript#tslint#Handle(bufnr(''), [])