JSHint and Vim

Using JSHint from Vim

Even though I am not a huge fan of JSHint it is
a useful tool here and there, especially to enforce some guidelines in your
code to keep a consistent style. Personally I think style matters, even though I
might not care about certain ones, at least I should be consistent all the way
across. So this is where JSHint comes in and lets you define a certain set of
rules to stay true to, and also eliminate some potential bugs and smells.

Running it is simple, just install via npm globally

$ npm install jshint -g

And run passing the config and the file to hint

$ jshint --config jshint.json myfile.js

Since I personally prefer to run as much as possible from Vim directly I created
a short function to do it for me.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.