]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/javascript/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:

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