2017-02-05 12:26:26 -05:00
|
|
|
" Author: Ahmed El Gabri <@ahmedelgabri>
|
|
|
|
" Description: standardjs for JavaScript files
|
|
|
|
|
2017-05-27 12:11:03 -04:00
|
|
|
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
|
2017-05-27 12:11:03 -04:00
|
|
|
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
2017-02-05 12:26:26 -05:00
|
|
|
\ 'node_modules/.bin/standard',
|
2017-05-27 12:11:03 -04:00
|
|
|
\])
|
2017-02-05 12:26:26 -05:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! ale_linters#javascript#standard#GetCommand(buffer) abort
|
2017-05-12 04:20:16 -04:00
|
|
|
return ale#Escape(ale_linters#javascript#standard#GetExecutable(a:buffer))
|
2017-04-15 20:24:08 -04:00
|
|
|
\ . ' ' . ale#Var(a:buffer, 'javascript_standard_options')
|
2017-02-05 12:26:26 -05:00
|
|
|
\ . ' --stdin %s'
|
|
|
|
endfunction
|
|
|
|
|
2017-06-21 06:15:05 -04:00
|
|
|
" 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',
|
2017-06-21 06:15:05 -04:00
|
|
|
\ 'callback': 'ale#handlers#eslint#Handle',
|
2017-02-05 12:26:26 -05:00
|
|
|
\})
|