¿Cómo usar el complemento Syntastic Vim con JSHint para validar el código JavaScript?¿Cómo se configura Syntastic con JSHint?
Medio Ambiente:
- Ubuntu 11.04
- VIM - vi mejorado 7,3
Lo que he instalado, a raíz de la disolución a VIM + JSLint?:
- Vundle
- nodo Js
- nodo Administrador de paquetes
- jshint, a nivel mundial
- Syntastic instalado a través de Vundle (utilizado el:. BundleInstall comando dentro de Vim para asegurarse de que se ha instalado Syntastic)
.vimrc:
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
Bundle 'scrooloose/syntastic'
filetype plugin indent on " required!
let g:syntastic_enable_signs=1
let g:syntastic_auto_jump=1
let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
buscando ejecutables instalados:
$ which gjslint
$ which jslint
$ which jsl
$ which jshint
/home/fernando/local/node/bin/jshint
$
$ echo $PATH
>/home/fernando/local/bin:/home/fernando/local/node/bin:/home/fernando/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
$ jshint test.js
test.js: la línea 3, col 1, 'blbla' no está definida.
test.js: línea 4, col 1, 'x' no está definido.
test.js: línea 4, col 5, 'nonono' no está definido.
test.js: línea 6, col 1, 'a' no está definido.
test.js: línea 7, col 1, 'b' no está definido.
test.js: línea 8, col 5, 'a' no está definido.
test.js: línea 8, col 10, 'b' no está definido.
test.js: línea 8, col 7, se esperaba '===' y en su lugar se veía '=='.8 errores
$ vi test.js -- no error message shown
:SyntasticEnable -- Vim exits and restarts, opening the same file, but still no message
:w -- still no error message
:Errors -- the location list opens but it is empty
Tanto jshint y Syntastic parecen ser instalado, pero algo es probable que falte. ¿Qué podría ser?
muy raro! Acabo de probar Syntastic con Vim 7.3 en Linux sin ningún problema. Tal vez presentar un problema en GitHub? –