fixers/xo: remove unnecessary directory crawl
This commit is contained in:
parent
1991313ee7
commit
23ff19a162
4 changed files with 3 additions and 14 deletions
|
@ -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
|
" 0.30.0 is the first version with a working --stdin --fix
|
||||||
if ale#semver#GTE(a:version, [0, 30, 0])
|
if ale#semver#GTE(a:version, [0, 30, 0])
|
||||||
let l:project_root = ale#handlers#xo#GetProjectRoot(a:buffer)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#path#CdString(l:project_root)
|
\ 'command': l:executable
|
||||||
\ . l:executable
|
|
||||||
\ . ' --stdin --stdin-filename %s'
|
\ . ' --stdin --stdin-filename %s'
|
||||||
\ . ' --fix'
|
\ . ' --fix'
|
||||||
\ . l:options,
|
\ . l:options,
|
||||||
|
|
|
@ -27,9 +27,3 @@ endfunction
|
||||||
function! ale#handlers#xo#HandleJSON(buffer, lines) abort
|
function! ale#handlers#xo#HandleJSON(buffer, lines) abort
|
||||||
return ale#handlers#eslint#HandleJSON(a:buffer, a:lines)
|
return ale#handlers#eslint#HandleJSON(a:buffer, a:lines)
|
||||||
endfunction
|
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
|
|
||||||
|
|
|
@ -37,8 +37,7 @@ Execute(--stdin should be used when xo is new enough):
|
||||||
GivenCommandOutput ['0.30.0']
|
GivenCommandOutput ['0.30.0']
|
||||||
AssertFixer
|
AssertFixer
|
||||||
\ {
|
\ {
|
||||||
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo'))
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
\ . (has('win32') ? 'node.exe ' : '')
|
|
||||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js'))
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js'))
|
||||||
\ . ' --stdin --stdin-filename %s'
|
\ . ' --stdin --stdin-filename %s'
|
||||||
\ . ' --fix'
|
\ . ' --fix'
|
||||||
|
|
|
@ -37,8 +37,7 @@ Execute(--stdin should be used when xo is new enough):
|
||||||
GivenCommandOutput ['0.30.0']
|
GivenCommandOutput ['0.30.0']
|
||||||
AssertFixer
|
AssertFixer
|
||||||
\ {
|
\ {
|
||||||
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo'))
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
\ . (has('win32') ? 'node.exe ' : '')
|
|
||||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js'))
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js'))
|
||||||
\ . ' --stdin --stdin-filename %s'
|
\ . ' --stdin --stdin-filename %s'
|
||||||
\ . ' --fix'
|
\ . ' --fix'
|
||||||
|
|
Reference in a new issue