Linting code, or checking it for errors, is an essential part of jQuery development. Not only does it help get rid of the errors, it also helps identify the code that isn't being used within the script.
Don't forget – optimizing isn't just about adjusting selectors or even replacing jQuery code with CSS equivalent (as we saw in Chapter 6, Animating with jQuery). We need to first ensure that we have a solid base to work from – we can always do this manually, but the smarter option is to automate the process using a task runner such as Grunt.
Let's take a moment to see how this works in action – note that this assumes you still have NodeJS installed from previous exercises. This time around, we will use it to install the grunt-contrib-jshint
package, available from https://github.com/gruntjs/grunt-contrib-jshint: