diff options
Diffstat (limited to 'vim/bundle/syntastic/syntax_checkers/javascript')
12 files changed, 683 insertions, 0 deletions
| diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/closurecompiler.vim b/vim/bundle/syntastic/syntax_checkers/javascript/closurecompiler.vim new file mode 100644 index 0000000..8c4190a --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/closurecompiler.vim @@ -0,0 +1,76 @@ +"============================================================================ +"File:        closurecompiler.vim +"Description: Javascript syntax checker - using Google Closure Compiler +"Maintainer:  Motohiro Takayama <mootoh at gmail dot com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_closurecompiler_checker') +    finish +endif +let g:loaded_syntastic_javascript_closurecompiler_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict +    call syntastic#log#deprecationWarn('javascript_closure_compiler_path', 'javascript_closurecompiler_path') + +    if !executable(self.getExec()) +        return 0 +    endif + +    let s:has_script = exists('g:syntastic_javascript_closurecompiler_script') +    if s:has_script +        return 1 +    endif + +    let cp = get(g:, 'syntastic_javascript_closurecompiler_path', '') +    call self.log('g:syntastic_javascript_closurecompiler_path =', cp) + +    let jar = expand(cp, 1) +    call self.log('filereadable(' . string(jar) . ') = ' . filereadable(jar)) + +    return filereadable(jar) +endfunction + +function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict +    call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args') +    call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list') + +    let flist = expand(get(g:, 'syntastic_javascript_closurecompiler_file_list', ''), 1) +    if filereadable(flist) +        let file_list = map( readfile(flist), 'expand(v:var, 1)' ) +    else +        let file_list = [expand('%', 1)] +    endif + +    let makeprg = self.makeprgBuild({ +        \ 'exe_after': (s:has_script ? [] : ['-jar', expand(g:syntastic_javascript_closurecompiler_path, 1)]), +        \ 'args_after': '--js', +        \ 'fname': file_list }) + +    let errorformat = +        \ '%-GOK,'. +        \ '%E%f:%l: ERROR - %m,'. +        \ '%W%f:%l: WARNING - %m,'. +        \ '%Z%p^' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'closurecompiler', +    \ 'exec': get(g:, 'syntastic_javascript_closurecompiler_script', 'java')}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/eslint.vim b/vim/bundle/syntastic/syntax_checkers/javascript/eslint.vim new file mode 100644 index 0000000..437bc55 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/eslint.vim @@ -0,0 +1,78 @@ +"============================================================================ +"File:        eslint.vim +"Description: Javascript syntax checker - using eslint +"Maintainer:  Maksim Ryzhikov <rv.maksim at gmail dot com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_eslint_checker') +    finish +endif +let g:loaded_syntastic_javascript_eslint_checker = 1 + +if !exists('g:syntastic_javascript_eslint_sort') +    let g:syntastic_javascript_eslint_sort = 1 +endif + +if !exists('g:syntastic_javascript_eslint_generic') +    let g:syntastic_javascript_eslint_generic = 0 +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_eslint_IsAvailable() dict +    if g:syntastic_javascript_eslint_generic +        call self.log('generic eslint, exec =', self.getExec()) +    endif + +    if !executable(self.getExec()) +        return 0 +    endif +    return g:syntastic_javascript_eslint_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1]) +endfunction + +function! SyntaxCheckers_javascript_eslint_GetLocList() dict +    if !g:syntastic_javascript_eslint_generic +        call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args', +            \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") +    endif + +    let makeprg = self.makeprgBuild({ 'args_before': (g:syntastic_javascript_eslint_generic ? '' : '-f compact') }) + +    let errorformat = +        \ '%E%f: line %l\, col %c\, Error - %m,' . +        \ '%W%f: line %l\, col %c\, Warning - %m' + +    let loclist = SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'postprocess': ['guards'] }) + +    if !g:syntastic_javascript_eslint_generic +        if !exists('s:eslint_new') +            let s:eslint_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1]) +        endif + +        if !s:eslint_new +            for e in loclist +                let e['col'] += 1 +            endfor +        endif +    endif + +    return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'eslint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/flow.vim b/vim/bundle/syntastic/syntax_checkers/javascript/flow.vim new file mode 100644 index 0000000..13ee47a --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/flow.vim @@ -0,0 +1,67 @@ +"============================================================================ +"File:        flow.vim +"Description: Javascript syntax checker - using flow +"Maintainer:  Michael Robinson <mike@pagesofinterest.net> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_flow_checker') +    finish +endif +let g:loaded_syntastic_javascript_flow_checker = 1 + +if !exists('g:syntastic_javascript_flow_sort') +    let g:syntastic_javascript_flow_sort = 1 +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_flow_IsAvailable() dict +    if !executable(self.getExec()) +        return 0 +    endif +    return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 6]) +endfunction + +function! SyntaxCheckers_javascript_flow_GetLocList() dict +    if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# '' +        return [] +    endif + +    let makeprg = self.makeprgBuild({ +        \ 'exe': self.getExecEscaped() . ' check', +        \ 'args_after': '--show-all-errors --json' }) + +    let errorformat = +        \ '%f:%l:%c:%n: %m,' . +        \ '%f:%l:%c: %m' + +    let loclist = SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'preprocess': 'flow', +        \ 'defaults': {'type': 'E'} }) + +    for e in loclist +        if get(e, 'col', 0) && get(e, 'nr', 0) +            let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['nr'] + 1) . 'c' +            let e['nr'] = 0 +        endif +    endfor + +    return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'flow'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/gjslint.vim b/vim/bundle/syntastic/syntax_checkers/javascript/gjslint.vim new file mode 100644 index 0000000..3368905 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/gjslint.vim @@ -0,0 +1,46 @@ +"============================================================================ +"File:        gjslint.vim +"Description: Javascript syntax checker - using gjslint +"Maintainer:  Martin Grenfell <martin.grenfell at gmail dot com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_gjslint_checker') +    finish +endif +let g:loaded_syntastic_javascript_gjslint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_gjslint_GetLocList() dict +    call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args') + +    let makeprg = self.makeprgBuild({ +        \ 'args': '--nodebug_indentation', +        \ 'args_after': '--check_html --nosummary --unix_mode --nobeep' }) + +    let errorformat = +        \ "%f:%l:(New Error -%\\?\%n) %m," . +        \ "%f:%l:(-%\\?%n) %m," . +        \ "%-G1 files checked," . +        \ " no errors found.," . +        \ "%-G%.%#" + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'gjslint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/jscs.vim b/vim/bundle/syntastic/syntax_checkers/javascript/jscs.vim new file mode 100644 index 0000000..d259086 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/jscs.vim @@ -0,0 +1,53 @@ +"============================================================================ +"File:        jscs.vim +"Description: Javascript syntax checker - using jscs +"Maintainer:  LCD 47 <lcd047@gmail.com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_jscs_checker') +    finish +endif +let g:loaded_syntastic_javascript_jscs_checker = 1 + +if !exists('g:syntastic_javascript_jscs_sort') +    let g:syntastic_javascript_jscs_sort = 1 +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_jscs_IsAvailable() dict +    if !executable(self.getExec()) +        return 0 +    endif +    return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 1]) +endfunction + +function! SyntaxCheckers_javascript_jscs_GetLocList() dict +    let makeprg = self.makeprgBuild({ +        \ 'args_after': '--no-colors --max-errors -1 --reporter json' }) + +    let errorformat = '%f:%l:%c:%m' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'subtype': 'Style', +        \ 'preprocess': 'jscs', +        \ 'defaults': {'type': 'E'}, +        \ 'returns': [0, 2] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'jscs'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/jshint.vim b/vim/bundle/syntastic/syntax_checkers/javascript/jshint.vim new file mode 100644 index 0000000..492aa69 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/jshint.vim @@ -0,0 +1,60 @@ +"============================================================================ +"File:        jshint.vim +"Description: Javascript syntax checker - using jshint +"Maintainer:  Martin Grenfell <martin.grenfell at gmail dot com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_jshint_checker') +    finish +endif +let g:loaded_syntastic_javascript_jshint_checker = 1 + +if !exists('g:syntastic_javascript_jshint_sort') +    let g:syntastic_javascript_jshint_sort = 1 +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_jshint_IsAvailable() dict +    call syntastic#log#deprecationWarn('jshint_exec', 'javascript_jshint_exec') +    if !executable(self.getExec()) +        return 0 +    endif + +    let ver = self.getVersion() +    let s:jshint_new = syntastic#util#versionIsAtLeast(ver, [1, 1]) + +    return syntastic#util#versionIsAtLeast(ver, [1]) +endfunction + +function! SyntaxCheckers_javascript_jshint_GetLocList() dict +    call syntastic#log#deprecationWarn('javascript_jshint_conf', 'javascript_jshint_args', +        \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + +    let makeprg = self.makeprgBuild({ 'args_after': (s:jshint_new ? '--verbose ' : '') }) + +    let errorformat = s:jshint_new ? +        \ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' : +        \ '%E%f: line %l\, col %v\, %m' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'defaults': {'bufnr': bufnr('')}, +        \ 'returns': [0, 2] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'jshint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/jsl.vim b/vim/bundle/syntastic/syntax_checkers/javascript/jsl.vim new file mode 100644 index 0000000..aa9862b --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/jsl.vim @@ -0,0 +1,48 @@ +"============================================================================ +"File:        jsl.vim +"Description: Javascript syntax checker - using jsl +"Maintainer:  Martin Grenfell <martin.grenfell at gmail dot com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_jsl_checker') +    finish +endif +let g:loaded_syntastic_javascript_jsl_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_jsl_GetLocList() dict +    call syntastic#log#deprecationWarn('javascript_jsl_conf', 'javascript_jsl_args', +        \ "'-conf ' . syntastic#util#shexpand(OLD_VAR)") + +    let makeprg = self.makeprgBuild({ +        \ 'args_after': '-nologo -nofilelisting -nosummary -nocontext -process' }) + +    let errorformat = +        \ '%W%f(%l): lint warning: %m,'. +        \ '%-Z%p^,'. +        \ '%W%f(%l): warning: %m,'. +        \ '%-Z%p^,'. +        \ '%E%f(%l): SyntaxError: %m,'. +        \ '%-Z%p^,'. +        \ '%-G' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'jsl'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/jslint.vim b/vim/bundle/syntastic/syntax_checkers/javascript/jslint.vim new file mode 100644 index 0000000..e2ce76c --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/jslint.vim @@ -0,0 +1,51 @@ +"============================================================================ +"File:        jslint.vim +"Description: Javascript syntax checker - using jslint +"Maintainer:  Martin Grenfell <martin.grenfell at gmail dot com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_javascript_jslint_checker') +    finish +endif + +let g:loaded_syntastic_javascript_jslint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) +    let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') +    if term !=# '' +        let term = '\V\<' . escape(term, '\') . '\>' +    endif +    return term +endfunction + +function! SyntaxCheckers_javascript_jslint_GetLocList() dict +    let makeprg = self.makeprgBuild({ 'args': '--white --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars' }) + +    let errorformat = +        \ '%E %##%\d%\+ %m,'. +        \ '%-Z%.%#Line %l\, Pos %c,'. +        \ '%-G%.%#' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'defaults': {'bufnr': bufnr('')} }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'jslint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/jsxhint.vim b/vim/bundle/syntastic/syntax_checkers/javascript/jsxhint.vim new file mode 100644 index 0000000..e29ce06 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/jsxhint.vim @@ -0,0 +1,56 @@ +"============================================================================ +"File:        jsxhint.vim +"Description: Javascript syntax checker - using jsxhint +"Maintainer:  Thomas Boyt <me@thomasboyt.com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_jsxhint_checker') +    finish +endif +let g:loaded_syntastic_javascript_jsxhint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict " {{{1 +    if !executable(self.getExec()) +        return 0 +    endif + +    let version_output = syntastic#util#system(self.getExecEscaped() . ' --version') +    let parsed_ver = !v:shell_error && (version_output =~# '\m^JSXHint\>') ? syntastic#util#parseVersion(version_output) : [] +    if len(parsed_ver) +        call self.setVersion(parsed_ver) +    else +        call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1)) +        call syntastic#log#error("checker javascript/jsxhint: can't parse version string (abnormal termination?)") +    endif + +    return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1]) +endfunction " }}}1 + +function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict " {{{1 +    let makeprg = self.makeprgBuild({ +        \ 'args_after': '--verbose' }) + +    let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'defaults': {'bufnr': bufnr('')} }) +endfunction " }}}1 + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'jsxhint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/mixedindentlint.vim b/vim/bundle/syntastic/syntax_checkers/javascript/mixedindentlint.vim new file mode 100644 index 0000000..2995409 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/mixedindentlint.vim @@ -0,0 +1,40 @@ +"============================================================================ +"File:        mixedindentlint.vim +"Description: Mixed indentation linter for vim +"Maintainer:  Payton Swick <payton@foolord.com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_mixedindentlint_checker') +    finish +endif +let g:loaded_syntastic_javascript_mixedindentlint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_mixedindentlint_GetLocList() dict +    let makeprg = self.makeprgBuild({}) + +    let errorformat = 'Line %l in "%f" %.%#' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'subtype': 'Style', +        \ 'defaults': { 'text': 'Indentation differs from rest of file' }, +        \ 'returns': [0, 1] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'mixedindentlint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/standard.vim b/vim/bundle/syntastic/syntax_checkers/javascript/standard.vim new file mode 100644 index 0000000..e652bd0 --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/standard.vim @@ -0,0 +1,55 @@ +"============================================================================ +"File:        standard.vim +"Description: JavaScript syntax checker - using standard +"Maintainer:  LCD 47 <lcd047@gmail.com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_standard_checker') +    finish +endif +let g:loaded_syntastic_javascript_standard_checker = 1 + +if !exists('g:syntastic_javascript_standard_generic') +    let g:syntastic_javascript_standard_generic = 0 +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_standard_IsAvailable() dict +    if g:syntastic_javascript_standard_generic +        call self.log('generic standard, exec =', self.getExec()) +    endif + +    if !executable(self.getExec()) +        return 0 +    endif +    return g:syntastic_javascript_standard_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1]) +endfunction + +function! SyntaxCheckers_javascript_standard_GetLocList() dict +    let makeprg = self.makeprgBuild({ 'args': '-v' }) + +    let errorformat = '  %f:%l:%c: %m' + +    return SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'subtype': 'Style', +        \ 'defaults': {'type': 'W'}, +        \ 'returns': [0, 1] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'standard'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/vim/bundle/syntastic/syntax_checkers/javascript/tern_lint.vim b/vim/bundle/syntastic/syntax_checkers/javascript/tern_lint.vim new file mode 100644 index 0000000..547942b --- /dev/null +++ b/vim/bundle/syntastic/syntax_checkers/javascript/tern_lint.vim @@ -0,0 +1,53 @@ +"============================================================================ +"File:        tern_lint.vim +"Description: Syntax checking plugin for syntastic +"Maintainer:  LCD 47 <lcd047@gmail.com> +"License:     This program is free software. It comes without any warranty, +"             to the extent permitted by applicable law. You can redistribute +"             it and/or modify it under the terms of the Do What The Fuck You +"             Want To Public License, Version 2, as published by Sam Hocevar. +"             See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_tern_lint_checker') +    finish +endif +let g:loaded_syntastic_javascript_tern_lint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_javascript_tern_lint_IsAvailable() dict +    return has('byte_offset') && executable(self.getExec()) +endfunction + +function! SyntaxCheckers_javascript_tern_lint_GetLocList() dict +    let makeprg = self.makeprgBuild({}) + +    let errorformat = '%f:%t:%l:%c:%n:%m' + +    let loclist = SyntasticMake({ +        \ 'makeprg': makeprg, +        \ 'errorformat': errorformat, +        \ 'preprocess': 'tern_lint', +        \ 'returns': [0] }) + +    for e in loclist +        if get(e, 'col', 0) && get(e, 'nr', 0) +            let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['nr'] + 1) . 'c' +        endif +        let e['nr'] = 0 +    endfor + +    return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ +    \ 'filetype': 'javascript', +    \ 'name': 'tern_lint', +    \ 'exec': 'tern-lint' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: | 
