mirror of
https://github.com/dense-analysis/ale.git
synced 2026-03-07 07:32:01 +08:00
Refactor running of local Node programs with a helper function
This commit is contained in:
@@ -5,25 +5,11 @@ call ale#Set('javascript_eslint_executable', 'eslint')
|
||||
call ale#Set('javascript_eslint_use_global', 0)
|
||||
|
||||
function! ale#handlers#eslint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'javascript_eslint_use_global')
|
||||
return ale#Var(a:buffer, 'javascript_eslint_executable')
|
||||
endif
|
||||
|
||||
" Look for eslint_d first, then the path React uses, then the basic
|
||||
" eslint path.
|
||||
for l:path in [
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_eslint', [
|
||||
\ 'node_modules/.bin/eslint_d',
|
||||
\ 'node_modules/eslint/bin/eslint.js',
|
||||
\ 'node_modules/.bin/eslint',
|
||||
\]
|
||||
let l:executable = ale#path#FindNearestFile(a:buffer, l:path)
|
||||
|
||||
if !empty(l:executable)
|
||||
return l:executable
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ale#Var(a:buffer, 'javascript_eslint_executable')
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! s:FindConfig(buffer) abort
|
||||
|
||||
Reference in New Issue
Block a user