mirror of
https://github.com/dense-analysis/ale
synced 2024-12-12 09:26:42 +00:00
2760cf7018
Previous implementation required one to have sass-lint globally. This allows you to have it locally, override the executable and add options.
29 lines
1.0 KiB
VimL
29 lines
1.0 KiB
VimL
" Author: sQVe - https://github.com/sQVe
|
|
|
|
call ale#Set('sass_sasslint_executable', 'sass-lint')
|
|
call ale#Set('sass_sasslint_options', '')
|
|
call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))
|
|
|
|
function! ale_linters#sass#sasslint#GetExecutable(buffer) abort
|
|
return ale#node#FindExecutable(a:buffer, 'sass_sasslint', [
|
|
\ 'node_modules/sass-lint/bin/sass-lint.js',
|
|
\ 'node_modules/.bin/sass-lint',
|
|
\])
|
|
endfunction
|
|
|
|
function! ale_linters#sass#sasslint#GetCommand(buffer) abort
|
|
let l:executable = ale_linters#sass#sasslint#GetExecutable(a:buffer)
|
|
let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
|
|
|
|
return ale#node#Executable(a:buffer, l:executable)
|
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
\ . ' -v -q -f compact %t'
|
|
endfunction
|
|
|
|
call ale#linter#Define('sass', {
|
|
\ 'name': 'sasslint',
|
|
\ 'executable_callback': 'ale_linters#sass#sasslint#GetExecutable',
|
|
\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand',
|
|
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
|
\})
|