mirror of
https://github.com/dense-analysis/ale
synced 2024-12-11 17:06:52 +00:00
6c0996eb9c
* Add node_modules support for stylelint * add node_modules support for htmlhint * fix stdin * update doc about stylelint & htmlhint
32 lines
962 B
VimL
32 lines
962 B
VimL
" Author: diartyz <diartyz@gmail.com>
|
|
|
|
let g:ale_sass_stylelint_executable =
|
|
\ get(g:, 'ale_sass_stylelint_executable', 'stylelint')
|
|
|
|
let g:ale_sass_stylelint_use_global =
|
|
\ get(g:, 'ale_sass_stylelint_use_global', 0)
|
|
|
|
function! ale_linters#sass#stylelint#GetExecutable(buffer) abort
|
|
if g:ale_sass_stylelint_use_global
|
|
return g:ale_sass_stylelint_executable
|
|
endif
|
|
|
|
return ale#util#ResolveLocalPath(
|
|
\ a:buffer,
|
|
\ 'node_modules/.bin/stylelint',
|
|
\ g:ale_sass_stylelint_executable
|
|
\)
|
|
endfunction
|
|
|
|
function! ale_linters#sass#stylelint#GetCommand(buffer) abort
|
|
return ale_linters#sass#stylelint#GetExecutable(a:buffer)
|
|
\ . ' --stdin-filename %s'
|
|
endfunction
|
|
|
|
call ale#linter#Define('sass', {
|
|
\ 'name': 'stylelint',
|
|
\ 'executable_callback': 'ale_linters#sass#stylelint#GetExecutable',
|
|
\ 'command_callback': 'ale_linters#sass#stylelint#GetCommand',
|
|
\ 'callback': 'ale#handlers#HandleStyleLintFormat',
|
|
\})
|