Disabling warning about "require" function in JSHint Disabling warning about "require" function in JSHint node.js node.js

Disabling warning about "require" function in JSHint


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

add this comment to the top:

/* jshint node: true */


We can set node as the global environment variable in JSHint's .jshintrc file

This option defines globals available when your code is running inside of the Node runtime environment. Node.js is a server-side JavaScript environment that uses an asynchronous event-driven model. This option also skips some warnings that make sense in the browser environments but don't make sense in Node such as file-level use strict pragmas and console.log statements.

For more info http://jshint.com/docs/options/#node

{   "node": true}

Errors like 'require' is not defined, 'console' is not defined, 'module' is not defined won't show up any more


You can configure JSHint by adding "require" to the .jshintrc file. For instance:

{    "globals" : {        "require": false    }}

Or you can define globals per specific file only by:

/* global require */

For more information about how to configure JSHint please read JSHint Documentation