ale/ale_linters/html/htmlhint.vim

33 lines
1.2 KiB
VimL
Raw Normal View History

" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
2016-10-08 15:01:03 +00:00
" Description: HTMLHint for checking html files
2016-10-27 15:31:49 +00:00
" CLI options
2017-04-16 19:44:15 +00:00
let g:ale_html_htmlhint_options = get(g:, 'ale_html_htmlhint_options', '--format=unix')
let g:ale_html_htmlhint_executable = get(g:, 'ale_html_htmlhint_executable', 'htmlhint')
let g:ale_html_htmlhint_use_global = get(g:, 'ale_html_htmlhint_use_global', 0)
function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
if ale#Var(a:buffer, 'html_htmlhint_use_global')
return ale#Var(a:buffer, 'html_htmlhint_executable')
endif
2017-04-17 22:29:02 +00:00
return ale#path#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/htmlhint',
\ ale#Var(a:buffer, 'html_htmlhint_executable')
\)
endfunction
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
return ale_linters#html#htmlhint#GetExecutable(a:buffer)
\ . ' ' . ale#Var(a:buffer, 'html_htmlhint_options')
\ . ' %t'
endfunction
call ale#linter#Define('html', {
2016-10-08 15:01:03 +00:00
\ 'name': 'htmlhint',
\ 'executable_callback': 'ale_linters#html#htmlhint#GetExecutable',
\ 'command_callback': 'ale_linters#html#htmlhint#GetCommand',
2016-10-11 14:22:47 +00:00
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
2016-10-08 15:01:03 +00:00
\})