mirror of
https://github.com/dense-analysis/ale
synced 2024-12-23 22:53:40 +00:00
70 lines
2.4 KiB
Plaintext
70 lines
2.4 KiB
Plaintext
Before:
|
|
let g:ale_javascript_eslint_executable = 'eslint_d'
|
|
|
|
call ale#test#SetDirectory('/testplugin/test')
|
|
|
|
runtime ale_linters/javascript/eslint.vim
|
|
|
|
After:
|
|
let g:ale_javascript_eslint_executable = 'eslint'
|
|
let g:ale_javascript_eslint_use_global = 0
|
|
|
|
call ale#test#RestoreDirectory()
|
|
call ale#linter#Reset()
|
|
|
|
Execute(create-react-app directories should be detected correctly):
|
|
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
|
|
|
|
AssertEqual
|
|
\ ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'),
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
|
|
|
Execute(use-global should override create-react-app detection):
|
|
let g:ale_javascript_eslint_use_global = 1
|
|
|
|
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
|
|
|
|
AssertEqual
|
|
\ 'eslint_d',
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
|
|
|
Execute(other app directories should be detected correctly):
|
|
call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js')
|
|
|
|
AssertEqual
|
|
\ ale#path#Simplify(g:dir . '/eslint-test-files/node_modules/.bin/eslint'),
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
|
|
|
Execute(use-global should override other app directories):
|
|
let g:ale_javascript_eslint_use_global = 1
|
|
|
|
call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js')
|
|
|
|
AssertEqual
|
|
\ 'eslint_d',
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
|
|
|
Execute(eslint_d should be detected correctly):
|
|
call ale#test#SetFilename('eslint-test-files/app-with-eslint-d/testfile.js')
|
|
|
|
AssertEqual
|
|
\ ale#path#Simplify(g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'),
|
|
\ ale#handlers#eslint#GetExecutable(bufnr(''))
|
|
|
|
Execute(eslint.js executables should be run with node on Windows):
|
|
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
|
|
|
|
" We have to execute the file with node.
|
|
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'))
|
|
\ . ' -f json --stdin --stdin-filename %s',
|
|
\ 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'))
|
|
\ . ' -f json --stdin --stdin-filename %s',
|
|
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
|
endif
|