diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-18 01:58:27 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-20 19:02:36 +0100 |
commit | 7d8390d43e83f3e097469fd3e4f65f07a3035903 (patch) | |
tree | 869e5378464ce91253fba429c4af57398c9704f5 /ale_linters/javascript | |
parent | 0d797c203f22e593a6d19d127a8d1f4f78d3d106 (diff) | |
download | ale-7d8390d43e83f3e097469fd3e4f65f07a3035903.zip |
Add experimental code for fixing errors
Diffstat (limited to 'ale_linters/javascript')
-rw-r--r-- | ale_linters/javascript/eslint.vim | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim index f1c3bb01..9fd20078 100644 --- a/ale_linters/javascript/eslint.vim +++ b/ale_linters/javascript/eslint.vim @@ -1,40 +1,14 @@ " Author: w0rp <devw0rp@gmail.com> " Description: eslint for JavaScript files -let g:ale_javascript_eslint_executable = -\ get(g:, 'ale_javascript_eslint_executable', 'eslint') - let g:ale_javascript_eslint_options = \ get(g:, 'ale_javascript_eslint_options', '') let g:ale_javascript_eslint_use_global = \ get(g:, 'ale_javascript_eslint_use_global', 0) -function! ale_linters#javascript#eslint#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'javascript_eslint_use_global') - 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, - \ 'node_modules/eslint/bin/eslint.js', - \ '' - \) - - if !empty(l:executable) - return l:executable - endif - - return ale#path#ResolveLocalPath( - \ a:buffer, - \ 'node_modules/.bin/eslint', - \ ale#Var(a:buffer, 'javascript_eslint_executable') - \) -endfunction - function! ale_linters#javascript#eslint#GetCommand(buffer) abort - return ale#Escape(ale_linters#javascript#eslint#GetExecutable(a:buffer)) + return ale#handlers#eslint#GetExecutable(a:buffer) \ . ' ' . ale#Var(a:buffer, 'javascript_eslint_options') \ . ' -f unix --stdin --stdin-filename %s' endfunction @@ -103,7 +77,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'eslint', -\ 'executable_callback': 'ale_linters#javascript#eslint#GetExecutable', +\ 'executable_callback': 'ale#handlers#eslint#GetExecutable', \ 'command_callback': 'ale_linters#javascript#eslint#GetCommand', \ 'callback': 'ale_linters#javascript#eslint#Handle', \}) |