Add support for tslint.json file detection in tslint (#198)

* Add support for tslint.json file detection in tslint

* Fix tslint.json path building for tslint
This commit is contained in:
kyrisu 2016-12-04 22:17:22 +00:00 committed by w0rp
parent 3a1caca907
commit bbdff82aee
1 changed files with 8 additions and 1 deletions

View File

@ -37,9 +37,16 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines)
return l:output
endfunction
function! ale_linters#typescript#tslint#BuildLintCommand(buffer_n) abort
let l:tsconfig_path = ale#util#FindNearestFile(a:buffer_n, 'tslint.json')
let l:tslint_options = empty(l:tsconfig_path) ? '' : '-c ' . l:tsconfig_path
return g:ale#util#stdin_wrapper . ' .ts tslint ' . l:tslint_options
endfunction
call ale#linter#Define('typescript', {
\ 'name': 'tslint',
\ 'executable': 'tslint',
\ 'command': g:ale#util#stdin_wrapper . ' .ts tslint',
\ 'command_callback': 'ale_linters#typescript#tslint#BuildLintCommand',
\ 'callback': 'ale_linters#typescript#tslint#Handle',
\})