added importjs fixer

- added tests for fixer functions
- added docs
This commit is contained in:
Jeff Willette
2017-12-05 00:29:44 +09:00
parent 2f9869de44
commit fba3c57872
6 changed files with 74 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
" Author: Jeff Willette <jrwillette88@gmail.com>
" Description: Integration of importjs with ALE.
call ale#Set('js_importjs_executable', 'importjs')
function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
let l:result = ale#util#FuzzyJSONDecode(a:output, [])
return split(get(l:result, 'fileContent', ''), "\n")
endfunction
function! ale#fixers#importjs#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'js_importjs_executable')
if !executable(l:executable)
return 0
endif
return {
\ 'command': ale#Escape(l:executable)
\ . ' fix'
\ . ' %s',
\ 'process_with': 'ale#fixers#importjs#ProcessOutput',
\}
endfunction