Disabling warning about "require" function in JSHint

somesh picture somesh · Apr 9, 2013 · Viewed 27.3k times · Source

I'm writing some code for Node.js and I'm currently using JSHint to check over my code. However, when I use the require function to import modules, it says:

'require' is not defined.

How can I suppress the warning?

"use strict";
var express = require('express');   
var register = require('./routes/register');

Answer

generalhenry picture generalhenry · Apr 9, 2013

jshint is not aware of node.js globals by default you need to inform it.

add this comment to the top:

/* jshint node: true */