2017-03-28 19:21:27 -04:00
|
|
|
Before:
|
|
|
|
let g:ale_javascript_eslint_executable = 'eslint_d'
|
|
|
|
|
|
|
|
silent! cd /testplugin/test
|
|
|
|
let g:dir = getcwd()
|
|
|
|
|
|
|
|
runtime ale_linters/javascript/eslint.vim
|
|
|
|
|
|
|
|
After:
|
2017-05-26 05:02:48 -04:00
|
|
|
let g:ale_has_override = {}
|
2017-03-28 19:21:27 -04:00
|
|
|
let g:ale_javascript_eslint_executable = 'eslint'
|
|
|
|
let g:ale_javascript_eslint_use_global = 0
|
|
|
|
|
|
|
|
silent execute 'cd ' . g:dir
|
|
|
|
unlet! g:dir
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(create-react-app directories should be detected correctly):
|
2017-05-25 17:34:59 -04:00
|
|
|
silent noautocmd new eslint-test-files/react-app/subdir/testfile.js
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js',
|
2017-05-18 08:21:14 -04:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
:q
|
|
|
|
|
|
|
|
Execute(use-global should override create-react-app detection):
|
|
|
|
let g:ale_javascript_eslint_use_global = 1
|
|
|
|
|
2017-05-25 17:34:59 -04:00
|
|
|
silent noautocmd new eslint-test-files/react-app/subdir/testfile.js
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'eslint_d',
|
2017-05-18 08:21:14 -04:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
:q
|
|
|
|
|
|
|
|
Execute(other app directories should be detected correctly):
|
2017-05-25 17:34:59 -04:00
|
|
|
silent noautocmd new eslint-test-files/other-app/subdir/testfile.js
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ g:dir . '/eslint-test-files/node_modules/.bin/eslint',
|
2017-05-18 08:21:14 -04:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
:q
|
|
|
|
|
|
|
|
Execute(use-global should override other app directories):
|
|
|
|
let g:ale_javascript_eslint_use_global = 1
|
|
|
|
|
2017-05-25 17:34:59 -04:00
|
|
|
silent noautocmd new eslint-test-files/other-app/subdir/testfile.js
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'eslint_d',
|
2017-05-18 08:21:14 -04:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 19:21:27 -04:00
|
|
|
|
|
|
|
:q
|
2017-05-25 17:34:59 -04:00
|
|
|
|
|
|
|
Execute(eslint_d should be detected correctly):
|
|
|
|
silent noautocmd new eslint-test-files/app-with-eslint-d/testfile.js
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d',
|
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
:q
|
2017-05-26 05:02:48 -04:00
|
|
|
|
|
|
|
Execute(eslint.js executables should be run with node on Windows):
|
|
|
|
silent noautocmd new eslint-test-files/react-app/subdir/testfile.js
|
|
|
|
let g:ale_has_override['win32'] = 1
|
|
|
|
|
|
|
|
" We have to execute the file with node.
|
|
|
|
AssertEqual
|
|
|
|
\ 'node '''
|
|
|
|
\ . g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'
|
|
|
|
\ . ''' -f unix --stdin --stdin-filename %s',
|
2017-06-20 05:50:38 -04:00
|
|
|
\ ale#handlers#eslint#GetCommand(bufnr(''))
|