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.
1 " Author: Chris Kyrouac - https://github.com/fijshion
2 " Description: jscs for JavaScript files
4 call ale#Set('javascript_jscs_executable', 'jscs')
5 call ale#Set('javascript_jscs_use_global', get(g:, 'ale_use_global_executables', 0))
7 function! ale_linters#javascript#jscs#GetCommand(buffer) abort
8 " Search for a local JShint config locaation, and default to a global one.
9 let l:jscs_config = ale#path#ResolveLocalPath(
12 \ get(g:, 'ale_jscs_config_loc', '')
15 let l:command = '%e --reporter inline --no-colors'
17 if !empty(l:jscs_config)
18 let l:command .= ' --config ' . ale#Escape(l:jscs_config)
26 function! ale_linters#javascript#jscs#Handle(buffer, lines) abort
27 " Matches patterns looking like the following
29 " foobar.js: line 2, col 1, Expected indentation of 1 characters
31 let l:pattern = '\v^.*:\s+line (\d+),\s+col\s+(\d+),\s+(.*)$'
34 for l:match in ale#util#GetMatches(a:lines, l:pattern)
36 \ 'lnum': l:match[1] + 0,
37 \ 'col': l:match[2] + 0,
41 let l:code_match = matchlist(l:match[3], '\v([^ :]+): (.+)$')
43 if !empty(l:code_match)
44 let l:obj.code = l:code_match[1]
45 let l:obj.text = l:code_match[2]
48 call add(l:output, l:obj)
54 call ale#linter#Define('javascript', {
56 \ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jscs', [
57 \ 'node_modules/.bin/jscs',
59 \ 'command': function('ale_linters#javascript#jscs#GetCommand'),
60 \ 'callback': 'ale_linters#javascript#jscs#Handle',