diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-26 10:02:48 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-26 10:02:48 +0100 |
commit | 7fe1119cf1154480d8035a078ff06d6739892551 (patch) | |
tree | a7f22201a5e75336858e9c37f81b33e8752ad1fe /ale_linters/javascript/eslint.vim | |
parent | c89587785b6fc4cba844b7eda2dbd65d15185374 (diff) | |
download | ale-7fe1119cf1154480d8035a078ff06d6739892551.zip |
#576 Run the eslint.js file created by React with node on Windows
Diffstat (limited to 'ale_linters/javascript/eslint.vim')
-rw-r--r-- | ale_linters/javascript/eslint.vim | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim index acf17a4d..9f3bdcef 100644 --- a/ale_linters/javascript/eslint.vim +++ b/ale_linters/javascript/eslint.vim @@ -5,8 +5,20 @@ let g:ale_javascript_eslint_options = \ get(g:, 'ale_javascript_eslint_options', '') function! ale_linters#javascript#eslint#GetCommand(buffer) abort - return ale#handlers#eslint#GetExecutable(a:buffer) - \ . ' ' . ale#Var(a:buffer, 'javascript_eslint_options') + let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + + if ale#Has('win32') && l:executable =~? 'eslint\.js$' + " For Windows, if we detect an eslint.js script, we need to execute + " it with node, or the file can be opened with a text editor. + let l:head = 'node ' . ale#Escape(l:executable) + else + let l:head = ale#Escape(l:executable) + endif + + let l:options = ale#Var(a:buffer, 'javascript_eslint_options') + + return l:head + \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -f unix --stdin --stdin-filename %s' endfunction |