mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
[enhancement] add node_modules support for stylelint & htmlhint (#226)
* Add node_modules support for stylelint * add node_modules support for htmlhint * fix stdin * update doc about stylelint & htmlhint
This commit is contained in:
@@ -1,12 +1,36 @@
|
||||
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>
|
||||
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
|
||||
" Description: HTMLHint for checking html files
|
||||
|
||||
" CLI options
|
||||
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 g:ale_html_htmlhint_use_global
|
||||
return g:ale_html_htmlhint_executable
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/htmlhint',
|
||||
\ g:ale_html_htmlhint_executable
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
|
||||
return g:ale#util#stdin_wrapper . ' .html '
|
||||
\ . ale_linters#html#htmlhint#GetExecutable(a:buffer)
|
||||
\ . ' ' . g:ale_html_htmlhint_options
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'htmlhint',
|
||||
\ 'executable': 'htmlhint',
|
||||
\ 'command': 'htmlhint ' . g:ale_html_htmlhint_options . ' stdin',
|
||||
\ 'executable_callback': 'ale_linters#html#htmlhint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#html#htmlhint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\})
|
||||
|
||||
Reference in New Issue
Block a user