2017-02-09 13:54:49 -05:00
|
|
|
" Author: Daniel Lupu <lupu.daniel.f@gmail.com>
|
|
|
|
" Description: xo for JavaScript files
|
|
|
|
|
2017-05-27 12:11:03 -04:00
|
|
|
call ale#Set('javascript_xo_executable', 'xo')
|
2018-04-09 14:11:20 -04:00
|
|
|
call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
|
2017-05-27 12:11:03 -04:00
|
|
|
call ale#Set('javascript_xo_options', '')
|
2017-02-09 13:54:49 -05:00
|
|
|
|
|
|
|
function! ale_linters#javascript#xo#GetExecutable(buffer) abort
|
2017-05-27 12:11:03 -04:00
|
|
|
return ale#node#FindExecutable(a:buffer, 'javascript_xo', [
|
2017-02-09 13:54:49 -05:00
|
|
|
\ 'node_modules/.bin/xo',
|
2017-05-27 12:11:03 -04:00
|
|
|
\])
|
2017-02-09 13:54:49 -05:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! ale_linters#javascript#xo#GetCommand(buffer) abort
|
2017-05-12 04:20:16 -04:00
|
|
|
return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer))
|
2017-04-27 18:01:01 -04:00
|
|
|
\ . ' ' . ale#Var(a:buffer, 'javascript_xo_options')
|
2017-02-09 13:54:49 -05:00
|
|
|
\ . ' --reporter unix --stdin --stdin-filename %s'
|
|
|
|
endfunction
|
|
|
|
|
2017-06-21 06:15:05 -04:00
|
|
|
" xo uses eslint and the output format is the same
|
2017-02-09 13:54:49 -05:00
|
|
|
call ale#linter#Define('javascript', {
|
|
|
|
\ 'name': 'xo',
|
|
|
|
\ 'executable_callback': 'ale_linters#javascript#xo#GetExecutable',
|
|
|
|
\ 'command_callback': 'ale_linters#javascript#xo#GetCommand',
|
2017-06-21 06:15:05 -04:00
|
|
|
\ 'callback': 'ale#handlers#eslint#Handle',
|
2017-02-09 13:54:49 -05:00
|
|
|
\})
|