diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-25 22:34:59 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-25 22:34:59 +0100 |
commit | 3840cebbc49a64a93e1a6674158f0d7e5372f9f1 (patch) | |
tree | da08d94682461288fa0cee64c1c6dcd364bbdb39 /autoload | |
parent | c31cd12bdd941e9a326d89b21d187224c661c485 (diff) | |
download | ale-3840cebbc49a64a93e1a6674158f0d7e5372f9f1.zip |
Automatically use eslint_d for eslint, when available
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/handlers/eslint.vim | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/autoload/ale/handlers/eslint.vim b/autoload/ale/handlers/eslint.vim index eb7459be..17852119 100644 --- a/autoload/ale/handlers/eslint.vim +++ b/autoload/ale/handlers/eslint.vim @@ -9,22 +9,21 @@ function! ale#handlers#eslint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'javascript_eslint_executable') endif - " Look for the kinds of paths that create-react-app generates first. - let l:executable = ale#path#ResolveLocalPath( - \ a:buffer, + " Look for eslint_d first, then the path React uses, then the basic + " eslint path. + for l:path in [ + \ '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 + if !empty(l:executable) + return l:executable + endif + endfor - return ale#path#ResolveLocalPath( - \ a:buffer, - \ 'node_modules/.bin/eslint', - \ ale#Var(a:buffer, 'javascript_eslint_executable') - \) + return ale#Var(a:buffer, 'javascript_eslint_executable') endfunction function! s:FindConfig(buffer) abort |