diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-20 23:41:54 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-20 23:41:54 +0100 |
commit | 3532257a1ac5be9896dd1d8b4a8ed75c77528946 (patch) | |
tree | abe76df9aeffa9662cc15c405a406c6cc1746bd1 | |
parent | f92bbab8cf22becfaf3188474afb10245b489843 (diff) | |
download | ale-3532257a1ac5be9896dd1d8b4a8ed75c77528946.zip |
Detect more eslint configuration files for fixing errors
-rw-r--r-- | autoload/ale/handlers/eslint.vim | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/autoload/ale/handlers/eslint.vim b/autoload/ale/handlers/eslint.vim index a7e8ef42..e2ff3fa1 100644 --- a/autoload/ale/handlers/eslint.vim +++ b/autoload/ale/handlers/eslint.vim @@ -27,8 +27,26 @@ function! ale#handlers#eslint#GetExecutable(buffer) abort \) endfunction +function! s:FindConfig(buffer) abort + for l:filename in [ + \ '.eslintrc.js', + \ '.eslintrc.yaml', + \ '.eslintrc.yml', + \ '.eslintrc.json', + \ '.eslintrc', + \] + let l:config = ale#path#FindNearestFile(a:buffer, l:filename) + + if !empty(l:config) + return l:config + endif + endfor + + return '' +endfunction + function! ale#handlers#eslint#Fix(buffer, lines) abort - let l:config = ale#path#FindNearestFile(a:buffer, '.eslintrc.js') + let l:config = s:FindConfig(a:buffer) if empty(l:config) return 0 |