Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Tolerate

  • Loading branch information...
commit a27d17cd4683a9f0cf6649f5977f72e8a55f3ecb 1 parent b4b188e
Douglas Crockford authored June 09, 2011
11  init_ui.js
... ...
@@ -1,5 +1,5 @@
1 1
 // init_ui.js
2  
-// 2011-05-31
  2
+// 2011-06-08
3 3
 
4 4
 // This is the web browser companion to fulljslint.js. It is an ADsafe
5 5
 // lib file that implements a web ui by adding behavior to the widget's
@@ -22,7 +22,6 @@ ADSAFE.lib("init_ui", function (lib) {
22 22
     return function (dom) {
23 23
         var table = dom.q('#JSLINT_TABLE'),
24 24
             boxes = table.q('span'),
25  
-            goodparts = boxes.q('.goodpart'),
26 25
             indent = dom.q('#JSLINT_INDENT'),
27 26
             input = dom.q('#JSLINT_INPUT'),
28 27
             jslintstring = dom.q('#JSLINT_JSLINTSTRING'),
@@ -171,14 +170,6 @@ ADSAFE.lib("init_ui", function (lib) {
171 170
             show_options();
172 171
         });
173 172
 
174  
-        dom.q('#JSLINT_GOODPARTS').on('click', function () {
175  
-            goodparts.each(function (bunch) {
176  
-                ADSAFE.set(option, bunch.getTitle(), true);
177  
-            });
178  
-            option.indent = 4;
179  
-            show_options();
180  
-        });
181  
-
182 173
         table.on('click', update_box);
183 174
         indent.on('change', update_number);
184 175
         maxerr.on('change', update_number);
114  jslint.html
@@ -166,7 +166,6 @@
166 166
       WARNING: JSLint can help you improve the quality of your programs.
167 167
       </div>
168 168
 </div>
169  
-<p id="JSLINT_JSLINTSTRING"></p>
170 169
 <pre id="JSLINT_TREE"></pre>
171 170
 <p>
172 171
     <input type="button" name="jslint" value="JSLint">
@@ -174,112 +173,102 @@
174 173
     <input type="button" name="tree" value="Syntax Tree">
175 174
     &nbsp; &nbsp;
176 175
     <input type="button" name="clear" value="clear">
  176
+    &nbsp; &nbsp;
  177
+    <input type="button" id="JSLINT_CLEARALL" value="Clear All Options">
177 178
 </p>
178 179
 <p id="JSLINT_OPTIONS">
179  
-      <table id="JSLINT_TABLE" cols="6"><tbody>
  180
+      <table id="JSLINT_TABLE" border="0">
180 181
           <tr>
181  
-              <td><span title="white" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
182  
-              <td title="white">Strict white space</td>
183 182
               <td><span title="devel">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
184 183
               <td title="devel">Assume&nbsp;<code>console</code>,&nbsp;<code>alert</code>,&nbsp;...</td>
185  
-              <td><span title="debug">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
186  
-              <td title="debug">Tolerate&nbsp;<tt>debugger</tt>&nbsp;statements</td>
  184
+              <td><span title="bitwise">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  185
+              <td title="bitwise">Tolerate bitwise operators</td>
  186
+              <td><span title="unparam">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  187
+              <td title="unparam">Tolerate&nbsp;unused&nbsp;parameters</td>
187 188
           </tr>
188 189
           <tr>
189  
-              <td><span title="onevar" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
190  
-              <td title="onevar">Allow one&nbsp;<tt>var</tt>&nbsp;statement per function</td>
191 190
               <td><span title="browser">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
192 191
               <td title="browser">Assume a browser</td>
193  
-              <td><span title="evil">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
194  
-              <td title="evil">Tolerate&nbsp;<tt>eval</tt></td>
  192
+              <td><span title="continue">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  193
+              <td title="continue">Tolerate&nbsp;<tt>continue</tt></td>
  194
+              <td><span title="sloppy">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  195
+              <td title="sloppy">Tolerate&nbsp;missisng&nbsp;<code>'use&nbsp;strict'</code>&nbsp;pragma</td>
195 196
           </tr>
196 197
           <tr>
197  
-              <td><span title="undef" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
198  
-              <td title="undef">Disallow undefined variables</td>
199 198
               <td><span title="node">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
200 199
               <td title="node">Assume&nbsp;<a href="http://nodejs.org/">Node.js</a></td>
201  
-              <td><span title="forin">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
202  
-              <td title="forin">Tolerate&nbsp;<a href="http://yuiblog.com/blog/2006/09/26/for-in-intrigue/">unfiltered</a>&nbsp;<tt>for</tt> <tt>in</tt></td>
  200
+              <td><span title="debug">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  201
+              <td title="debug">Tolerate&nbsp;<tt>debugger</tt>&nbsp;statements</td>
  202
+              <td><span title="sub">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  203
+              <td title="sub">Tolerate&nbsp;inefficient&nbsp;subscripting</td>
203 204
           </tr>
204 205
           <tr>
205  
-              <td><span title="nomen" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
206  
-              <td title="nomen">Disallow dangling&nbsp;<tt>_</tt>&nbsp;in identifiers</td>
207 206
               <td><span title="rhino">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
208 207
               <td title="rhino">Assume&nbsp;<a href="http://www.mozilla.org/rhino/">Rhino</a></td>
209  
-              <td><span title="sub">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
210  
-              <td title="sub">Tolerate inefficient subscripting</td>
  208
+              <td><span title="es5">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  209
+              <td title="es5">Tolerate&nbsp;ES5&nbsp;syntax</td>
  210
+              <td><span title="type">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  211
+              <td title="type">Tolerate&nbsp;type&nbsp;inconsistency</td>
211 212
           </tr>
212 213
           <tr>
213  
-              <td><span title="regexp" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
214  
-              <td title="regexp">Disallow&nbsp;<tt>.</tt>&nbsp;and&nbsp;<tt>[^</tt>...<tt>]</tt>&nbsp;in&nbsp;/RegExp/</td>
215 214
               <td><span title="widget">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
216 215
               <td title="widget">Assume a&nbsp;<a href="http://widgets.yahoo.com/tools/">Yahoo Widget</a></td>
217  
-              <td><span title="type">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
218  
-              <td title="type">Tolerate&nbsp;type&nbsp;inconsistency</td>
  216
+              <td><span title="evil">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  217
+              <td title="evil">Tolerate&nbsp;<tt>eval</tt></td>
  218
+              <td><span title="vars">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  219
+              <td title="vars">Tolerate many&nbsp;<tt>var</tt>&nbsp;statements per function</td>
219 220
           </tr>
220 221
           <tr>
221  
-              <td><span title="plusplus" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
222  
-              <td title="plusplus">Disallow&nbsp;<tt>++</tt>&nbsp;and&nbsp;<tt>--</tt></td>
223 222
               <td><span title="windows">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
224  
-              <td title="windows">Assume Windows</td>
225  
-              <td><span title="continue">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
226  
-              <td title="continue">Tolerate&nbsp;<tt>continue</tt></td>
227  
-          </tr>
228  
-          <tr>
229  
-              <td><span title="bitwise" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
230  
-              <td title="bitwise">Disallow bitwise operators</td>
231  
-              <td><span title="passfail">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
232  
-              <td title="passfail">Stop on first error</td>
233  
-              <td><span title="unparam">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
234  
-              <td title="unparam">Tolerate unused parameters</td>
  223
+              <td title="windows">Assume&nbsp;Windows</td>
  224
+              <td><span title="forin">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  225
+              <td title="forin">Tolerate&nbsp;<a href="http://yuiblog.com/blog/2006/09/26/for-in-intrigue/">unfiltered</a>&nbsp;<tt>for</tt>&nbsp;<tt>in</tt></td>
  226
+              <td><span title="white">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  227
+              <td title="white">Tolerate&nbsp;messy&nbsp;white space</td>
235 228
           </tr>
236 229
           <tr>
237  
-              <td></td>
238  
-              <td></td>
239  
-              <td></td>
240  
-              <td></td>
241  
-              <td><span title="es5">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
242  
-              <td title="es5">Tolerate ES5 syntax</td>
  230
+              <td>&nbsp;</td>
  231
+              <td>&nbsp;</td>
  232
+              <td><span title="newcap">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  233
+              <td title="newcap">Tolerate uncapitalized constructors</td>
  234
+              <td>&nbsp;</td>
  235
+              <td title="sloppy">&nbsp;</td>
243 236
           </tr>
244 237
           <tr>
245  
-              <td></td>
246  
-              <td></td>
247  
-              <td></td>
248  
-              <td></td>
  238
+              <td><span title="passfail">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  239
+              <td title="passfail">Stop&nbsp;on&nbsp;first&nbsp;error</td>
  240
+              <td><span title="nomen">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  241
+              <td title="nomen">Tolerate dangling&nbsp;<tt>_</tt>&nbsp;in identifiers</td>
249 242
               <td><span title="css">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
250  
-              <td title="css">Tolerate CSS workarounds</td>
  243
+              <td title="css">Tolerate&nbsp;CSS&nbsp;workarounds</td>
251 244
           </tr>
252 245
           <tr>
253  
-              <td></td>
254  
-              <td></td>
255  
-              <td></td>
256  
-              <td></td>
  246
+              <td>&nbsp;</td>
  247
+              <td>&nbsp;</td>
  248
+              <td><span title="plusplus">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  249
+              <td title="plusplus">Tolerate&nbsp;<tt>++</tt>&nbsp;and&nbsp;<tt>--</tt></td>
257 250
               <td><span title="cap">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
258 251
               <td title="cap">Tolerate&nbsp;<tt>HTML</tt>&nbsp;case</td>
259 252
           </tr>
260 253
           <tr>
261  
-              <td><span title="newcap" class="goodpart">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
262  
-              <td title="newcap">Require Initial Caps for constructors</td>
263 254
               <td><span title="safe">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
264  
-              <td title="safe">Safe Subset</td>
  255
+              <td title="safe">Safe&nbsp;Subset</td>
  256
+              <td><span title="regexp">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  257
+              <td title="regexp">Tolerate&nbsp;<tt>.</tt>&nbsp;and&nbsp;<tt>[^</tt>...<tt>]</tt>&nbsp;in&nbsp;/RegExp/</td>
265 258
               <td><span title="on">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
266 259
               <td title="on">Tolerate&nbsp;<tt>HTML</tt>&nbsp;event handlers</td>
267 260
           </tr>
268 261
           <tr>
269  
-              <td><span title="strict" class="box goodparts">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
270  
-              <td title="strict">Require&nbsp;<tt>'use strict';</tt></td>
271 262
               <td><span title="adsafe">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
272 263
               <td title="adsafe">Verify&nbsp;<a href="http://www.ADsafe.org">ADsafe</a></td>
  264
+              <td><span title="undef">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
  265
+              <td title="undef">Tolerate&nbsp;misordered&nbsp;definitions</td>
273 266
               <td><span title="fragment">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
274 267
               <td title="fragment">Tolerate&nbsp;<tt>HTML</tt>&nbsp;fragments</td>
275 268
           </tr>
276  
-      </tbody></table>
277  
-      <br clear=all>
278  
-<div class="leftcolumn">
279  
-    <input type="button" id="JSLINT_GOODPARTS" value="The Good Parts">
280  
-    <br><br>
281  
-    <input type="button" id="JSLINT_CLEARALL" value="Clear All Options">
282  
-</div>
  269
+      </table>
  270
+      <p><br clear=all>
  271
+    </p>
283 272
 <div id=JSLINT_FIELDS>
284 273
     <input id="JSLINT_INDENT" type="text" size="2" title="indent" value="" autocomplete=off> <label for="JSLINT_INDENT" title="indent">Indentation</label><br>
285 274
     <input id="JSLINT_MAXLEN" type="text" size="2" title="maxlen" value="" autocomplete=off> <label for="JSLINT_MAXLEN" title="maxlen">Maximum line length</label><br>
@@ -287,6 +276,7 @@
287 276
     <label title=predef for="JSLINT_PREDEF">Predefined&nbsp;<small>(&nbsp;<code>,</code>&nbsp;separated)</small></label>&nbsp;<input id="JSLINT_PREDEF" type="text" size="72" autocomplete=off title=predef>
288 277
   </div>
289 278
 </p>
  279
+<p id="JSLINT_JSLINTSTRING"></p>
290 280
 <p> Copyright 2002&nbsp;<a href="http://www.JSLint.com/lint.html">Douglas
291 281
   Crockford.</a>&nbsp;<a target="_blank" href="http://www.crockford.com/">All
292 282
   Rights Reserved Wrrrldwide and Beyond!</a> <br>
133  jslint.js
... ...
@@ -1,5 +1,5 @@
1 1
 // jslint.js
2  
-// 2011-06-07
  2
+// 2011-06-08
3 3
 
4 4
 // Copyright (c) 2002 Douglas Crockford  (www.JSLint.com)
5 5
 
@@ -156,7 +156,7 @@
156 156
 // The current option set is
157 157
 
158 158
 //     adsafe     true, if ADsafe rules should be enforced
159  
-//     bitwise    true, if bitwise operators should not be allowed
  159
+//     bitwise    true, if bitwise operators should be allowed
160 160
 //     browser    true, if the standard browser globals should be predefined
161 161
 //     cap        true, if upper case HTML should be allowed
162 162
 //     'continue' true, if the continuation statement should be tolerated
@@ -170,29 +170,29 @@
170 170
 //     indent     the indentation factor
171 171
 //     maxerr     the maximum number of errors to allow
172 172
 //     maxlen     the maximum length of a source line
173  
-//     newcap     true, if constructor names must be capitalized
  173
+//     newcap     true, if constructor names capitalization is ignored
174 174
 //     node       true, if Node.js globals should be predefined
175  
-//     nomen      true, if names should be checked
  175
+//     nomen      true, if names may have dangling _
176 176
 //     on         true, if HTML event handlers should be allowed
177  
-//     onevar     true, if only one var statement per function should be allowed
178 177
 //     passfail   true, if the scan should stop on first error
179  
-//     plusplus   true, if increment/decrement should not be allowed
180  
-//     regexp     true, if the . should not be allowed in regexp literals
  178
+//     plusplus   true, if increment/decrement should be allowed
  179
+//     regexp     true, if the . should be allowed in regexp literals
181 180
 //     rhino      true, if the Rhino environment globals should be predefined
182  
-//     undef      true, if variables should be declared before used
  181
+//     undef      true, if variables can be declared out of order
183 182
 //     unparam    true, if unused parameters should be tolerated
184 183
 //     safe       true, if use of some browser features should be restricted
185  
-//     type       true, if types can be used inconsistently
186  
-//     windows    true, if MS Windows-specific globals should be predefined
187  
-//     strict     true, require the 'use strict'; pragma
  184
+//     sloppy     true, if the 'use strict'; pragma is optional
188 185
 //     sub        true, if all forms of subscript notation are tolerated
189  
-//     white      true, if strict whitespace rules apply
  186
+//     type       true, if types can be used inconsistently
  187
+//     vars       true, if multiple var statements per function should be allowed
  188
+//     white      true, if sloppy whitespace is tolerated
190 189
 //     widget     true  if the Yahoo Widgets globals should be predefined
  190
+//     windows    true, if MS Windows-specific globals should be predefined
191 191
 
192 192
 // For example:
193 193
 
194 194
 /*jslint
195  
-    evil: true, nomen: false, regexp: false, strict: true
  195
+    evil: true, nomen: true, regexp: true
196 196
 */
197 197
 
198 198
 // The properties directive declares an exclusive list of property names.
@@ -203,7 +203,7 @@
203 203
 
204 204
 /*properties '\b', '\t', '\n', '\f', '\r', '!=', '!==', '"', '%',
205 205
     '&', '\'', '(begin)', '(breakage)', '(complexity)', '(context)',
206  
-    '(error)', '(identifier)', '(line)', '(loopage)', '(name)', '(onevar)',
  206
+    '(error)', '(identifier)', '(line)', '(loopage)', '(name)', '(vars)',
207 207
     '(params)', '(scope)', '(statement)', '(token)', '(verb)', ')', '*',
208 208
     '+', '-', '/', ';', '<', '<<', '<=', '==', '===', '>',
209 209
     '>=', '>>', '>>>', ADSAFE, ActiveXObject, Array,
@@ -308,7 +308,7 @@
308 308
     nested_comment, newcap, next, node, noframes, nomen, noscript, not,
309 309
     not_a_constructor, not_a_defined, not_a_function, not_a_label,
310 310
     not_a_scope, not_greater, nud, object, ol, oldlace, olive, olivedrab,
311  
-    on, onevar, opacity, open, openURL, opera, optgroup, option, orange,
  311
+    on, vars, opacity, open, openURL, opera, optgroup, option, orange,
312 312
     orangered, orchid, outer, outline, 'outline-color', 'outline-style',
313 313
     'outline-width', output, overflow, 'overflow-x', 'overflow-y', p,
314 314
     padding, 'padding-bottom', 'padding-left', 'padding-right',
@@ -327,8 +327,8 @@
327 327
     savePreferences, scanned_a_b, screen, script, scrollbar, seagreen, seal,
328 328
     search, seashell, second, section, select, serialize, sessionStorage,
329 329
     setInterval, setTimeout, shift, showWidgetPreferences, sienna, silver,
330  
-    skyblue, slash_equal, slateblue, slategray, sleep, slice, small, snow,
331  
-    sort, source, span, spawn, speak, speech, split, springgreen, src,
  330
+    skyblue, slash_equal, slateblue, slategray, sleep, slice, sloppy, small,
  331
+    snow, sort, source, span, spawn, speak, speech, split, springgreen, src,
332 332
     stack, statement_block, steelblue, stopping, strange_loop, strict,
333 333
     strong, style, styleproperty, sub, subscript, substr, sup, supplant,
334 334
     suppressUpdates, sync, system, t, table, 'table-layout', tag_a_in_b,
@@ -882,7 +882,7 @@ var JSLINT = (function () {
882 882
         funct,          // The current function, including the labels used
883 883
                         // in the function, as well as (verb), (context),
884 884
                         // (statement), (name), (params), (complexity),
885  
-                        // (loopage), (breakage), (onevar)
  885
+                        // (loopage), (breakage), (vars)
886 886
 
887 887
         functionicity = [
888 888
             'closure', 'exception', 'global', 'label', 'outer', 'undef',
@@ -1032,8 +1032,8 @@ var JSLINT = (function () {
1032 1032
             require      : false,
1033 1033
             setInterval  : false,
1034 1034
             setTimeout   : false,
1035  
-            __filename   : false,
1036  
-            __dirname    : false
  1035
+            __dirname    : false,
  1036
+            __filename   : false
1037 1037
         },
1038 1038
         node_js,
1039 1039
         numbery = {
@@ -1230,13 +1230,13 @@ var JSLINT = (function () {
1230 1230
 
1231 1231
 //  xmode is used to adapt to the exceptions in html parsing.
1232 1232
 //  It can have these states:
1233  
-//      false   .js script file
1234  
-//      html
1235  
-//      outer
1236  
-//      script
1237  
-//      style
1238  
-//      scriptstring
1239  
-//      styleproperty
  1233
+//      ''      .js script file
  1234
+//      'html'
  1235
+//      'outer'
  1236
+//      'script'
  1237
+//      'style'
  1238
+//      'scriptstring'
  1239
+//      'styleproperty'
1240 1240
 
1241 1241
         xmode,
1242 1242
         xquote,
@@ -1485,7 +1485,7 @@ var JSLINT = (function () {
1485 1485
     }
1486 1486
 
1487 1487
     function expected_at(at) {
1488  
-        if (option.white && next_token.from !== at) {
  1488
+        if (!option.white && next_token.from !== at) {
1489 1489
             warn('expected_a_at_b_c', next_token, next_token.value, at,
1490 1490
                 next_token.from);
1491 1491
         }
@@ -1574,7 +1574,7 @@ var JSLINT = (function () {
1574 1574
                 the_token.identifier = true;
1575 1575
                 if (value === '__iterator__' || value === '__proto__') {
1576 1576
                     stop_at('reserved_a', line, from, value);
1577  
-                } else if (option.nomen &&
  1577
+                } else if (!option.nomen &&
1578 1578
                         (value.charAt(0) === '_' ||
1579 1579
                         value.charAt(value.length - 1) === '_')) {
1580 1580
                     warn_at('dangling_a', line, from, value);
@@ -1997,7 +1997,7 @@ var JSLINT = (function () {
1997 1997
                                         c = source_row.charAt(length);
1998 1998
                                         if (c === '^') {
1999 1999
                                             length += 1;
2000  
-                                            if (option.regexp) {
  2000
+                                            if (!option.regexp) {
2001 2001
                                                 warn_at('insecure_a',
2002 2002
                                                     line, from + length, c);
2003 2003
                                             } else if (source_row.charAt(length) === ']') {
@@ -2081,7 +2081,7 @@ klass:                                  do {
2081 2081
                                         } while (c);
2082 2082
                                         break;
2083 2083
                                     case '.':
2084  
-                                        if (option.regexp) {
  2084
+                                        if (!option.regexp) {
2085 2085
                                             warn_at('insecure_a', line,
2086 2086
                                                 from + length, c);
2087 2087
                                         }
@@ -2304,7 +2304,7 @@ klass:                                  do {
2304 2304
 
2305 2305
             if (typeof funct[name] === 'string') {
2306 2306
                 if (funct[name] === 'undef') {
2307  
-                    if (option.undef) {
  2307
+                    if (!option.undef) {
2308 2308
                         warn('used_before_a', token, name);
2309 2309
                     }
2310 2310
                     kind = 'var';
@@ -2478,16 +2478,16 @@ klass:                                  do {
2478 2478
                 option.devel   =
2479 2479
                 option.evil    =
2480 2480
                 option.forin   =
  2481
+                option.newcap  =
  2482
+                option.nomen   =
2481 2483
                 option.on      =
2482 2484
                 option.rhino   =
  2485
+                option.sloppy  =
2483 2486
                 option.sub     =
  2487
+                option.undef   =
2484 2488
                 option.widget  =
2485 2489
                 option.windows = false;
2486 2490
 
2487  
-            option.newcap      =
2488  
-                option.nomen   =
2489  
-                option.strict  =
2490  
-                option.undef   = true;
2491 2491
 
2492 2492
             delete predefined.Date;
2493 2493
             delete predefined['eval'];
@@ -2623,7 +2623,7 @@ klass:                                  do {
2623 2623
             warn('missing_space_a_b', next_token, token.value, next_token.value);
2624 2624
         }
2625 2625
         comments_off = true;
2626  
-        option.white = false;
  2626
+        option.white = true;
2627 2627
         if (lookahead.length > 0 || next_token.comments) {
2628 2628
             warn('unexpected_a', this);
2629 2629
         }
@@ -2712,7 +2712,7 @@ klass:                                  do {
2712 2712
     function one_space(left, right) {
2713 2713
         left = left || token;
2714 2714
         right = right || next_token;
2715  
-        if (right.id !== '(end)' && option.white &&
  2715
+        if (right.id !== '(end)' && !option.white &&
2716 2716
                 (token.line !== right.line ||
2717 2717
                 token.thru + 1 !== right.from)) {
2718 2718
             warn('expected_space_a_b', right, token.value, right.value);
@@ -2723,7 +2723,7 @@ klass:                                  do {
2723 2723
         left = left || token;
2724 2724
         right = right || next_token;
2725 2725
         if (right.id !== '(end)' && (left.line !== right.line ||
2726  
-                (option.white && left.thru + 1 !== right.from))) {
  2726
+                (!option.white && left.thru + 1 !== right.from))) {
2727 2727
             warn('expected_space_a_b', right, left.value, right.value);
2728 2728
         }
2729 2729
     }
@@ -2731,7 +2731,7 @@ klass:                                  do {
2731 2731
     function no_space(left, right) {
2732 2732
         left = left || token;
2733 2733
         right = right || next_token;
2734  
-        if ((option.white || xmode === 'styleproperty' || xmode === 'style') &&
  2734
+        if ((!option.white || xmode === 'styleproperty' || xmode === 'style') &&
2735 2735
                 left.thru !== right.from && left.line === right.line) {
2736 2736
             warn('unexpected_space_a_b', right, left.value, right.value);
2737 2737
         }
@@ -2741,13 +2741,13 @@ klass:                                  do {
2741 2741
         left = left || token;
2742 2742
         right = right || next_token;
2743 2743
         if (right.id !== '(end)' && (left.line !== right.line ||
2744  
-                (option.white && left.thru !== right.from))) {
  2744
+                (!option.white && left.thru !== right.from))) {
2745 2745
             warn('unexpected_space_a_b', right, left.value, right.value);
2746 2746
         }
2747 2747
     }
2748 2748
 
2749 2749
     function spaces(left, right) {
2750  
-        if (option.white) {
  2750
+        if (!option.white) {
2751 2751
             left = left || token;
2752 2752
             right = right || next_token;
2753 2753
             if (left.thru === right.from && left.line === right.line) {
@@ -2760,7 +2760,7 @@ klass:                                  do {
2760 2760
         if (next_token.id !== ',') {
2761 2761
             warn_at('expected_a_b', token.line, token.thru, ',', next_token.value);
2762 2762
         } else {
2763  
-            if (option.white) {
  2763
+            if (!option.white) {
2764 2764
                 no_space_only();
2765 2765
             }
2766 2766
             advance(',');
@@ -2774,7 +2774,7 @@ klass:                                  do {
2774 2774
         if (next_token.id !== ';') {
2775 2775
             warn_at('expected_a_b', token.line, token.thru, ';', next_token.value);
2776 2776
         } else {
2777  
-            if (option.white) {
  2777
+            if (!option.white) {
2778 2778
                 no_space_only();
2779 2779
             }
2780 2780
             advance(';');
@@ -2794,8 +2794,8 @@ klass:                                  do {
2794 2794
             advance();
2795 2795
             semicolon();
2796 2796
             strict_mode = true;
2797  
-            option.newcap = true;
2798  
-            option.undef = true;
  2797
+            option.newcap = false;
  2798
+            option.undef = false;
2799 2799
             return true;
2800 2800
         } else {
2801 2801
             return false;
@@ -2988,7 +2988,7 @@ klass:                                  do {
2988 2988
             this.first = expression(150);
2989 2989
             this.arity = 'prefix';
2990 2990
             if (this.id === '++' || this.id === '--') {
2991  
-                if (option.plusplus) {
  2991
+                if (!option.plusplus) {
2992 2992
                     warn('unexpected_a', this);
2993 2993
                 } else if ((!this.first.identifier || this.first.reserved) &&
2994 2994
                         this.first.id !== '.' && this.first.id !== '[') {
@@ -3078,7 +3078,7 @@ klass:                                  do {
3078 3078
                 spaces(prev_token, token);
3079 3079
                 spaces();
3080 3080
             }
3081  
-            if (option.bitwise && this.bitwise) {
  3081
+            if (!option.bitwise && this.bitwise) {
3082 3082
                 warn('unexpected_a', this);
3083 3083
             }
3084 3084
             if (typeof f === 'function') {
@@ -3183,8 +3183,14 @@ klass:                                  do {
3183 3183
         var x = infix(s, 20, function (left, that) {
3184 3184
             var l;
3185 3185
             that.first = left;
3186  
-            if (left.identifier && scope[left.value].writeable === false) {
3187  
-                warn('read_only', left);
  3186
+            if (left.identifier) {
  3187
+                if (scope[left.value]) {
  3188
+                    if (scope[left.value].writeable === false) {
  3189
+                        warn('read_only', left);
  3190
+                    }
  3191
+                } else {
  3192
+                    stop('read_only');
  3193
+                }
3188 3194
             } else if (option.safe) {
3189 3195
                 l = left;
3190 3196
                 do {
@@ -3246,7 +3252,7 @@ klass:                                  do {
3246 3252
         var x = symbol(s, 150);
3247 3253
         x.led = function (left) {
3248 3254
             no_space_only(prev_token, token);
3249  
-            if (option.plusplus) {
  3255
+            if (!option.plusplus) {
3250 3256
                 warn('unexpected_a', this);
3251 3257
             } else if ((!left.identifier || left.reserved) &&
3252 3258
                     left.id !== '.' && left.id !== '[') {
@@ -3415,7 +3421,7 @@ klass:                                  do {
3415 3421
             advance('{');
3416 3422
             step_in();
3417 3423
             if (!ordinary && !use_strict() && !old_strict_mode &&
3418  
-                    option.strict && funct['(context)'] === global_funct) {
  3424
+                    !option.sloppy && funct['(context)'] === global_funct) {
3419 3425
                 warn('missing_use_strict');
3420 3426
             }
3421 3427
             array = statements();
@@ -3480,7 +3486,7 @@ klass:                                  do {
3480 3486
 // in the global scope, then we have an undefined variable error.
3481 3487
 
3482 3488
                 } else {
3483  
-                    if (option.undef) {
  3489
+                    if (!option.undef) {
3484 3490
                         warn('used_before_a', token);
3485 3491
                     }
3486 3492
                     scope[name] = variable = {
@@ -3575,7 +3581,9 @@ klass:                                  do {
3575 3581
 // Build the syntax table by declaring the syntactic elements.
3576 3582
 
3577 3583
     type('(color)', 'color');
  3584
+    type('(function)', 'function');
3578 3585
     type('(number)', 'number', return_this);
  3586
+    type('(object)', 'object');
3579 3587
     type('(string)', 'string', return_this);
3580 3588
     type('(boolean)', 'boolean', return_this);
3581 3589
     type('(range)', 'range');
@@ -3862,7 +3870,7 @@ klass:                                  do {
3862 3870
 
3863 3871
     prefix('~', function () {
3864 3872
         no_space_only();
3865  
-        if (option.bitwise) {
  3873
+        if (!option.bitwise) {
3866 3874
             warn('unexpected_a', this);
3867 3875
         }
3868 3876
         expression(150);
@@ -3935,7 +3943,7 @@ klass:                                  do {
3935 3943
                 default:
3936 3944
                     if (c.id !== 'function') {
3937 3945
                         v = c.value.substr(0, 1);
3938  
-                        if (option.newcap && (v < 'A' || v > 'Z')) {
  3946
+                        if (!option.newcap && (v < 'A' || v > 'Z')) {
3939 3947
                             warn('constructor_name_a', token);
3940 3948
                         }
3941 3949
                     }
@@ -3965,6 +3973,7 @@ klass:                                  do {
3965 3973
         }
3966 3974
         var p = [];
3967 3975
         if (left) {
  3976
+            conform_type(syntax['(function)'], left);
3968 3977
             if (left.identifier) {
3969 3978
                 if (left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)) {
3970 3979
                     if (left.value !== 'Number' && left.value !== 'String' &&
@@ -3973,7 +3982,7 @@ klass:                                  do {
3973 3982
                             warn('not_a_function', left);
3974 3983
                         } else if (left.value === 'Object') {
3975 3984
                             warn('use_object', token);
3976  
-                        } else if (left.value === 'Array' || option.newcap) {
  3985
+                        } else if (left.value === 'Array' || !option.newcap) {
3977 3986
                             warn('missing_a', left, 'new');
3978 3987
                         }
3979 3988
                     }
@@ -4481,10 +4490,10 @@ klass:                                  do {
4481 4490
 
4482 4491
         var assign, id, name;
4483 4492
 
4484  
-        if (funct['(onevar)'] && option.onevar) {
  4493
+        if (funct['(vars)'] && !option.vars) {
4485 4494
             warn('combine_var');
4486 4495
         } else if (funct !== global_funct) {
4487  
-            funct['(onevar)'] = true;
  4496
+            funct['(vars)'] = true;
4488 4497
         }
4489 4498
         this.arity = 'statement';
4490 4499
         this.first = [];
@@ -4841,11 +4850,13 @@ klass:                                  do {
4841 4850
             default:
4842 4851
                 warn('bad_in_a', value);
4843 4852
             }
  4853
+            conform_type(syntax['(string)'], value);
4844 4854
             advance();
4845 4855
             the_in = next_token;
4846 4856
             advance('in');
4847 4857
             the_in.first = value;
4848 4858
             the_in.second = expression(20);
  4859
+            conform_type(syntax['(object)'], the_in.second);
4849 4860
             step_out(')', paren);
4850 4861
             discard();
4851 4862
             this.first = the_in;
@@ -6258,7 +6269,7 @@ klass:                                  do {
6258 6269
                         }
6259 6270
                         warn('bad_name_a');
6260 6271
                     }
6261  
-                    option.white = true;
  6272
+                    option.white = false;
6262 6273
                     spaces();
6263 6274
                     attribute = next_token.value;
6264 6275
                     option.white = old_white;
@@ -6283,7 +6294,7 @@ klass:                                  do {
6283 6294
                         }
6284 6295
                         xquote = quote;
6285 6296
                         wmode = option.white;
6286  
-                        option.white = false;
  6297
+                        option.white = true;
6287 6298
                         advance(quote);
6288 6299
                         use_strict();
6289 6300
                         statements();
@@ -6801,7 +6812,7 @@ klass:                                  do {
6801 6812
     };
6802 6813
     itself.jslint = itself;
6803 6814
 
6804  
-    itself.edition = '2011-06-07';
  6815
+    itself.edition = '2011-06-08';
6805 6816
 
6806 6817
     return itself;
6807 6818
 
62  lint.html
@@ -177,7 +177,7 @@ <h2 id=scope>Scope</h2>
177 177
   be declared at the site of first use. But because JavaScript does not
178 178
   have block scope, it is wiser to declare all of a function's variables
179 179
   at the top of the function. It is recommended that a single <code>var</code>
180  
-  statement be used per function. This can be enforced with the <code>onevar</code>
  180
+  statement be used per function. This can be declined with the <code>vars</code>
181 181
   <a href="#options">option</a>.</p>
182 182
 
183 183
 <h2 id=required>Required Blocks</h2>
@@ -308,15 +308,15 @@ <h2 id=inc><code>++</code> and <code>--</code></h2>
308 308
 <p>The <code>++</code> <small>(increment)</small> and <code>--</code> <small>(decrement)</small>
309 309
   operators have been known to contribute to bad code by encouraging excessive
310 310
   trickiness. They are second only to faulty architecture in enabling to
311  
-  viruses and other security menaces. There is a <code>plusplus</code> <a href="#options">option</a>
312  
-  that prohibits the use of these operators.</p>
  311
+  viruses and other security menaces. Also, preincrement/postincrement confusion can produce off-by-one errors that are extrenmely difficult to diagnose. There is a <code>plusplus</code> <a href="#options">option</a>
  312
+  that allows the use of these operators.</p>
313 313
 <h2 id=bitwise>Bitwise Operators</h2>
314 314
 <p>JavaScript does not have an integer type, but it does have bitwise operators.
315 315
   The bitwise operators convert their operands from floating point to integers
316 316
   and back, so they are not as efficient as in C or other languages. They
317 317
   are rarely useful in browser applications. The similarity to the logical
318 318
   operators can mask some programming errors. The <code>bitwise</code> <a href="#options">option</a>
319  
-  prohibits the use of these operators: <code>&lt;&lt; &gt;&gt; &gt;&gt;&gt;
  319
+  allows the use of these operators: <code>&lt;&lt; &gt;&gt; &gt;&gt;&gt;
320 320
   ~ &amp; |</code>.</p>
321 321
 <h2 id=evil><code>eval</code> is evil</h2>
322 322
 <p>The <code>eval</code> function (and its relatives, <code>Function</code>,
@@ -352,7 +352,7 @@ <h2 id=new>Constructors and <code>new</code></h2>
352 352
   to see a function invocation with an initial uppercase name unless it
353 353
   has the <code>new</code> prefix. <code>JSLint</code> does not expect to
354 354
   see the <code>new</code> prefix used with functions whose names do not
355  
-  start with initial uppercase. This can be controlled with the <code>newcap</code>
  355
+  start with initial uppercase. This can be disabled with the <code>newcap</code>
356 356
   <a href="#options">option</a>.</p>
357 357
 <p><code>JSLint</code> does not expect to see the wrapper forms <code>new Number</code>,
358 358
   <code>new String</code>, <code>new Boolean</code>. </p>
@@ -423,11 +423,7 @@ <h2 id=css>CSS</h2>
423 423
 <h2 id=options>Options</h2>
424 424
 <p><code>JSLint</code> provides several options that control its operation and
425 425
   its sensitivity. In the <a href="http://www.JSLint.com/">web edition</a>, the
426  
-  options are selected with several checkboxes and two fields. Clicking on
427  
-  the <a href="http://www.amazon.com/exec/obidos/ASIN/0596517742/wrrrldwideweb"
428  
-  target="_blank"><input type="button" value="Good Parts"></a> button will give
429  
-  you the ideal settings.
430  
-</p>
  426
+options are selected with several checkboxes and two fields. </p>
431 427
 <p>It also provides assistance in constructing <code>/*jslint*/</code>
432 428
   comments.
433 429
 </p>
@@ -438,7 +434,7 @@ <h2 id=options>Options</h2>
438 434
 <p>Options can also be specified within a script with a <code>/*jslint */</code>
439 435
   directive:</p>
440 436
 <pre>/*jslint nomen: true, debug: true,
441  
-    evil: false, onevar: true */</pre>
  437
+    evil: false, vars: true */</pre>
442 438
 <p>An option specification starts with <code>/*jslint</code>. Notice that
443 439
   there is no space before the <code>j</code>. The specification contains
444 440
   a sequence of name value pairs, where the names are <code>JSLint</code>
@@ -459,9 +455,9 @@ <h2 id=options>Options</h2>
459 455
       rules should be enforced. See <a href="http://www.ADsafe.org/">http://www.ADsafe.org/</a>.</td>
460 456
   </tr>
461 457
   <tr>
462  
-    <td>Disallow bitwise operators </td>
  458
+    <td>Tolerate bitwise operators </td>
463 459
     <td><code>bitwise</code></td>
464  
-    <td><code>true</code> if bitwise operators should not be allowed. <a href="#bitwise"><small>(more)</small></a></td>
  460
+    <td><code>true</code> if bitwise operators should  be allowed. <a href="#bitwise"><small>(more)</small></a></td>
465 461
   </tr>
466 462
   <tr>
467 463
     <td>Assume a browser </td>
@@ -533,10 +529,10 @@ <h2 id=options>Options</h2>
533 529
     <td>The maximum number of characters in a line</td>
534 530
   </tr>
535 531
   <tr>
536  
-    <td>Require Initial Caps for constructors </td>
  532
+    <td>Tolerate uncapitalized constructors</td>
537 533
     <td><code>newcap</code></td>
538  
-    <td><code>true</code> if Initial Caps must be used with constructor
539  
-      functions. <a href="#new"><small>(more)</small></a></td>
  534
+    <td><code>true</code> if Initial Caps  with constructor
  535
+      functions is optional. <a href="#new"><small>(more)</small></a></td>
540 536
   </tr>
541 537
   <tr>
542 538
     <td>Assume Node.js</td>
@@ -544,9 +540,9 @@ <h2 id=options>Options</h2>
544 540
     <td><code>true</code> if Node.js globals should be predefined <a href="#node"><small>(more)</small></a></td>
545 541
   </tr>
546 542
   <tr>
547  
-    <td>Disallow dangling _ in identifiers </td>
  543
+    <td>Tolerate dangling _ in identifiers </td>
548 544
     <td><code>nomen</code></td>
549  
-    <td><code>true</code> if names should be checked for initial or trailing underbars</td>
  545
+    <td><code>true</code> if names should not be checked for initial or trailing underbars</td>
550 546
   </tr>
551 547
   <tr>
552 548
     <td>Tolerate HTML event handlers </td>
@@ -554,9 +550,9 @@ <h2 id=options>Options</h2>
554 550
     <td><code>true</code> if HTML event handlers should be allowed. <a href="#html"><small>(more)</small></a></td>
555 551
   </tr>
556 552
   <tr>
557  
-    <td>Allow one <code>var</code> statement per function</td>
558  
-    <td><code>onevar</code></td>
559  
-    <td><code>true</code> if only one <code>var</code> statement per function
  553
+    <td>Tolerate many&nbsp;<tt>var</tt>&nbsp;statements per function</td>
  554
+    <td><code>var</code></td>
  555
+    <td><code>true</code> if multiple <code>var</code> statement per function
560 556
       should be allowed. <a href="#scope"><small>(more)</small></a></td>
561 557
   </tr>
562 558
   <tr>
@@ -565,10 +561,10 @@ <h2 id=options>Options</h2>
565 561
     <td><code>true</code> if the scan should stop on first error.</td>
566 562
   </tr>
567 563
   <tr>
568  
-    <td>Disallow <code>++</code> and <code>--</code> </td>
  564
+    <td>Tolerate <code>++</code> and <code>--</code> </td>
569 565
     <td><code>plusplus</code></td>
570 566
     <td><code>true</code> if <code>++</code> and <code>--</code> should
571  
-      not be allowed. <a href="#inc"><small>(more)</small></a></td>
  567
+       be allowed. <a href="#inc"><small>(more)</small></a></td>
572 568
   </tr>
573 569
   <tr>
574 570
     <td>Predefined <small>( , separated)</small></td>
@@ -578,9 +574,9 @@ <h2 id=options>Options</h2>
578 574
       statement to declare global variables in a script file.</td>
579 575
   </tr>
580 576
   <tr>
581  
-    <td>Disallow  <code>.</code> and <code>[^</code>...<code>]</code>. in /RegExp/ </td>
  577
+    <td>Tolerate  <code>.</code> and <code>[^</code>...<code>]</code>. in /RegExp/ </td>
582 578
     <td><code>regexp</code></td>
583  
-    <td><code>true</code> if <code>.</code> and <code>[^</code>...<code>]</code> should not be allowed in RegExp
  579
+    <td><code>true</code> if <code>.</code> and <code>[^</code>...<code>]</code> should  be allowed in RegExp
584 580
       literals. They match more material than might be expected, allowing attackers to confuse applications. These forms should not be used when validating in secure applications. </td>
585 581
   </tr>
586 582
   <tr>
@@ -597,10 +593,10 @@ <h2 id=options>Options</h2>
597 593
       the safe subset rules but not the widget structure rules.</td>
598 594
   </tr>
599 595
   <tr>
600  
-    <td>Require <code>&quot;use strict&quot;;</code> </td>
601  
-    <td><code>strict</code></td>
602  
-    <td><code>true</code> if the ES5 <code><a href="http://www.yuiblog.com/blog/2010/12/14/strict-mode-is-coming-to-town/">"use strict";</a></code> pragma
603  
-      is required. Do not use this option carelessly.</td>
  596
+    <td> Tolerate missing&nbsp;<code>'use strict'</code>&nbsp;pragma </td>
  597
+    <td><code>sloppy</code></td>
  598
+    <td><code>true</code> if the ES5 <code><a href="http://www.yuiblog.com/blog/2010/12/14/strict-mode-is-coming-to-town/">'use strict';</a></code> pragma
  599
+      is not required. Do not use this pragma unless you know what yo are doing.</td>
604 600
   </tr>
605 601
   <tr>
606 602
     <td>Tolerate inefficient subscripting<br>
@@ -616,14 +612,14 @@ <h2 id=options>Options</h2>
616 612
     <td><code>true</code> if variables are allowed to contain more than one type of value.</td>
617 613
   </tr>
618 614
   <tr>
619  
-    <td>Disallow undefined variables </td>
  615
+    <td> Tolerate misordered definitions </td>
620 616
     <td><code>undef</code></td>
621  
-    <td><code>true</code> if variables must be declared before used. <a href="#undefined"><small>(more)</small></a></td>
  617
+    <td><code>true</code> if variables and functions need not be declared before used. <a href="#undefined"><small>(more)</small></a></td>
622 618
   </tr>
623 619
   <tr>
624  
-    <td>Strict white space </td>
  620
+    <td> Tolerate messy white space</td>
625 621
     <td><code>white</code></td>
626  
-    <td><code>true</code> if strict whitespace rules apply.</td>
  622
+    <td><code>true</code> if strict whitespace rules should be ignored..</td>
627 623
   </tr>
628 624
   <tr>
629 625
     <td>Assume a Yahoo Widget </td>

1 note on commit a27d17c

Patric Nordmark

Uber, have silently been waiting for this change all the time :D

Please sign in to comment.
Something went wrong with that request. Please try again.