Configuring node.js JavaScript for jslint

When I'm writing JavaScript, I always lint my code using jslint to try to minimize any code problems and syntax errors.

In a node.js environment, even the simplest of applications will fail linting. For example a simple require statement will fail with:

'require' was used before it was defined.  

To configure JSLint for a node.js application, add the lint option node: true at the top of the file. JSLint then knows that the JavaScript belongs to a node.js application and will lint more appropriately.

/*jslint node: true */

Note, the spacing is important on this line as there should be no space before the jslint keyword.