diff options
author | w0rp <w0rp@users.noreply.github.com> | 2019-11-14 14:47:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-14 14:47:19 +0000 |
commit | 7665559d0e6102c9eccf39a119afd9c7a1a0af82 (patch) | |
tree | 537557408cb17220a2b9541c398c9226970fed00 /ale_linters | |
parent | 66a8df081e57b18ab79b71c77d628c56aa4d8344 (diff) | |
parent | ea91209a6685faa0275dc5f8735836ced8b08e4b (diff) | |
download | ale-7665559d0e6102c9eccf39a119afd9c7a1a0af82.zip |
Merge pull request #2660 from YPCrumble/master
Add StandardJS linter for TypeScript
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/javascript/standard.vim | 1 | ||||
-rw-r--r-- | ale_linters/typescript/standard.vim | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/ale_linters/javascript/standard.vim b/ale_linters/javascript/standard.vim index 203a803e..1990adce 100644 --- a/ale_linters/javascript/standard.vim +++ b/ale_linters/javascript/standard.vim @@ -7,6 +7,7 @@ call ale#Set('javascript_standard_options', '') function! ale_linters#javascript#standard#GetExecutable(buffer) abort return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/semistandard/bin/cmd.js', \ 'node_modules/.bin/standard', 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', +\}) |