stylelint.vim 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. "============================================================================
  2. "File: stylelint.vim
  3. "Description: Syntax checking plugin for syntastic.vim using `stylelint`
  4. " (https://github.com/stylelint/stylelint).
  5. "Maintainer: Tim Carry <tim at pixelastic dot com>
  6. "License: This program is free software. It comes without any warranty,
  7. " to the extent permitted by applicable law. You can redistribute
  8. " it and/or modify it under the terms of the Do What The Fuck You
  9. " Want To Public License, Version 2, as published by Sam Hocevar.
  10. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  11. "
  12. "============================================================================
  13. if exists('g:loaded_syntastic_css_stylelint_checker')
  14. finish
  15. endif
  16. let g:loaded_syntastic_css_stylelint_checker = 1
  17. let s:save_cpo = &cpo
  18. set cpo&vim
  19. let s:args_after = {
  20. \ 'css': '-f json',
  21. \ 'scss': '-f json -s scss' }
  22. function! SyntaxCheckers_css_stylelint_GetLocList() dict
  23. let makeprg = self.makeprgBuild({ 'args_after': get(s:args_after, self.getFiletype(), '') })
  24. let errorformat = '%t:%f:%l:%c:%m'
  25. return SyntasticMake({
  26. \ 'makeprg': makeprg,
  27. \ 'errorformat': errorformat,
  28. \ 'subtype': 'Style',
  29. \ 'preprocess': 'stylelint',
  30. \ 'returns': [0, 1, 2] })
  31. endfunction
  32. call g:SyntasticRegistry.CreateAndRegisterChecker({
  33. \ 'filetype': 'css',
  34. \ 'name': 'stylelint'})
  35. let &cpo = s:save_cpo
  36. unlet s:save_cpo
  37. " vim: set sw=4 sts=4 et fdm=marker: