summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-09-06 11:17:21 +0100
committerw0rp <devw0rp@gmail.com>2017-09-06 11:17:21 +0100
commitc277cdef8cb24512583093d7a9b7d68a14e6d82b (patch)
treea60c7b9c08f1e1249ab45c90ef21c896e99d7ffc /ale_linters
parentad1bd424fa33a60fd437ff1488f5bcd925a0be10 (diff)
downloadale-c277cdef8cb24512583093d7a9b7d68a14e6d82b.zip
Add an option for ignoring the output of TSLint if a file contains a single blank line
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/typescript/tslint.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index 18f9e08c..c3852b89 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -5,6 +5,7 @@ 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', 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', [
@@ -13,6 +14,12 @@ function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
endfunction
function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
+ " Do not output any errors for empty files if the option is on.
+ if ale#Var(a:buffer, 'typescript_tslint_ignore_empty_files')
+ \&& getbufline(a:buffer, 1, '$') == ['']
+ return []
+ endif
+
let l:dir = expand('#' . a:buffer . ':p:h')
let l:output = []