]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/javascript/jshint.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '56df844d3c39ec494dacc69eae34272b27db185a' as '.vim/bundle/asyncomplete'
[etc/vim.git] / .vim / bundle / ale / ale_linters / javascript / jshint.vim
1 " Author: Chris Kyrouac - https://github.com/fijshion
2 " Description: JSHint for Javascript files
3
4 call ale#Set('javascript_jshint_executable', 'jshint')
5 call ale#Set('javascript_jshint_use_global', get(g:, 'ale_use_global_executables', 0))
6
7 function! ale_linters#javascript#jshint#GetCommand(buffer) abort
8     " Search for a local JShint config locaation, and default to a global one.
9     let l:jshint_config = ale#path#ResolveLocalPath(
10     \   a:buffer,
11     \   '.jshintrc',
12     \   get(g:, 'ale_jshint_config_loc', '')
13     \)
14
15     let l:command = '%e --reporter unix --extract auto'
16
17     if !empty(l:jshint_config)
18         let l:command .= ' --config ' . ale#Escape(l:jshint_config)
19     endif
20
21     let l:command .= ' --filename %s -'
22
23     return l:command
24 endfunction
25
26 call ale#linter#Define('javascript', {
27 \   'name': 'jshint',
28 \   'executable': {b -> ale#path#FindExecutable(b, 'javascript_jshint', [
29 \       'node_modules/.bin/jshint',
30 \   ])},
31 \   'command': function('ale_linters#javascript#jshint#GetCommand'),
32 \   'callback': 'ale#handlers#unix#HandleAsError',
33 \})