jshint.vim 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "============================================================================
  2. "File: jshint.vim
  3. "Description: Javascript syntax checker for HTML - using jshint
  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_html_jshint_checker')
  12. finish
  13. endif
  14. let g:loaded_syntastic_html_jshint_checker = 1
  15. let s:save_cpo = &cpo
  16. set cpo&vim
  17. function! SyntaxCheckers_html_jshint_IsAvailable() dict
  18. call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec')
  19. if !executable(self.getExec())
  20. return 0
  21. endif
  22. return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 4])
  23. endfunction
  24. function! SyntaxCheckers_html_jshint_GetLocList() dict
  25. call syntastic#log#deprecationWarn('html_jshint_conf', 'html_jshint_args',
  26. \ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
  27. let makeprg = self.makeprgBuild({ 'args_after': '--verbose --extract always' })
  28. let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)'
  29. return SyntasticMake({
  30. \ 'makeprg': makeprg,
  31. \ 'errorformat': errorformat,
  32. \ 'defaults': {'bufnr': bufnr('')},
  33. \ 'returns': [0, 2] })
  34. endfunction
  35. call g:SyntasticRegistry.CreateAndRegisterChecker({
  36. \ 'filetype': 'html',
  37. \ 'name': 'jshint'})
  38. let &cpo = s:save_cpo
  39. unlet s:save_cpo
  40. " vim: set sw=4 sts=4 et fdm=marker: