summaryrefslogtreecommitdiff
path: root/ale_linters/html/htmlhint.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/html/htmlhint.vim')
-rw-r--r--ale_linters/html/htmlhint.vim21
1 files changed, 17 insertions, 4 deletions
diff --git a/ale_linters/html/htmlhint.vim b/ale_linters/html/htmlhint.vim
index e142d22a..88a83f1d 100644
--- a/ale_linters/html/htmlhint.vim
+++ b/ale_linters/html/htmlhint.vim
@@ -1,7 +1,7 @@
" 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', '--format=unix')
+call ale#Set('html_htmlhint_options', '')
call ale#Set('html_htmlhint_executable', 'htmlhint')
call ale#Set('html_htmlhint_use_global', 0)
@@ -12,9 +12,22 @@ function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
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'
+ 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
+
+ return ale#Escape(ale_linters#html#htmlhint#GetExecutable(a:buffer))
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' --format=unix %t'
endfunction
call ale#linter#Define('html', {