Vim generating invisible extra lines?

I’ve had a strange problem crop up a few times recently when working on a couple of projects—Node projects each time, but I don’t know if that’s particularly relevant. Occasionally I’ll run jshint on file or just try to run it with node, and I’ll get an error like the following:

Looks totally reasonable, except that this is the end of the file in question:

That last line is line 80. So there are apparently two more lines in the file that I cannot find at all nor do anything to, and one of them has some sort of an error on it.

I know that Vim generates an extra line at the end of a file, so that accounts for one line. For the other, I’m assuming that there’s actually an error earlier in the code, perhaps an open ( or { without a close, and the error checker just gets to the last line of the file (line 81) and errors out. Since it’s done with line 81, the error must be on line 82.

And indeed, that’s the problem! Looks like I accidentally added in an extra }) in a function. The whole thing doesn’t work just yet, but it’s less broken now than it was!

Leave a Reply

Your email address will not be published. Required fields are marked *