diff options
author | Ian Campbell <ipcampbell@gmail.com> | 2019-07-26 11:52:34 -0400 |
---|---|---|
committer | Ian Campbell <ipcampbell@gmail.com> | 2019-10-21 18:20:43 -0400 |
commit | 9017d3ef9ce06a3662f6c87becffa7d7143fb571 (patch) | |
tree | 914e2d7dc2db5cb8158fc3f43cac3b6bebe5a1a9 /ale_linters/typescript | |
parent | 67d0ccc398ca7650bb2c774a94d098bee3049169 (diff) | |
download | ale-9017d3ef9ce06a3662f6c87becffa7d7143fb571.zip |
Add StandardJS for TypeScript linting and fixing.
Diffstat (limited to 'ale_linters/typescript')
-rw-r--r-- | ale_linters/typescript/standard.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ale_linters/typescript/standard.vim b/ale_linters/typescript/standard.vim new file mode 100644 index 00000000..184d9727 --- /dev/null +++ b/ale_linters/typescript/standard.vim @@ -0,0 +1,30 @@ +" 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/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', +\}) |