diff options
-rw-r--r-- | autoload/ale/handlers/xo.vim | 4 | ||||
-rw-r--r-- | test/fixers/test_xo_fixer_callback.vader | 14 | ||||
-rw-r--r-- | test/fixers/test_xots_fixer_callback.vader | 14 | ||||
-rw-r--r-- | test/xo-test-files/monorepo/node_modules/xo/cli.js | 0 | ||||
-rw-r--r-- | test/xo-test-files/monorepo/package.json | 0 | ||||
-rw-r--r-- | test/xo-test-files/monorepo/packages/a/index.js | 0 | ||||
-rw-r--r-- | test/xo-test-files/monorepo/packages/a/index.ts | 0 | ||||
-rw-r--r-- | test/xo-test-files/monorepo/packages/a/package.json | 0 |
8 files changed, 16 insertions, 16 deletions
diff --git a/autoload/ale/handlers/xo.vim b/autoload/ale/handlers/xo.vim index 0bea74e4..df2659da 100644 --- a/autoload/ale/handlers/xo.vim +++ b/autoload/ale/handlers/xo.vim @@ -29,7 +29,7 @@ function! ale#handlers#xo#HandleJSON(buffer, lines) abort endfunction function! ale#handlers#xo#GetProjectRoot(buffer) abort - let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json') + let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') - return empty(l:package_path) ? '' : fnamemodify(l:package_path, ':p:h') + 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 ffbecb6c..c676bd34 100644 --- a/test/fixers/test_xo_fixer_callback.vader +++ b/test/fixers/test_xo_fixer_callback.vader @@ -7,39 +7,39 @@ After: call ale#assert#TearDownFixerTest() Execute(The xo callback should return the correct default values): - call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js') + call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.js') AssertFixer \ { \ 'read_temporary_file': 1, \ 'command': (has('win32') ? 'node.exe ' : '') - \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js')) + \ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js')) \ . ' --fix %t', \ } Execute(The xo callback should include custom xo options): let g:ale_javascript_xo_options = '--space' - call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js') + call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.js') AssertFixer \ { \ 'read_temporary_file': 1, \ 'command': (has('win32') ? 'node.exe ' : '') - \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js')) + \ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js')) \ . ' --fix %t' \ . ' --space', \ } Execute(--stdin should be used when xo is new enough): let g:ale_javascript_xo_options = '--space' - call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js') + call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.js') GivenCommandOutput ['0.30.0'] AssertFixer \ { - \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files')) + \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo')) \ . (has('win32') ? 'node.exe ' : '') - \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/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' \ . ' --fix' \ . ' --space', diff --git a/test/fixers/test_xots_fixer_callback.vader b/test/fixers/test_xots_fixer_callback.vader index a26ec03c..6c8b448c 100644 --- a/test/fixers/test_xots_fixer_callback.vader +++ b/test/fixers/test_xots_fixer_callback.vader @@ -7,39 +7,39 @@ After: call ale#assert#TearDownFixerTest() Execute(The xo callback should return the correct default values): - call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.ts') + call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.ts') AssertFixer \ { \ 'read_temporary_file': 1, \ 'command': (has('win32') ? 'node.exe ' : '') - \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js')) + \ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js')) \ . ' --fix %t', \ } Execute(The xo callback should include custom xo options): let g:ale_typescript_xo_options = '--space' - call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.ts') + call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.ts') AssertFixer \ { \ 'read_temporary_file': 1, \ 'command': (has('win32') ? 'node.exe ' : '') - \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js')) + \ . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js')) \ . ' --fix %t' \ . ' --space', \ } Execute(--stdin should be used when xo is new enough): let g:ale_typescript_xo_options = '--space' - call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.ts') + call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.ts') GivenCommandOutput ['0.30.0'] AssertFixer \ { - \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files')) + \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo')) \ . (has('win32') ? 'node.exe ' : '') - \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/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' \ . ' --fix' \ . ' --space', diff --git a/test/xo-test-files/monorepo/node_modules/xo/cli.js b/test/xo-test-files/monorepo/node_modules/xo/cli.js new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/xo-test-files/monorepo/node_modules/xo/cli.js diff --git a/test/xo-test-files/monorepo/package.json b/test/xo-test-files/monorepo/package.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/xo-test-files/monorepo/package.json diff --git a/test/xo-test-files/monorepo/packages/a/index.js b/test/xo-test-files/monorepo/packages/a/index.js new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/xo-test-files/monorepo/packages/a/index.js diff --git a/test/xo-test-files/monorepo/packages/a/index.ts b/test/xo-test-files/monorepo/packages/a/index.ts new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/xo-test-files/monorepo/packages/a/index.ts diff --git a/test/xo-test-files/monorepo/packages/a/package.json b/test/xo-test-files/monorepo/packages/a/package.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/xo-test-files/monorepo/packages/a/package.json |