summaryrefslogtreecommitdiff
path: root/ale_linters/javascript/standard.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-26 18:11:27 +0100
committerw0rp <devw0rp@gmail.com>2017-08-26 18:11:27 +0100
commit908e94622ecb3df49a6a16fb3e47227764672be5 (patch)
tree27c0dbf9bd274b892eb7cbec13afa7f9dfea15a7 /ale_linters/javascript/standard.vim
parentb9cf450684fda2a10dcc65bb09ef11b10469363f (diff)
downloadale-908e94622ecb3df49a6a16fb3e47227764672be5.zip
#868 - Prefer cmd.js files for executing standard
Diffstat (limited to 'ale_linters/javascript/standard.vim')
-rw-r--r--ale_linters/javascript/standard.vim16
1 files changed, 14 insertions, 2 deletions
diff --git a/ale_linters/javascript/standard.vim b/ale_linters/javascript/standard.vim
index 15e6d78f..fc534ebb 100644
--- a/ale_linters/javascript/standard.vim
+++ b/ale_linters/javascript/standard.vim
@@ -7,13 +7,25 @@ call ale#Set('javascript_standard_options', '')
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
+ \ 'node_modules/standard/bin/cmd.js',
\ 'node_modules/.bin/standard',
\])
endfunction
function! ale_linters#javascript#standard#GetCommand(buffer) abort
- return ale#Escape(ale_linters#javascript#standard#GetExecutable(a:buffer))
- \ . ' ' . ale#Var(a:buffer, 'javascript_standard_options')
+ let l:executable = ale_linters#javascript#standard#GetExecutable(a:buffer)
+
+ if ale#Has('win32') && l:executable =~? '\.js$'
+ " .js files have to be executed with Node on Windows.
+ 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_standard_options')
+
+ return l:head
+ \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --stdin %s'
endfunction