From 217284360d35711b751859ed27a7a3c3da300e85 Mon Sep 17 00:00:00 2001 From: w0rp Date: Thu, 2 Aug 2018 23:44:12 +0100 Subject: Simplify the code for most linters and tests with closures --- ale_linters/javascript/jshint.vim | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'ale_linters/javascript/jshint.vim') diff --git a/ale_linters/javascript/jshint.vim b/ale_linters/javascript/jshint.vim index 2e9bb9fd..83909fa4 100644 --- a/ale_linters/javascript/jshint.vim +++ b/ale_linters/javascript/jshint.vim @@ -4,12 +4,6 @@ call ale#Set('javascript_jshint_executable', 'jshint') call ale#Set('javascript_jshint_use_global', get(g:, 'ale_use_global_executables', 0)) -function! ale_linters#javascript#jshint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_jshint', [ - \ 'node_modules/.bin/jshint', - \]) -endfunction - function! ale_linters#javascript#jshint#GetCommand(buffer) abort " Search for a local JShint config locaation, and default to a global one. let l:jshint_config = ale#path#ResolveLocalPath( @@ -18,8 +12,7 @@ function! ale_linters#javascript#jshint#GetCommand(buffer) abort \ get(g:, 'ale_jshint_config_loc', '') \) - let l:command = ale#Escape(ale_linters#javascript#jshint#GetExecutable(a:buffer)) - let l:command .= ' --reporter unix --extract auto' + let l:command = '%e --reporter unix --extract auto' if !empty(l:jshint_config) let l:command .= ' --config ' . ale#Escape(l:jshint_config) @@ -32,7 +25,9 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'jshint', -\ 'executable_callback': 'ale_linters#javascript#jshint#GetExecutable', +\ 'executable_callback': ale#node#FindExecutableFunc('javascript_jshint', [ +\ 'node_modules/.bin/jshint', +\ ]), \ 'command_callback': 'ale_linters#javascript#jshint#GetCommand', \ 'callback': 'ale#handlers#unix#HandleAsError', \}) -- cgit v1.2.3 From f75848b32ca25aec1d5e6c0a5aa9c7b1e6c64539 Mon Sep 17 00:00:00 2001 From: James Owen Date: Wed, 31 Oct 2018 10:17:55 +0100 Subject: Pass the filename of the current file into jshint --- ale_linters/javascript/jshint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ale_linters/javascript/jshint.vim') diff --git a/ale_linters/javascript/jshint.vim b/ale_linters/javascript/jshint.vim index 83909fa4..cb7f66fc 100644 --- a/ale_linters/javascript/jshint.vim +++ b/ale_linters/javascript/jshint.vim @@ -18,7 +18,7 @@ function! ale_linters#javascript#jshint#GetCommand(buffer) abort let l:command .= ' --config ' . ale#Escape(l:jshint_config) endif - let l:command .= ' -' + let l:command .= ' --filename %s -' return l:command endfunction -- cgit v1.2.3