diff options
author | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-06-07 09:26:06 +0200 |
---|---|---|
committer | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-06-07 09:26:06 +0200 |
commit | a5e7f2c8bb61f3e882bc26ce1773b130d1fbc32b (patch) | |
tree | cb85bc818b667acc9b28870755e079e20b935a3f /ale_linters/typescript/standard.vim | |
parent | b6828ac5c54c809336b5314e51f185124d90b23f (diff) | |
parent | 7265ceb6d050d1a4642741d248f11e4f2abd37e1 (diff) | |
download | ale-a5e7f2c8bb61f3e882bc26ce1773b130d1fbc32b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ale_linters/typescript/standard.vim')
-rw-r--r-- | ale_linters/typescript/standard.vim | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ale_linters/typescript/standard.vim b/ale_linters/typescript/standard.vim new file mode 100644 index 00000000..da8f14eb --- /dev/null +++ b/ale_linters/typescript/standard.vim @@ -0,0 +1,31 @@ +" Author: Ahmed El Gabri <@ahmedelgabri> +" Description: standardjs for typescript files + +call ale#Set('typescript_standard_executable', 'standard') +call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('typescript_standard_options', '') + +function! ale_linters#typescript#standard#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'typescript_standard', [ + \ 'node_modules/standardx/bin/cmd.js', + \ 'node_modules/standard/bin/cmd.js', + \ 'node_modules/.bin/standard', + \]) +endfunction + +function! ale_linters#typescript#standard#GetCommand(buffer) abort + let l:executable = ale_linters#typescript#standard#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'typescript_standard_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --stdin %s' +endfunction + +" standard uses eslint and the output format is the same +call ale#linter#Define('typescript', { +\ 'name': 'standard', +\ 'executable': function('ale_linters#typescript#standard#GetExecutable'), +\ 'command': function('ale_linters#typescript#standard#GetCommand'), +\ 'callback': 'ale#handlers#eslint#Handle', +\}) |