Run sass-lint from the target's directory
This commit is contained in:
parent
38c66d33fe
commit
8a1099bb59
@ -1,8 +1,18 @@
|
|||||||
" Author: KabbAmine - https://github.com/KabbAmine
|
" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
|
||||||
|
" <ben@falconers.me.uk>
|
||||||
|
|
||||||
|
function! ale_linters#sass#sasslint#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . ale#Escape('sass-lint')
|
||||||
|
\ . ' -v'
|
||||||
|
\ . ' -q'
|
||||||
|
\ . ' -f compact'
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('sass', {
|
call ale#linter#Define('sass', {
|
||||||
\ 'name': 'sasslint',
|
\ 'name': 'sasslint',
|
||||||
\ 'executable': 'sass-lint',
|
\ 'executable': 'sass-lint',
|
||||||
\ 'command': 'sass-lint -v -q -f compact %t',
|
\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||||
\})
|
\})
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
" Author: KabbAmine - https://github.com/KabbAmine
|
" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
|
||||||
|
" <ben@falconers.me.uk>
|
||||||
|
|
||||||
|
function! ale_linters#scss#sasslint#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . ale#Escape('sass-lint')
|
||||||
|
\ . ' -v'
|
||||||
|
\ . ' -q'
|
||||||
|
\ . ' -f compact'
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('scss', {
|
call ale#linter#Define('scss', {
|
||||||
\ 'name': 'sasslint',
|
\ 'name': 'sasslint',
|
||||||
\ 'executable': 'sass-lint',
|
\ 'executable': 'sass-lint',
|
||||||
\ 'command': 'sass-lint -v -q -f compact %t',
|
\ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||||
\})
|
\})
|
||||||
|
17
test/command_callback/test_sasslint_command_callback.vader
Normal file
17
test/command_callback/test_sasslint_command_callback.vader
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Before:
|
||||||
|
runtime ale_linters/sass/sasslint.vim
|
||||||
|
|
||||||
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||||
|
call ale#test#SetFilename('test.sass')
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
call ale#test#RestoreDirectory()
|
||||||
|
call ale#linter#Reset()
|
||||||
|
|
||||||
|
Execute(The default sasslint command should be correct):
|
||||||
|
AssertEqual
|
||||||
|
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||||
|
\ . ale#Escape('sass-lint') . ' -v -q -f compact %t',
|
||||||
|
\ ale_linters#sass#sasslint#GetCommand(bufnr(''))
|
Loading…
Reference in New Issue
Block a user