Support options when using Stylelint with SCSS

Complement missing documentation
This commit is contained in:
jpsouzasilva 2018-09-13 08:51:33 -03:00
parent 78af99c256
commit 5901e1a879
2 changed files with 13 additions and 1 deletions

View File

@ -1,13 +1,19 @@
" Author: diartyz <diartyz@gmail.com> " Author: diartyz <diartyz@gmail.com>
call ale#Set('scss_stylelint_executable', 'stylelint') call ale#Set('scss_stylelint_executable', 'stylelint')
call ale#Set('scss_stylelint_options', '')
call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('scss', { call ale#linter#Define('scss', {
\ 'name': 'stylelint', \ 'name': 'stylelint',
\ 'executable_callback': ale#node#FindExecutableFunc('scss_stylelint', [ \ 'executable_callback': ale#node#FindExecutableFunc('scss_stylelint', [
\ 'node_modules/.bin/stylelint', \ 'node_modules/.bin/stylelint',
\ ]), \ ]),
\ 'command': '%e --stdin-filename %s', \ 'command_callback': 'ale_linters#scss#stylelint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
\}) \})

View File

@ -18,6 +18,12 @@ g:ale_scss_stylelint_executable *g:ale_scss_stylelint_executable*
See |ale-integrations-local-executables| See |ale-integrations-local-executables|
g:ale_scss_stylelint_options *g:ale_scss_stylelint_options*
*b:ale_scss_stylelint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to stylelint.
g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global* g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global*
*b:ale_scss_stylelint_use_global* *b:ale_scss_stylelint_use_global*