summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles B Johnson <mail@cbjohnson.info>2020-04-08 18:38:47 -0500
committerCharles B Johnson <mail@cbjohnson.info>2021-01-22 09:23:53 -0600
commit289f808ccd3098cb19bc3bbbb274524a4fb85ff7 (patch)
tree1d490fcbe58f537df075173639454357b2a22043
parent4a6136c27ec2430a1ef5481e0ca10dee03ba178f (diff)
downloadale-289f808ccd3098cb19bc3bbbb274524a4fb85ff7.zip
fixers/xo: refactor to handlers
-rw-r--r--autoload/ale/fixers/xo.vim15
-rw-r--r--autoload/ale/handlers/xo.vim1
-rw-r--r--test/fixers/test_xo_fixer_callback.vader1
3 files changed, 4 insertions, 13 deletions
diff --git a/autoload/ale/fixers/xo.vim b/autoload/ale/fixers/xo.vim
index 69d23ea3..06e58508 100644
--- a/autoload/ale/fixers/xo.vim
+++ b/autoload/ale/fixers/xo.vim
@@ -1,20 +1,9 @@
" Author: Albert Marquez - https://github.com/a-marquez
" Description: Fixing files with XO.
-call ale#Set('javascript_xo_executable', 'xo')
-call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
-call ale#Set('javascript_xo_options', '')
-
-function! ale#fixers#xo#GetExecutable(buffer) abort
- return ale#node#FindExecutable(a:buffer, 'javascript_xo', [
- \ 'node_modules/xo/cli.js',
- \ 'node_modules/.bin/xo',
- \])
-endfunction
-
function! ale#fixers#xo#Fix(buffer) abort
- let l:executable = ale#fixers#xo#GetExecutable(a:buffer)
- let l:options = ale#Var(a:buffer, 'javascript_xo_options')
+ let l:executable = ale#handlers#xo#GetExecutable(a:buffer, 'javascript')
+ let l:options = ale#handlers#xo#GetOptions(a:buffer, 'javascript')
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
diff --git a/autoload/ale/handlers/xo.vim b/autoload/ale/handlers/xo.vim
index 38dcf5d5..3f7c72cb 100644
--- a/autoload/ale/handlers/xo.vim
+++ b/autoload/ale/handlers/xo.vim
@@ -8,6 +8,7 @@ call ale#Set('typescript_xo_options', '')
function! ale#handlers#xo#GetExecutable(buffer, type) abort
return ale#node#FindExecutable(a:buffer, a:type . '_xo', [
+ \ 'node_modules/xo/cli.js',
\ 'node_modules/.bin/xo',
\])
endfunction
diff --git a/test/fixers/test_xo_fixer_callback.vader b/test/fixers/test_xo_fixer_callback.vader
index 8bccd05e..0bb3108a 100644
--- a/test/fixers/test_xo_fixer_callback.vader
+++ b/test/fixers/test_xo_fixer_callback.vader
@@ -1,5 +1,6 @@
Before:
call ale#assert#SetUpFixerTest('javascript', 'xo')
+ runtime autoload/ale/handlers/xo.vim
After:
call ale#assert#TearDownFixerTest()