15

I just added jsonlint for Syntastic, and it's not catching any syntax errors. flake8 is working fine for Python, and has been for a while, but no jsonlint. Below you'll see the relevant portion of my .vimrc, where I believe to have everything I need to get this next checker working.

.vimrc

let g:syntastic_python_checkers=['flake8']
let g:syntastic_python_flake8_args = '--ignore="E501"' " ignore long lines
let g:syntastic_json_checkers=['jsonlint']

" Better :sign interface symbols
let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol = '!'

which jsonlint

/usr/local/bin/jsonlint
Brian Dant
  • 4,029
  • 6
  • 33
  • 47
  • What do you mean by "I just tried to add jsonlint"? It's already there. – romainl May 18 '13 at 05:10
  • @romainl: What I meant was: "I've successfully added jsonlint (the software package), and configured my .vimrc to use jsonlint as a checker, but I'm not seeing any errors or warnings, even when I have a file open that contains invalid JSON". Any ideas why this might be happening? – Brian Dant May 19 '13 at 21:34
  • one thing you might try: backup your `.vim` folder, make a copy, then delete everything except syntastic and the setup you need for it. If the error doesn't occur, at least you've gotten closer to the answer. If it helps, syntastic works with my json files, so it *ought* to work for you. Also, what happens when you run something like `:!jsonlint %` (or whatever command you use for `jsonlint`). Are you sure that it's in your path? – Jeff Tratner May 20 '13 at 04:46
  • What I meant by "It's already there" is that you don't need to put anything in your `~/.vimrc` for syntastic to work with `*.json` files. – romainl May 20 '13 at 05:11
  • @JeffTratner: `which jsonlint` tells me that it's on my path, right? (The last part of my q shows the output from `which jsonlint`) – Brian Dant May 20 '13 at 20:16

1 Answers1

10

had the same issue. Was missing that Vim set by default the filetype of a json file to javascript

:setfiletype json
:SyntasticCheck
jassinm
  • 7,323
  • 3
  • 33
  • 42
  • 7
    You can use `au BufRead,BufNewFile *.json set filetype=json` in your .vimrc to ensure that .json files are assigned to the right type automatically. – El Yobo Jul 18 '13 at 22:24
  • 3
    I had to do `sudo npm -g install jsonlint` to make this work on Ubuntu 14.04. This is the `jsonlint` Syntastic expects. The Ubuntu package `python-demjson` also installs a program called `jsonlint`, but it isn't made to work with Syntastic. – Adam Monsen Nov 07 '14 at 00:30