summaryrefslogtreecommitdiff
path: root/ale_linters/javascript/eslint.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-12-22 11:16:22 +0000
committerw0rp <devw0rp@gmail.com>2016-12-22 11:16:22 +0000
commit771bfe3b185adb87e9480118eff8b476f6f02f05 (patch)
treec4abee75714ac0dfbed2797eb402a9e181bcec2c /ale_linters/javascript/eslint.vim
parentbda6df61a08e9582f43dd419b3fc18a15a714c5b (diff)
downloadale-771bfe3b185adb87e9480118eff8b476f6f02f05.zip
#193 Fix a parsing error for parsing errors with eslint
Diffstat (limited to 'ale_linters/javascript/eslint.vim')
-rw-r--r--ale_linters/javascript/eslint.vim19
1 files changed, 17 insertions, 2 deletions
diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim
index e9b7d959..94086b0a 100644
--- a/ale_linters/javascript/eslint.vim
+++ b/ale_linters/javascript/eslint.vim
@@ -30,17 +30,32 @@ function! ale_linters#javascript#eslint#Handle(buffer, lines)
" /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]
" /path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$'
+ " This second pattern matches lines like the following:
+ "
+ " /path/to/some-filename.js:13:3: Parsing error: Unexpected token
+ let l:parsing_pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\)$'
let l:output = []
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if len(l:match) == 0
+ " Try the parsing pattern for parsing errors.
+ let l:match = matchlist(l:line, l:parsing_pattern)
+ endif
+
+ if len(l:match) == 0
continue
endif
- let l:type = split(l:match[4], '/')[0]
- let l:text = l:match[3] . ' [' . l:match[4] . ']'
+ let l:type = 'Error'
+ let l:text = l:match[3]
+
+ " Take the error type from the output if available.
+ if !empty(l:match[4])
+ let l:type = split(l:match[4], '/')[0]
+ let l:text .= ' [' . l:match[4] . ']'
+ endif
" vcol is Needed to indicate that the column is a character.
call add(l:output, {