For general usage information, visit our website: http://jshint.com/.
Reporting a bug
To report a bug simply create a new GitHub Issue and describe your problem or suggestion. We welcome all kind of feedback regarding JSHint including but not limited to:
- When JSHint doesn't work as expected
- When you simply want a new option or feature
Before reporting a bug look around to see if there are any open or closed tickets that cover your issue. And remember the wisdom: pull request > bug report > tweet.
You can install JSHint via NPM:
npm install jshint -g
You can also require JSHint itself as a module.
var jshint = require('jshint');
Note: If you are using npm v1.x be sure to install jshint locally (without the -g flag) or link it globally.
Specify a custom reporter module (see example/reporter.js).
Use a jslint compatible xml reporter.
Show additional non-error data generated by jshint (unused globals etc).
Note: This behavior described below is very different from versions prior to
The CLI uses the default options that come with JSHint.
Only one extra option is unique to node-jshint:
allows you to define an object of globals that get ignored for every file.
To see an example you can look at how whitelisted globals are defined
in the jshint code
To have your own configuration apply, there are several methods you can use:
--config=/path/to/your/config command line option to specify your own configuration file outside of the directory tree for your project.
Within your Project's Directory Tree
When the CLI is called, and a configuration file isn't specified already,
node-jshint will attempt to locate one for you starting in
pwd. (or "present working directory") If this does not yield a
.jshintrc file, it will move one level up (
..) the directory tree all the way up to the filesystem root. If a file is found, it stops immediately and uses that set of configuration.
This setup allows you to set up one configuration file for your entire project. (place it in the root folder) As long as you run
jshint from anywhere within your project directory tree, the same configuration file will be used.
If all the methods above do not yield a
.jshintrc to use, the last place that will be checked is your user's
Default extension for files is ".js". If you want to use JSHint with other file extensions (.json), you need to pass this extra extension as an option :
Ignoring Files and Directories
If there is a .jshintignore file in your project's directory tree, (also provided you run
jshint from within your project's directory) then any directories or files specified will be skipped over. (behaves just like a
Note: Pattern matching uses minimatch, with the nocase option. When there is no match, it performs a left side match (when no forward slashes present and path is a directory).
How do I turn off "mixed tabs and spaces" warning?
If you're using so-called smart tabs then
we have an option
smarttabs for you. Otherwise, your solution is to run JSHint with
a custom reporter that discards any warnings you don't like. For example, this example
reporter discards all warnings about mixed tabs and
Look for a file named
CONTRIBUTING.md in this repository. It contains our contributing
guidelines. We also have a mailing list.
JSHint is distributed under the MIT License. One file and one file only (src/stable/jshint.js) is distributed under the slightly modified MIT License.
Core Team members:
- Anton Kovalyov (@valueof)
- Wolfgang Kluge (blog)
- Josh Perez (@goatslacker)
- Brent Lintner (@brentlintner)
Maintainer: Anton Kovalyov
We really appreciate all kind of feedback and contributions. Thanks for using and supporting JSHint!