Export 0.2.1
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / node_modules / grunt / node_modules / jshint / README.md
1 # node-jshint
2
3 A command line interface and npm package for jshint.
4
5 ## Install
6
7 To use jshint from any location (for npm v1.x) you need to install using the global (-g) flag.
8
9     npm install -g jshint
10
11 ## Usage
12
13     jshint -h
14
15 You can also require JSHint itself as a module.
16
17     var jshint = require('jshint');
18
19 Note: If you are using npm v1.x be sure to install jshint locally (without the -g flag) or link it globally.
20
21 ## Text Editor Plugins
22
23 * [gedit-node-jshint](https://github.com/niftylettuce/gedit-node-jshint) - Simply use CTRL+J in gedit to run JSHint using `node-jshint`.
24 * [vim syntastic](https://github.com/scrooloose/syntastic) - Run node-jshint at each file save.
25 * [sublime-jshint](https://github.com/uipoet/sublime-jshint) - `F7` or `command-B` on any .js file. `F4` next error line,column. `shift-F4` previous error line,column.
26
27 ## Custom Reporters
28
29 Specify a custom reporter module (see example/reporter.js).
30
31     --reporter path/to/reporter.js
32
33 Use a jslint compatible xml reporter.
34
35     --jslint-reporter
36
37 Show additional non-error data generated by jshint (unused globals etc).
38
39     --show-non-errors
40
41 ## Configuration Options
42
43 **Note:** This behavior described below is very different from versions prior to `0.6`.
44
45 The CLI uses the default options that come with JSHint. 
46
47 Only one extra option is unique to node-jshint: `globals` 
48 allows you to define an object of globals that get ignored for every file.
49 To see an example you can look at how whitelisted globals are defined
50 in the [jshint code](https://github.com/jshint/jshint/blob/c047ea1b01097fcc220fcd1a55c41f67ae2e6e81/jshint.js#L556)
51
52 To have your own configuration apply, there are several methods you can use:
53
54 ### Specify Manually
55
56 Setting the `--config=/path/to/your/config` command line option to specify your own configuration file outside of the directory tree for your project.
57
58 ### Within your Project's Directory Tree
59
60 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.
61
62 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.
63
64 ### Home Directory
65
66 If all the methods above do not yield a `.jshintrc` to use, the last place that will be checked is your user's `$HOME` directory.
67
68 ## File Extensions
69
70 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 :
71
72     --extra-ext .json
73
74 ## Ignoring Files and Directories
75
76 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 `.gitignore` file)
77
78 **Note:** Pattern matching uses minimatch, with the nocase [option](https://github.com/isaacs/minimatch). When there is no match, it performs a left side match (when no forward slashes present and path is a directory).
79
80 ## Installing dependencies for development
81
82     ./configure
83
84 ## Build Commands
85
86     jake -T
87
88 ## Project Guidelines
89
90 * All tests are passing.
91 * No (new) JSHint errors are introduced.