diff --git a/README.md b/README.md index b875ad4c..e94c1cfa 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ name. That seems to be the fairest way to arrange this table. | Scala | [scalac](http://scala-lang.org) | | Slim | [slim-lint](https://github.com/sds/slim-lint) | SML | [smlnj](http://www.smlnj.org/) | +| Stylus | [stylelint](https://github.com/stylelint/stylelint) | | SQL | [sqlint](https://github.com/purcell/sqlint) | | Swift | [swiftlint](https://swift.org/) | | Texinfo | [proselint](http://proselint.com/)| diff --git a/ale_linters/stylus/stylelint.vim b/ale_linters/stylus/stylelint.vim new file mode 100644 index 00000000..2721529b --- /dev/null +++ b/ale_linters/stylus/stylelint.vim @@ -0,0 +1,24 @@ +" Author: diartyz , w0rp + +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', +\}) diff --git a/doc/ale-stylus.txt b/doc/ale-stylus.txt new file mode 100644 index 00000000..ac333358 --- /dev/null +++ b/doc/ale-stylus.txt @@ -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: diff --git a/doc/ale.txt b/doc/ale.txt index d9c989be..ad32619a 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -96,6 +96,8 @@ CONTENTS *ale-contents* shellcheck..........................|ale-sh-shellcheck| spec..................................|ale-spec-options| rpmlint.............................|ale-spec-rpmlint| + stylus................................|ale-stylus-options| + stylelint...........................|ale-stylus-stylelint| tex...................................|ale-tex-options| chktex..............................|ale-tex-chktex| lacheck.............................|ale-tex-lacheck| @@ -202,6 +204,7 @@ The following languages and tools are supported. * Scala: 'scalac' * Slim: 'slim-lint' * SML: 'smlnj' +* Stylus: 'stylelint' * SQL: 'sqlint' * Swift: 'swiftlint' * Texinfo: 'proselint'