Reputation: 100020
I am simply running:
$> jshint .
which looks through my project's directory for .js files, but it is also looking into the node_modules directory which has a shit-ton of .js files that I don't really want to know about.
I might mention that eslint works out of the box to ignore the node_modules directory.
is there a way to run .jshint with a flag to ignore the node_modules directory?
for example
$> jshint . --ignore ./node_modules
?
Upvotes: 1
Views: 6515
Reputation: 100020
To ignore the node_modules folder using JSHint
, this seems to work best
in your package.json
file at the root of your project:
{
"scripts": {
"jshint": "jshint --exclude 'node_modules/**/*' ."
}
}
now you can run this at the command line
npm run jshint
and you won't forget the syntax because you have documented it for yourself
You can also use .jshintignore
:
node_modules/**/*
Upvotes: 0
Reputation: 903
According to https://jshint.com/docs/cli/#ignoring-files you can also use the .jshintignore
file.
Just add:
node_modules/**/*
Upvotes: 8
Reputation: 1233
The correct syntax for ignoring the node_modlues
directory from the .jshintignore
file is:
node_modules/**/*
Upvotes: 3