summaryrefslogtreecommitdiff
path: root/ale_linters/typescript
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-15 18:24:53 +0100
committerw0rp <devw0rp@gmail.com>2018-07-15 18:28:28 +0100
commita42999a639b2916b769a85f37d037be314d9d61b (patch)
tree5ebfb4d357dc673efa93fd32a66b489c4510de40 /ale_linters/typescript
parent5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff)
downloadale-a42999a639b2916b769a85f37d037be314d9d61b.zip
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'ale_linters/typescript')
-rw-r--r--ale_linters/typescript/tslint.vim16
1 files changed, 3 insertions, 13 deletions
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index b28f7cee..ccdca936 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -1,17 +1,7 @@
" Author: Prashanth Chandra <https://github.com/prashcr>, Jonathan Clem <https://jclem.net>
" Description: tslint for TypeScript files
-call ale#Set('typescript_tslint_executable', 'tslint')
-call ale#Set('typescript_tslint_config_path', '')
-call ale#Set('typescript_tslint_rules_dir', '')
-call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0))
-call ale#Set('typescript_tslint_ignore_empty_files', 0)
-
-function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
- return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [
- \ 'node_modules/.bin/tslint',
- \])
-endfunction
+call ale#handlers#tslint#InitVariables()
function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
" Do not output any errors for empty files if the option is on.
@@ -70,7 +60,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort
\ : ''
return ale#path#BufferCdString(a:buffer)
- \ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer))
+ \ . ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer))
\ . ' --format json'
\ . l:tslint_config_option
\ . l:tslint_rules_option
@@ -79,7 +69,7 @@ endfunction
call ale#linter#Define('typescript', {
\ 'name': 'tslint',
-\ 'executable_callback': 'ale_linters#typescript#tslint#GetExecutable',
+\ 'executable_callback': 'ale#handlers#tslint#GetExecutable',
\ 'command_callback': 'ale_linters#typescript#tslint#GetCommand',
\ 'callback': 'ale_linters#typescript#tslint#Handle',
\})