Refactor running of local Node programs with a helper function

This commit is contained in:
w0rp
2017-05-27 17:11:03 +01:00
parent b934dc52b6
commit c4f22186bd
12 changed files with 69 additions and 157 deletions

View File

@@ -1,22 +1,13 @@
" Author: Zach Perrault -- @zperrault
" Description: FlowType checking for JavaScript files
let g:ale_javascript_flow_executable =
\ get(g:, 'ale_javascript_flow_executable', 'flow')
let g:ale_javascript_flow_use_global =
\ get(g:, 'ale_javascript_flow_use_global', 0)
call ale#Set('javascript_flow_executable', 'flow')
call ale#Set('javascript_flow_use_global', 0)
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
if ale#Var(a:buffer, 'javascript_flow_use_global')
return ale#Var(a:buffer, 'javascript_flow_executable')
endif
return ale#path#ResolveLocalPath(
\ a:buffer,
return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
\ 'node_modules/.bin/flow',
\ ale#Var(a:buffer, 'javascript_flow_executable')
\)
\])
endfunction
function! ale_linters#javascript#flow#GetCommand(buffer) abort