mirror of
https://github.com/amix/vimrc
synced 2025-07-09 18:55:01 +08:00
updated plugins and added eslint goodies
This commit is contained in:
@ -18,21 +18,31 @@ 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 syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])
|
||||
return g:syntastic_javascript_eslint_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_eslint_GetLocList() dict
|
||||
call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args',
|
||||
\ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
|
||||
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': '-f compact' })
|
||||
let makeprg = self.makeprgBuild({ 'args_before': (g:syntastic_javascript_eslint_generic ? '' : '-f compact') })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f: line %l\, col %c\, Error - %m,' .
|
||||
@ -43,9 +53,17 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['guards'] })
|
||||
|
||||
for e in loclist
|
||||
let e['col'] += 1
|
||||
endfor
|
||||
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
|
||||
|
@ -34,7 +34,7 @@ function! SyntaxCheckers_javascript_flow_GetLocList() dict
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe': self.getExecEscaped() . ' status',
|
||||
\ 'exe': self.getExecEscaped() . ' check',
|
||||
\ 'args_after': '--show-all-errors --json' })
|
||||
|
||||
let errorformat =
|
||||
|
@ -21,16 +21,25 @@ endif
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_javascript_jscs_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter checkstyle' })
|
||||
function! SyntaxCheckers_javascript_jscs_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 1])
|
||||
endfunction
|
||||
|
||||
let errorformat = '%f:%t:%l:%c:%m'
|
||||
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': 'checkstyle',
|
||||
\ 'preprocess': 'jscs',
|
||||
\ 'defaults': {'type': 'E'},
|
||||
\ 'returns': [0, 2] })
|
||||
endfunction
|
||||
|
||||
|
@ -18,6 +18,10 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
|
||||
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)
|
||||
|
@ -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:
|
@ -14,14 +14,22 @@ if exists('g:loaded_syntastic_javascript_standard_checker')
|
||||
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 syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
|
||||
return g:syntastic_javascript_standard_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_standard_GetLocList() dict
|
||||
|
Reference in New Issue
Block a user