standard.vim 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "============================================================================
  2. "File: standard.vim
  3. "Description: JavaScript syntax checker - using standard
  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_standard_checker')
  12. finish
  13. endif
  14. let g:loaded_syntastic_javascript_standard_checker = 1
  15. if !exists('g:syntastic_javascript_standard_generic')
  16. let g:syntastic_javascript_standard_generic = 0
  17. endif
  18. let s:save_cpo = &cpo
  19. set cpo&vim
  20. function! SyntaxCheckers_javascript_standard_IsAvailable() dict
  21. if g:syntastic_javascript_standard_generic
  22. call self.log('generic standard, exec =', self.getExec())
  23. endif
  24. if !executable(self.getExec())
  25. return 0
  26. endif
  27. return g:syntastic_javascript_standard_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
  28. endfunction
  29. function! SyntaxCheckers_javascript_standard_GetLocList() dict
  30. let makeprg = self.makeprgBuild({ 'args': '-v' })
  31. let errorformat = ' %f:%l:%c: %m'
  32. return SyntasticMake({
  33. \ 'makeprg': makeprg,
  34. \ 'errorformat': errorformat,
  35. \ 'subtype': 'Style',
  36. \ 'defaults': {'type': 'W'},
  37. \ 'returns': [0, 1] })
  38. endfunction
  39. call g:SyntasticRegistry.CreateAndRegisterChecker({
  40. \ 'filetype': 'javascript',
  41. \ 'name': 'standard'})
  42. let &cpo = s:save_cpo
  43. unlet s:save_cpo
  44. " vim: set sw=4 sts=4 et fdm=marker: