2017-03-28 23:21:27 +00:00
|
|
|
Before:
|
|
|
|
let g:ale_javascript_eslint_executable = 'eslint_d'
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetDirectory('/testplugin/test')
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
runtime ale_linters/javascript/eslint.vim
|
|
|
|
|
|
|
|
After:
|
|
|
|
let g:ale_javascript_eslint_executable = 'eslint'
|
|
|
|
let g:ale_javascript_eslint_use_global = 0
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#RestoreDirectory()
|
2017-03-28 23:21:27 +00:00
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(create-react-app directories should be detected correctly):
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 18:23:09 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'),
|
2017-05-18 12:21:14 +00:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
Execute(use-global should override create-react-app detection):
|
|
|
|
let g:ale_javascript_eslint_use_global = 1
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'eslint_d',
|
2017-05-18 12:21:14 +00:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
Execute(other app directories should be detected correctly):
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js')
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 18:23:09 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/eslint-test-files/node_modules/.bin/eslint'),
|
2017-05-18 12:21:14 +00:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
Execute(use-global should override other app directories):
|
|
|
|
let g:ale_javascript_eslint_use_global = 1
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js')
|
2017-03-28 23:21:27 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'eslint_d',
|
2017-05-18 12:21:14 +00:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
2017-03-28 23:21:27 +00:00
|
|
|
|
2017-05-25 21:34:59 +00:00
|
|
|
Execute(eslint_d should be detected correctly):
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetFilename('eslint-test-files/app-with-eslint-d/testfile.js')
|
2017-05-25 21:34:59 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 18:23:09 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'),
|
2017-05-25 21:34:59 +00:00
|
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
|
|
|
|
2017-05-26 09:02:48 +00:00
|
|
|
Execute(eslint.js executables should be run with node on Windows):
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
|
2017-05-26 09:02:48 +00:00
|
|
|
|
|
|
|
" We have to execute the file with node.
|
2019-04-07 13:58:06 +00:00
|
|
|
if has('win32')
|
|
|
|
AssertEqual
|
|
|
|
\ ale#Escape('node.exe') . ' '
|
|
|
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
2019-06-02 07:35:31 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s',
|
2019-04-07 13:58:06 +00:00
|
|
|
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
|
|
|
else
|
|
|
|
AssertEqual
|
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
2019-06-02 07:35:31 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s',
|
2019-04-07 13:58:06 +00:00
|
|
|
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
|
|
|
endif
|