diff options
author | Charles B Johnson <mail@cbjohnson.info> | 2020-07-04 14:12:14 -0500 |
---|---|---|
committer | Charles B Johnson <mail@cbjohnson.info> | 2021-01-22 09:23:54 -0600 |
commit | 23ff19a162aadb048f3d5b2d4a4aa9cf3ec58a52 (patch) | |
tree | b3e4c5db0ecaf9a6d85904eaa281eafb81bd317f | |
parent | 1991313ee734129d056a61d6daf1da2c738f8e1a (diff) | |
download | ale-23ff19a162aadb048f3d5b2d4a4aa9cf3ec58a52.zip |
fixers/xo: remove unnecessary directory crawl
-rw-r--r-- | autoload/ale/fixers/xo.vim | 5 | ||||
-rw-r--r-- | autoload/ale/handlers/xo.vim | 6 | ||||
-rw-r--r-- | test/fixers/test_xo_fixer_callback.vader | 3 | ||||
-rw-r--r-- | test/fixers/test_xots_fixer_callback.vader | 3 |
4 files changed, 3 insertions, 14 deletions
diff --git a/autoload/ale/fixers/xo.vim b/autoload/ale/fixers/xo.vim index 2c8ab114..0f8f3ec6 100644 --- a/autoload/ale/fixers/xo.vim +++ b/autoload/ale/fixers/xo.vim @@ -28,11 +28,8 @@ function! ale#fixers#xo#ApplyFixForVersion(buffer, version, executable, options) " 0.30.0 is the first version with a working --stdin --fix if ale#semver#GTE(a:version, [0, 30, 0]) - let l:project_root = ale#handlers#xo#GetProjectRoot(a:buffer) - return { - \ 'command': ale#path#CdString(l:project_root) - \ . l:executable + \ 'command': l:executable \ . ' --stdin --stdin-filename %s' \ . ' --fix' \ . l:options, diff --git a/autoload/ale/handlers/xo.vim b/autoload/ale/handlers/xo.vim index df2659da..3f7c72cb 100644 --- a/autoload/ale/handlers/xo.vim +++ b/autoload/ale/handlers/xo.vim @@ -27,9 +27,3 @@ endfunction function! ale#handlers#xo#HandleJSON(buffer, lines) abort return ale#handlers#eslint#HandleJSON(a:buffer, a:lines) endfunction - -function! ale#handlers#xo#GetProjectRoot(buffer) abort - let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') - - return empty(l:modules_dir) ? '' : fnamemodify(l:modules_dir, ':h:h') -endfunction diff --git a/test/fixers/test_xo_fixer_callback.vader b/test/fixers/test_xo_fixer_callback.vader index c676bd34..a473606e 100644 --- a/test/fixers/test_xo_fixer_callback.vader +++ b/test/fixers/test_xo_fixer_callback.vader @@ -37,8 +37,7 @@ Execute(--stdin should be used when xo is new enough): GivenCommandOutput ['0.30.0'] AssertFixer \ { - \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo')) - \ . (has('win32') ? 'node.exe ' : '') + \ 'command': (has('win32') ? 'node.exe ' : '') \ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js')) \ . ' --stdin --stdin-filename %s' \ . ' --fix' diff --git a/test/fixers/test_xots_fixer_callback.vader b/test/fixers/test_xots_fixer_callback.vader index 6c8b448c..5c7fa1d1 100644 --- a/test/fixers/test_xots_fixer_callback.vader +++ b/test/fixers/test_xots_fixer_callback.vader @@ -37,8 +37,7 @@ Execute(--stdin should be used when xo is new enough): GivenCommandOutput ['0.30.0'] AssertFixer \ { - \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo')) - \ . (has('win32') ? 'node.exe ' : '') + \ 'command': (has('win32') ? 'node.exe ' : '') \ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js')) \ . ' --stdin --stdin-filename %s' \ . ' --fix' |