Fix #178 - Check Stylus files with stylelint

This commit is contained in:
w0rp 2017-07-03 16:57:39 +01:00
parent 160b9548ee
commit 84b280b881
4 changed files with 61 additions and 0 deletions

View file

@ -113,6 +113,7 @@ name. That seems to be the fairest way to arrange this table.
| Scala | [scalac](http://scala-lang.org) | | Scala | [scalac](http://scala-lang.org) |
| Slim | [slim-lint](https://github.com/sds/slim-lint) | Slim | [slim-lint](https://github.com/sds/slim-lint)
| SML | [smlnj](http://www.smlnj.org/) | | SML | [smlnj](http://www.smlnj.org/) |
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
| SQL | [sqlint](https://github.com/purcell/sqlint) | | SQL | [sqlint](https://github.com/purcell/sqlint) |
| Swift | [swiftlint](https://swift.org/) | | Swift | [swiftlint](https://swift.org/) |
| Texinfo | [proselint](http://proselint.com/)| | Texinfo | [proselint](http://proselint.com/)|

View file

@ -0,0 +1,24 @@
" Author: diartyz <diartyz@gmail.com>, w0rp <devw0rp@gmail.com>
call ale#Set('stylus_stylelint_executable', 'stylelint')
call ale#Set('stylus_stylelint_options', '')
call ale#Set('stylus_stylelint_use_global', 0)
function! ale_linters#stylus#stylelint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'stylus_stylelint', [
\ 'node_modules/.bin/stylelint',
\])
endfunction
function! ale_linters#stylus#stylelint#GetCommand(buffer) abort
return ale_linters#stylus#stylelint#GetExecutable(a:buffer)
\ . ' ' . ale#Var(a:buffer, 'stylus_stylelint_options')
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('stylus', {
\ 'name': 'stylelint',
\ 'executable_callback': 'ale_linters#stylus#stylelint#GetExecutable',
\ 'command_callback': 'ale_linters#stylus#stylelint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
\})

33
doc/ale-stylus.txt Normal file
View file

@ -0,0 +1,33 @@
===============================================================================
ALE CSS Integration *ale-stylus-options*
-------------------------------------------------------------------------------
stylelint *ale-stylus-stylelint*
g:ale_stylus_stylelint_executable *g:ale_stylus_stylelint_executable*
*b:ale_stylus_stylelint_executable*
Type: |String|
Default: `'stylelint'`
See |ale-integrations-local-executables|
g:ale_stylus_stylelint_options *g:ale_stylus_stylelint_options*
*b:ale_stylus_stylelint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to stylelint.
g:ale_stylus_stylelint_use_global *g:ale_stylus_stylelint_use_global*
*b:ale_stylus_stylelint_use_global*
Type: |String|
Default: `0`
See |ale-integrations-local-executables|
-------------------------------------------------------------------------------
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -96,6 +96,8 @@ CONTENTS *ale-contents*
shellcheck..........................|ale-sh-shellcheck| shellcheck..........................|ale-sh-shellcheck|
spec..................................|ale-spec-options| spec..................................|ale-spec-options|
rpmlint.............................|ale-spec-rpmlint| rpmlint.............................|ale-spec-rpmlint|
stylus................................|ale-stylus-options|
stylelint...........................|ale-stylus-stylelint|
tex...................................|ale-tex-options| tex...................................|ale-tex-options|
chktex..............................|ale-tex-chktex| chktex..............................|ale-tex-chktex|
lacheck.............................|ale-tex-lacheck| lacheck.............................|ale-tex-lacheck|
@ -202,6 +204,7 @@ The following languages and tools are supported.
* Scala: 'scalac' * Scala: 'scalac'
* Slim: 'slim-lint' * Slim: 'slim-lint'
* SML: 'smlnj' * SML: 'smlnj'
* Stylus: 'stylelint'
* SQL: 'sqlint' * SQL: 'sqlint'
* Swift: 'swiftlint' * Swift: 'swiftlint'
* Texinfo: 'proselint' * Texinfo: 'proselint'