jscs.vim 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "============================================================================
  2. "File: jscs.vim
  3. "Description: Javascript syntax checker - using jscs
  4. "Maintainer: LCD 47 <lcd047@gmail.com>
  5. "License: This program is free software. It comes without any warranty,
  6. " to the extent permitted by applicable law. You can redistribute
  7. " it and/or modify it under the terms of the Do What The Fuck You
  8. " Want To Public License, Version 2, as published by Sam Hocevar.
  9. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  10. "============================================================================
  11. if exists('g:loaded_syntastic_javascript_jscs_checker')
  12. finish
  13. endif
  14. let g:loaded_syntastic_javascript_jscs_checker = 1
  15. if !exists('g:syntastic_javascript_jscs_sort')
  16. let g:syntastic_javascript_jscs_sort = 1
  17. endif
  18. let s:save_cpo = &cpo
  19. set cpo&vim
  20. function! SyntaxCheckers_javascript_jscs_IsAvailable() dict
  21. if !executable(self.getExec())
  22. return 0
  23. endif
  24. return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 1])
  25. endfunction
  26. function! SyntaxCheckers_javascript_jscs_GetLocList() dict
  27. let makeprg = self.makeprgBuild({
  28. \ 'args_after': '--no-colors --max-errors -1 --reporter json' })
  29. let errorformat = '%f:%l:%c:%m'
  30. return SyntasticMake({
  31. \ 'makeprg': makeprg,
  32. \ 'errorformat': errorformat,
  33. \ 'subtype': 'Style',
  34. \ 'preprocess': 'jscs',
  35. \ 'defaults': {'type': 'E'},
  36. \ 'returns': [0, 2] })
  37. endfunction
  38. call g:SyntasticRegistry.CreateAndRegisterChecker({
  39. \ 'filetype': 'javascript',
  40. \ 'name': 'jscs'})
  41. let &cpo = s:save_cpo
  42. unlet s:save_cpo
  43. " vim: set sw=4 sts=4 et fdm=marker: