From 7fe1119cf1154480d8035a078ff06d6739892551 Mon Sep 17 00:00:00 2001 From: w0rp Date: Fri, 26 May 2017 10:02:48 +0100 Subject: #576 Run the eslint.js file created by React with node on Windows --- ale_linters/javascript/eslint.vim | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'ale_linters') 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 -- cgit v1.2.3