From 0680f875fe9ef07daceb3e9a90224bee613730df Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 10 Oct 2016 19:07:01 +0100 Subject: [PATCH] Add an option for configuring the path for JSHint. --- ale_linters/javascript/jshint.vim | 9 ++++++--- doc/ale.txt | 11 +++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ale_linters/javascript/jshint.vim b/ale_linters/javascript/jshint.vim index 577e5c1..a020ca0 100644 --- a/ale_linters/javascript/jshint.vim +++ b/ale_linters/javascript/jshint.vim @@ -7,6 +7,9 @@ endif let g:loaded_ale_linters_javascript_jshint = 1 +let g:ale_javascript_jshint_executable = +\ get(g:, 'ale_javascript_jshint_executable', 'jshint') + function! ale_linters#javascript#jshint#GetCommand(buffer) " Set this to the location of the jshint configuration file to " use a fixed location for .jshintrc @@ -17,7 +20,7 @@ function! ale_linters#javascript#jshint#GetCommand(buffer) let jshint_config = ale#util#FindNearestFile(a:buffer, '.jshintrc') endif - let command = 'jshint --reporter unix' + let command = g:ale_javascript_jshint_executable . ' --reporter unix' if !empty(jshint_config) let command .= ' --config ' . fnameescape(jshint_config) @@ -69,14 +72,14 @@ endfunction call ALEAddLinter('javascript', { \ 'name': 'jshint', -\ 'executable': 'jshint', +\ 'executable': g:ale_javascript_jshint_executable, \ 'command_callback': 'ale_linters#javascript#jshint#GetCommand', \ 'callback': 'ale_linters#javascript#jshint#Handle', \}) call ALEAddLinter('javascript.jsx', { \ 'name': 'jshint', -\ 'executable': 'jshint', +\ 'executable': g:ale_javascript_jshint_executable, \ 'command_callback': 'ale_linters#javascript#jshint#GetCommand', \ 'callback': 'ale_linters#javascript#jshint#Handle', \}) diff --git a/doc/ale.txt b/doc/ale.txt index d52f8d7..bfe3cd8 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -17,6 +17,7 @@ CONTENTS *ale-contents* 4.5. shell..................................|ale-linter-options-shell| 4.6. fortran-gcc............................|ale-linter-options-fortran-gcc| 4.7. html-tidy..............................|ale-linter-options-html-tidy| + 4.8. jshint.................................|ale-linter-options-jshint| 5. API........................................|ale-api| 6. Contact....................................|ale-contact| @@ -399,6 +400,16 @@ g:ale_html_tidy_args *g:ale_html_tidy_args* (mac), sjis (shiftjis), utf-16le, utf-16, utf-8 +------------------------------------------------------------------------------- +4.8. jshint *ale-linter-options-jshint* + +g:ale_javascript_jshint_executable *g:ale_javascript_jshint_executable* + + Type: |String| + Default: `'jshint'` + + This variable can be changed to change the path to jshint. + =============================================================================== 5. API *ale-api*