mirror of https://github.com/dense-analysis/ale
#684 Handle tslint errors without the severity included, and use character instead of position for the columns
This commit is contained in:
parent
492260c967
commit
229a1c092a
|
@ -17,12 +17,12 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
|
|||
for l:error in json_decode(join(a:lines, ''))
|
||||
if ale#path#IsBufferPath(a:buffer, l:error.name)
|
||||
call add(l:output, {
|
||||
\ 'type': (l:error.ruleSeverity ==# 'WARNING' ? 'W' : 'E'),
|
||||
\ 'type': (get(l:error, 'ruleSeverity', '') ==# 'WARNING' ? 'W' : 'E'),
|
||||
\ 'text': l:error.failure,
|
||||
\ 'lnum': l:error.startPosition.line + 1,
|
||||
\ 'col': l:error.startPosition.position + 1,
|
||||
\ 'col': l:error.startPosition.character + 1,
|
||||
\ 'end_lnum': l:error.endPosition.line + 1,
|
||||
\ 'end_col': l:error.endPosition.position + 1,
|
||||
\ 'end_col': l:error.endPosition.character + 1,
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -25,19 +25,27 @@ Execute(The tslint handler should parse lines correctly):
|
|||
\ },
|
||||
\ {
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 15,
|
||||
\ 'col': 8,
|
||||
\ 'end_lnum': 3,
|
||||
\ 'end_col': 23,
|
||||
\ 'end_col': 12,
|
||||
\ 'text': 'Something else',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 31,
|
||||
\ 'col': 9,
|
||||
\ 'end_lnum': 31,
|
||||
\ 'end_col': 20,
|
||||
\ 'text': 'Calls to console.log are not allowed.',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
|
||||
\ {
|
||||
\ 'endPosition': {
|
||||
\ 'character': 14,
|
||||
\ 'line': 0,
|
||||
\ 'position': 14
|
||||
\ 'position': 1000
|
||||
\ },
|
||||
\ 'failure': 'Missing semicolon',
|
||||
\ 'fix': {
|
||||
|
@ -51,14 +59,14 @@ Execute(The tslint handler should parse lines correctly):
|
|||
\ 'startPosition': {
|
||||
\ 'character': 14,
|
||||
\ 'line': 0,
|
||||
\ 'position': 14
|
||||
\ 'position': 1000
|
||||
\ }
|
||||
\ },
|
||||
\ {
|
||||
\ 'endPosition': {
|
||||
\ 'character': 11,
|
||||
\ 'line': 2,
|
||||
\ 'position': 22
|
||||
\ 'position': 1000
|
||||
\ },
|
||||
\ 'failure': 'Something else',
|
||||
\ 'fix': {
|
||||
|
@ -72,7 +80,7 @@ Execute(The tslint handler should parse lines correctly):
|
|||
\ 'startPosition': {
|
||||
\ 'character': 7,
|
||||
\ 'line': 1,
|
||||
\ 'position': 14
|
||||
\ 'position': 1000
|
||||
\ }
|
||||
\ },
|
||||
\ {
|
||||
|
@ -96,4 +104,19 @@ Execute(The tslint handler should parse lines correctly):
|
|||
\ 'position': 14
|
||||
\ }
|
||||
\ },
|
||||
\ {
|
||||
\ "endPosition": {
|
||||
\ "character": 19,
|
||||
\ "line": 30,
|
||||
\ "position": 14590
|
||||
\ },
|
||||
\ "failure": "Calls to console.log are not allowed.",
|
||||
\ 'name': 'app/test.ts',
|
||||
\ "ruleName": "no-console",
|
||||
\ "startPosition": {
|
||||
\ "character": 8,
|
||||
\ "line": 30,
|
||||
\ "position": 14579
|
||||
\ }
|
||||
\ },
|
||||
\])])
|
||||
|
|
Loading…
Reference in New Issue