]> git.madduck.net Git - etc/vim.git/blob - ale_linters/typescript/standard.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / ale_linters / typescript / standard.vim
1 " Author: Ahmed El Gabri <@ahmedelgabri>
2 " Description: standardjs for typescript files
3
4 call ale#Set('typescript_standard_executable', 'standard')
5 call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executables', 0))
6 call ale#Set('typescript_standard_options', '')
7
8 function! ale_linters#typescript#standard#GetExecutable(buffer) abort
9     return ale#path#FindExecutable(a:buffer, 'typescript_standard', [
10     \   'node_modules/standardx/bin/cmd.js',
11     \   'node_modules/standard/bin/cmd.js',
12     \   'node_modules/.bin/standard',
13     \])
14 endfunction
15
16 function! ale_linters#typescript#standard#GetCommand(buffer) abort
17     let l:executable = ale_linters#typescript#standard#GetExecutable(a:buffer)
18     let l:options = ale#Var(a:buffer, 'typescript_standard_options')
19
20     return ale#node#Executable(a:buffer, l:executable)
21     \   . (!empty(l:options) ? ' ' . l:options : '')
22     \   . ' --stdin %s'
23 endfunction
24
25 " standard uses eslint and the output format is the same
26 call ale#linter#Define('typescript', {
27 \   'name': 'standard',
28 \   'executable': function('ale_linters#typescript#standard#GetExecutable'),
29 \   'command': function('ale_linters#typescript#standard#GetCommand'),
30 \   'callback': 'ale#handlers#eslint#Handle',
31 \})