1
0
Fork 0
mirror of synced 2024-11-10 11:18:58 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/html/htmlhint.vim

33 lines
1.1 KiB
VimL
Raw Normal View History

" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
" Description: HTMLHint for checking html files
call ale#Set('html_htmlhint_options', '')
call ale#Set('html_htmlhint_executable', 'htmlhint')
2018-06-14 06:31:12 -04:00
call ale#Set('html_htmlhint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'html_htmlhint_options')
let l:config = l:options !~# '--config'
\ ? ale#path#FindNearestFile(a:buffer, '.htmlhintrc')
\ : ''
if !empty(l:config)
let l:options .= ' --config ' . ale#Escape(l:config)
endif
if !empty(l:options)
let l:options = substitute(l:options, '--format=unix', '', '')
endif
2018-08-25 12:13:42 -04:00
return '%e' . ale#Pad(l:options) . ' --format=unix %t'
endfunction
call ale#linter#Define('html', {
\ 'name': 'htmlhint',
2019-03-08 06:04:56 -05:00
\ 'executable': {b -> ale#node#FindExecutable(b, 'html_htmlhint', [
2018-08-25 12:13:42 -04:00
\ 'node_modules/.bin/htmlhint',
2019-03-08 06:04:56 -05:00
\ ])},
\ 'command': function('ale_linters#html#htmlhint#GetCommand'),
\ 'callback': 'ale#handlers#unix#HandleAsError',
\})