ale/ale_linters/javascript/standard.vim

27 lines
1010 B
VimL
Raw Normal View History

2017-02-05 12:26:26 -05:00
" Author: Ahmed El Gabri <@ahmedelgabri>
" Description: standardjs for JavaScript files
call ale#Set('javascript_standard_executable', 'standard')
call ale#Set('javascript_standard_use_global', 0)
call ale#Set('javascript_standard_options', '')
2017-02-05 12:26:26 -05:00
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
2017-02-05 12:26:26 -05:00
\ 'node_modules/.bin/standard',
\])
2017-02-05 12:26:26 -05:00
endfunction
function! ale_linters#javascript#standard#GetCommand(buffer) abort
return ale#Escape(ale_linters#javascript#standard#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'javascript_standard_options')
2017-02-05 12:26:26 -05:00
\ . ' --stdin %s'
endfunction
" standard uses eslint and the output format is the same
2017-02-05 12:26:26 -05:00
call ale#linter#Define('javascript', {
\ 'name': 'standard',
\ 'executable_callback': 'ale_linters#javascript#standard#GetExecutable',
\ 'command_callback': 'ale_linters#javascript#standard#GetCommand',
\ 'callback': 'ale#handlers#eslint#Handle',
2017-02-05 12:26:26 -05:00
\})