1
0
Fork 0
mirror of synced 2024-11-26 18:55:34 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/javascript/xo.vim

27 lines
1,003 B
VimL
Raw Normal View History

" Author: Daniel Lupu <lupu.daniel.f@gmail.com>
" Description: xo for JavaScript files
call ale#Set('javascript_xo_executable', 'xo')
2018-06-14 06:31:12 -04:00
call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_xo_options', '')
function! ale_linters#javascript#xo#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_xo', [
\ 'node_modules/.bin/xo',
\])
endfunction
function! ale_linters#javascript#xo#GetCommand(buffer) abort
return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'javascript_xo_options')
2019-08-22 11:36:17 -04:00
\ . ' --reporter json --stdin --stdin-filename %s'
endfunction
" xo uses eslint and the output format is the same
call ale#linter#Define('javascript', {
\ 'name': 'xo',
2019-03-08 06:04:56 -05:00
\ 'executable': function('ale_linters#javascript#xo#GetExecutable'),
\ 'command': function('ale_linters#javascript#xo#GetCommand'),
2019-08-22 11:36:17 -04:00
\ 'callback': 'ale#handlers#eslint#HandleJSON',
\})