Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 172 lines (111 sloc) 4.962 kB
35c99c4 * nodelint > node-lint
jpolo authored
1 node-lint
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
2 --------
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
3
4 - [Node] is a [V8] based framework for writing Javascript applications outside
5 the browser.
6
7 - [JSLint] is a code quality tool that checks for problems in Javascript programs.
8
35c99c4 * nodelint > node-lint
jpolo authored
9 - **node-lint** lets you run JSLint from the command line.
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
10
35c99c4 * nodelint > node-lint
jpolo authored
11 - node-lint currently supports node version 0.2.1
2127aa1 Cleaned up a hack that was addressing a node.js issue, updated to wor…
Matthew Kitt authored
12
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
13 [Node]: http://nodejs.org/
14 [V8]: http://code.google.com/p/v8/
15 [JSLint]: http://www.jslint.com/lint.html
16
17
bc4da23 @cliffano Added instalation note, updated usage, credit, and contributor info.
cliffano authored
18 installation
19 ------------
20
21 npm:
22
35c99c4 * nodelint > node-lint
jpolo authored
23 $ npm install lint
bc4da23 @cliffano Added instalation note, updated usage, credit, and contributor info.
cliffano authored
24
2127aa1 Cleaned up a hack that was addressing a node.js issue, updated to wor…
Matthew Kitt authored
25
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
26 usage
27 -----
28
35c99c4 * nodelint > node-lint
jpolo authored
29 You can use `node-lint` directly if you have `node` in your $PATH:
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
30
35c99c4 * nodelint > node-lint
jpolo authored
31 $ ./node-lint path/to/your/file.js
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
32
bc4da23 @cliffano Added instalation note, updated usage, credit, and contributor info.
cliffano authored
33 Or if you installed it using npm:
34
35c99c4 * nodelint > node-lint
jpolo authored
35 $ node-lint path/to/your/file.js
bc4da23 @cliffano Added instalation note, updated usage, credit, and contributor info.
cliffano authored
36
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
37 Otherwise, you need to run it with node:
38
35c99c4 * nodelint > node-lint
jpolo authored
39 $ node node-lint path/to/your/file.js
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
40
35c99c4 * nodelint > node-lint
jpolo authored
41 You can also specify a directory param and node-lint will find all .js files under that directory and its subdirectories:
ed25ae6 @cliffano Add directory param support.
cliffano authored
42
35c99c4 * nodelint > node-lint
jpolo authored
43 $ node node-lint dir1/ dir2/
ed25ae6 @cliffano Add directory param support.
cliffano authored
44
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
45 Enjoy!
46
47
921bf6b @codenothing Updated --help and README with Corey Hart's changes.
codenothing authored
48 config
49 ------
50
73b96c1 @Sannis Added documentation on overriding the default config.
Sannis authored
51 You can set JSLint options by modifying the default `config.js` file or even
52 override the default config by passing another config file with the optional
53 `--config` parameter, e.g.
921bf6b @codenothing Updated --help and README with Corey Hart's changes.
codenothing authored
54
35c99c4 * nodelint > node-lint
jpolo authored
55 $ node-lint file1 file2 dir1 dir2 --config path/to/your/config/file.json
921bf6b @codenothing Updated --help and README with Corey Hart's changes.
codenothing authored
56
35c99c4 * nodelint > node-lint
jpolo authored
57 For example, if the default config.json has:
73b96c1 @Sannis Added documentation on overriding the default config.
Sannis authored
58
35c99c4 * nodelint > node-lint
jpolo authored
59 {
60 "adsafe" : false,
61 "bitwise" : true,
62 "error_prefix" : "\u001b[1m",
63 "error_suffix" : ":\u001b[0m "
64 }
73b96c1 @Sannis Added documentation on overriding the default config.
Sannis authored
65
35c99c4 * nodelint > node-lint
jpolo authored
66 And your own path/to/your/config/file.json looks like:
73b96c1 @Sannis Added documentation on overriding the default config.
Sannis authored
67
35c99c4 * nodelint > node-lint
jpolo authored
68 {
69 "bitwise" : false,
70 "browser" : false
73b96c1 @Sannis Added documentation on overriding the default config.
Sannis authored
71 };
72
73 Then the final options used will be:
74
35c99c4 * nodelint > node-lint
jpolo authored
75 {
76 "adsafe" : false,
77 "bitwise" : false,
78 "browser" : false,
79 "error_prefix" : "\u001b[1m",
80 "error_suffix" : ":\u001b[0m "
73b96c1 @Sannis Added documentation on overriding the default config.
Sannis authored
81 };
82
83 Take a look at [JSLint's Options] to see what to put in the `options` variable.
921bf6b @codenothing Updated --help and README with Corey Hart's changes.
codenothing authored
84
85
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
86 reporters
49ce19a Updating README with Reporter description
Matthew Kitt authored
87 ---------
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
88
35c99c4 * nodelint > node-lint
jpolo authored
89 By default node-lint uses an internal `reporter` function to output it's results
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
90 to the console. For basic use it's possible to alter the `error_prefix` and
91 `error_suffix` colors within your `config.js` file. This will prepend or append
92 coloring information to the results when JSLint complains about your code. There
93 may be times when a more customizable reporting system might be needed (*i.e.
94 IDE/Text Editor integrations or customized console outputs*).
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
95
35c99c4 * nodelint > node-lint
jpolo authored
96 node-lint allows you to designate a custom reporter for outputting the results
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
97 from JSLint's run. This `reporter` function will override the default function
35c99c4 * nodelint > node-lint
jpolo authored
98 built into node-lint. To utilize a custom reporter first create a js file that
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
99 has a function in it named `reporter`:
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
100
101 `example-reporter.js`:
102
103 var sys = require('sys');
104
105 function reporter(results) {
106 var len = results.length;
107 sys.puts(len + ' error' + ((len === 1) ? '' : 's'));
108 }
109
35c99c4 * nodelint > node-lint
jpolo authored
110 Then when you run node-lint from the command line, pass in the customized
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
111 reporter:
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
112
35c99c4 * nodelint > node-lint
jpolo authored
113 `$ ./node-lint path/to/file.js --reporter path/to/file/example-reporter.js`
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
114
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
115 For brevity sake, this is a fairly simple reporter. For more elaborate examples
116 see the `examples/reporters/` directory or `examples/textmate/`.
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
117
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
118 The sample XML reporter `examples\reporters\xml.js` produces reports which can
119 also be integrated with a Continuous Integration server like [Hudson] using the
120 [Violations Plugin].
08a884f @cliffano Added XML reporter note.
cliffano authored
121
005aceb @tav Renamed all references to nodelint.js -> nodelint.
tav authored
122 Please see the [wiki][wiki] for integration with various editors.
7d61425 Added reporter info to the README and moving non mission critical fil…
Matthew Kitt authored
123
08a884f @cliffano Added XML reporter note.
cliffano authored
124 [Hudson]: http://hudson-ci.org
125 [Violations Plugin]: http://wiki.hudson-ci.org/display/HUDSON/Violations
126
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
127 contribute
128 ----------
129
130 To contribute any patches, simply fork this repository using GitHub and send a
131 pull request to me <<http://github.com/tav>>. Thanks!
132
133
134 credits
135 -------
136
35c99c4 * nodelint > node-lint
jpolo authored
137 - [tav], wrote node-lint
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
138
139 - [Felix Geisendörfer][felixge], clarified Node.js specific details
140
141 - [Douglas Crockford], wrote the original JSLint and rhino.js runner
142
35c99c4 * nodelint > node-lint
jpolo authored
143 - [Nathan Landis][my8bird], updated node-lint to Node's new API.
7e66d96 @tav Added Nathan Landis to the credits file.
tav authored
144
d1e240b @tav Added mkitt, Sannis and mranney for their awesome work.
tav authored
145 - [Oleg Efimov][Sannis], added support for overridable configurations, running
35c99c4 * nodelint > node-lint
jpolo authored
146 node-lint from a symlink and updates to reflect Node.js API changes.
c0bd1cd @tav Added Sannis (Oleg Efimov) to the credits.
tav authored
147
d1e240b @tav Added mkitt, Sannis and mranney for their awesome work.
tav authored
148 - [Matthew Kitt][mkitt], added support for configurable reporters, various code
149 cleanups and improvements including updates to reflect Node.js API changes.
150
35c99c4 * nodelint > node-lint
jpolo authored
151 - [Corey Hart], updated node-lint with multiple files and config support.
d1e240b @tav Added mkitt, Sannis and mranney for their awesome work.
tav authored
152
35c99c4 * nodelint > node-lint
jpolo authored
153 - [Mamading Ceesay][evangineer], added support for using node-lint within Emacs.
bc23110 @tav Added evangineer to the credits.
tav authored
154
35c99c4 * nodelint > node-lint
jpolo authored
155 - [Matt Ranney][mranney], updated node-lint to use sys.error.
921bf6b @codenothing Updated --help and README with Corey Hart's changes.
codenothing authored
156
ed25ae6 @cliffano Add directory param support.
cliffano authored
157 - [Cliffano Subagio], added npm installation support, XML reporter, and directory param support.
bc4da23 @cliffano Added instalation note, updated usage, credit, and contributor info.
cliffano authored
158
2872680 @tav Extracted nodelint.js from the ampify repo.
tav authored
159 [tav]: http://tav.espians.com
160 [felixge]: http://debuggable.com
161 [Douglas Crockford]: http://www.crockford.com
c0bd1cd @tav Added Sannis (Oleg Efimov) to the credits.
tav authored
162 [my8bird]: http://github.com/my8bird
163 [Sannis]: http://github.com/Sannis
d1e240b @tav Added mkitt, Sannis and mranney for their awesome work.
tav authored
164 [mkitt]: http://github.com/mkitt
921bf6b @codenothing Updated --help and README with Corey Hart's changes.
codenothing authored
165 [Corey Hart]: http://www.codenothing.com
bc23110 @tav Added evangineer to the credits.
tav authored
166 [evangineer]: http://github.com/evangineer
d1e240b @tav Added mkitt, Sannis and mranney for their awesome work.
tav authored
167 [mranney]: http://github.com/mranney
bc4da23 @cliffano Added instalation note, updated usage, credit, and contributor info.
cliffano authored
168 [Cliffano Subagio]: http://blog.cliffano.com
921bf6b @codenothing Updated --help and README with Corey Hart's changes.
codenothing authored
169
170 [JSLINT's Options]: http://www.jslint.com/lint.html#options
35c99c4 * nodelint > node-lint
jpolo authored
171 [wiki]: http://github.com/tav/node-lint/wiki
Something went wrong with that request. Please try again.