From bbdff82aee3e50fff1021ede7e57ff8448083e2c Mon Sep 17 00:00:00 2001 From: kyrisu Date: Sun, 4 Dec 2016 22:17:22 +0000 Subject: [PATCH] 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 --- ale_linters/typescript/tslint.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim index 04863e2..aa76358 100644 --- a/ale_linters/typescript/tslint.vim +++ b/ale_linters/typescript/tslint.vim @@ -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', \})