summaryrefslogtreecommitdiff
path: root/ale_linters/scss/sasslint.vim
blob: 8b725ba65859842496105e2dec81287d1ebfdbd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
" Author: sQVe - https://github.com/sQVe

call ale#Set('scss_sasslint_executable', 'sass-lint')
call ale#Set('scss_sasslint_options', '')
call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))

function! ale_linters#scss#sasslint#GetExecutable(buffer) abort
    return ale#node#FindExecutable(a:buffer, 'scss_sasslint', [
    \   'node_modules/sass-lint/bin/sass-lint.js',
    \   'node_modules/.bin/sass-lint',
    \])
endfunction

function! ale_linters#scss#sasslint#GetCommand(buffer) abort
    let l:executable = ale_linters#scss#sasslint#GetExecutable(a:buffer)
    let l:options = ale#Var(a:buffer, 'scss_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('scss', {
\   'name': 'sasslint',
\   'executable_callback': 'ale_linters#scss#sasslint#GetExecutable',
\   'command_callback': 'ale_linters#scss#sasslint#GetCommand',
\   'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})