mirror of
1
0
Fork 0
ultimate-vim/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim

27 lines
899 B
VimL
Raw Normal View History

" Author: Mahmoud Mostafa <mah@moud.info>
" Description: Fixing files with stylelint.
call ale#Set('stylelint_executable', 'stylelint')
2018-06-14 06:31:12 -04:00
call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
2019-11-16 10:28:42 -05:00
call ale#Set('stylelint_options', '')
function! ale#fixers#stylelint#GetExecutable(buffer) abort
2021-05-31 16:30:26 -04:00
return ale#path#FindExecutable(a:buffer, 'stylelint', [
2019-03-08 06:04:56 -05:00
\ 'node_modules/stylelint/bin/stylelint.js',
\ 'node_modules/.bin/stylelint',
\])
endfunction
function! ale#fixers#stylelint#Fix(buffer) abort
let l:executable = ale#fixers#stylelint#GetExecutable(a:buffer)
2019-11-16 10:28:42 -05:00
let l:options = ale#Var(a:buffer, 'stylelint_options')
return {
2021-05-05 04:25:00 -04:00
\ 'cwd': '%s:h',
\ 'command': ale#node#Executable(a:buffer, l:executable)
2019-11-16 10:28:42 -05:00
\ . ale#Pad(l:options)
2021-05-05 04:25:00 -04:00
\ . ' --fix --stdin --stdin-filename %s',
\ 'read_temporary_file': 0,
\}
endfunction