jslintrb 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  // jslint.js
2
- // 2010-01-20
2
+ // 2010-03-12
3
3
 
4
4
  /*
5
5
  Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
@@ -159,45 +159,46 @@ SOFTWARE.
159
159
  URL, Web, Window, XMLDOM, XMLHttpRequest, "\\", a, abbr, acronym,
160
160
  addEventListener, address, adsafe, alert, aliceblue, animator,
161
161
  antiquewhite, appleScript, applet, apply, approved, aqua, aquamarine,
162
- area, arguments, arity, autocomplete, azure, b, background,
163
- "background-attachment", "background-color", "background-image",
164
- "background-position", "background-repeat", base, bdo, beep, beige, big,
165
- bisque, bitwise, black, blanchedalmond, block, blockquote, blue,
166
- blueviolet, blur, body, border, "border-bottom", "border-bottom-color",
167
- "border-bottom-style", "border-bottom-width", "border-collapse",
168
- "border-color", "border-left", "border-left-color", "border-left-style",
169
- "border-left-width", "border-right", "border-right-color",
170
- "border-right-style", "border-right-width", "border-spacing",
171
- "border-style", "border-top", "border-top-color", "border-top-style",
172
- "border-top-width", "border-width", bottom, br, brown, browser,
173
- burlywood, button, bytesToUIString, c, cadetblue, call, callee, caller,
174
- canvas, cap, caption, "caption-side", cases, center, charAt, charCodeAt,
175
- character, chartreuse, chocolate, chooseColor, chooseFile, chooseFolder,
176
- cite, clear, clearInterval, clearTimeout, clip, close, closeWidget,
177
- closed, closure, cm, code, col, colgroup, color, comment, condition,
178
- confirm, console, constructor, content, convertPathToHFS,
179
- convertPathToPlatform, coral, cornflowerblue, cornsilk,
180
- "counter-increment", "counter-reset", create, crimson, css, cursor,
181
- cyan, d, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen,
162
+ area, arguments, arity, article, aside, audio, autocomplete, azure, b,
163
+ background, "background-attachment", "background-color",
164
+ "background-image", "background-position", "background-repeat", base,
165
+ bdo, beep, beige, big, bisque, bitwise, black, blanchedalmond, block,
166
+ blockquote, blue, blueviolet, blur, body, border, "border-bottom",
167
+ "border-bottom-color", "border-bottom-style", "border-bottom-width",
168
+ "border-collapse", "border-color", "border-left", "border-left-color",
169
+ "border-left-style", "border-left-width", "border-right",
170
+ "border-right-color", "border-right-style", "border-right-width",
171
+ "border-spacing", "border-style", "border-top", "border-top-color",
172
+ "border-top-style", "border-top-width", "border-width", bottom, br,
173
+ brown, browser, burlywood, button, bytesToUIString, c, cadetblue, call,
174
+ callee, caller, canvas, cap, caption, "caption-side", cases, center,
175
+ charAt, charCodeAt, character, chartreuse, chocolate, chooseColor,
176
+ chooseFile, chooseFolder, cite, clear, clearInterval, clearTimeout,
177
+ clip, close, closeWidget, closed, closure, cm, code, col, colgroup,
178
+ color, command, comment, condition, confirm, console, constructor,
179
+ content, convertPathToHFS, convertPathToPlatform, coral, cornflowerblue,
180
+ cornsilk, "counter-increment", "counter-reset", create, crimson, css,
181
+ cursor, cyan, d, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen,
182
182
  darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred,
183
183
  darksalmon, darkseagreen, darkslateblue, darkslategray, darkturquoise,
184
- darkviolet, data, dd, debug, decodeURI, decodeURIComponent, deeppink,
185
- deepskyblue, defaultStatus, defineClass, del, deserialize, devel, dfn,
186
- dimension, dimgray, dir, direction, display, div, dl, document,
187
- dodgerblue, dt, edition, else, em, embed, empty, "empty-cells",
188
- encodeURI, encodeURIComponent, entityify, eqeqeq, errors, escape, eval,
189
- event, evidence, evil, ex, exception, exec, exps, fieldset, filesystem,
190
- firebrick, first, float, floor, floralwhite, focus, focusWidget, font,
191
- "font-face", "font-family", "font-size", "font-size-adjust",
192
- "font-stretch", "font-style", "font-variant", "font-weight",
193
- forestgreen, forin, form, fragment, frame, frames, frameset, from,
194
- fromCharCode, fuchsia, fud, funct, function, functions, g, gainsboro,
195
- gc, getComputedStyle, ghostwhite, global, globals, gold, goldenrod,
196
- gray, green, greenyellow, h1, h2, h3, h4, h5, h6, hasOwnProperty, head,
197
- height, help, history, honeydew, hotpink, hr, html, i, iTunes, id,
198
- identifier, iframe, img, immed, implieds, in, include, indent, indexOf,
199
- indianred, indigo, init, input, ins, isAlpha, isApplicationRunning,
200
- isDigit, isFinite, isNaN, ivory, join, jslint, json, kbd, khaki,
184
+ darkviolet, data, datalist, dd, debug, decodeURI, decodeURIComponent,
185
+ deeppink, deepskyblue, defaultStatus, defineClass, del, deserialize,
186
+ details, devel, dfn, dialog, dimension, dimgray, dir, direction,
187
+ display, div, dl, document, dodgerblue, dt, edition, else, em, embed,
188
+ empty, "empty-cells", encodeURI, encodeURIComponent, entityify, eqeqeq,
189
+ errors, escape, eval, event, evidence, evil, ex, exception, exec, exps,
190
+ fieldset, figure, filesystem, firebrick, first, float, floor,
191
+ floralwhite, focus, focusWidget, font, "font-face", "font-family",
192
+ "font-size", "font-size-adjust", "font-stretch", "font-style",
193
+ "font-variant", "font-weight", footer, forestgreen, forin, form,
194
+ fragment, frame, frames, frameset, from, fromCharCode, fuchsia, fud,
195
+ funct, function, functions, g, gainsboro, gc, getComputedStyle,
196
+ ghostwhite, global, globals, gold, goldenrod, gray, green, greenyellow,
197
+ h1, h2, h3, h4, h5, h6, hasOwnProperty, head, header, height, help,
198
+ hgroup, history, honeydew, hotpink, hr, html, i, iTunes, id, identifier,
199
+ iframe, img, immed, implieds, in, include, indent, indexOf, indianred,
200
+ indigo, init, input, ins, isAlpha, isApplicationRunning, isDigit,
201
+ isFinite, isNaN, ivory, join, jslint, json, kbd, keygen, khaki,
201
202
  konfabulatorVersion, label, labelled, lang, last, lavender,
202
203
  lavenderblush, lawngreen, laxbreak, lbp, led, left, legend,
203
204
  lemonchiffon, length, "letter-spacing", li, lib, lightblue, lightcoral,
@@ -207,41 +208,42 @@ SOFTWARE.
207
208
  "list-style", "list-style-image", "list-style-position",
208
209
  "list-style-type", load, loadClass, location, log, m, magenta, map,
209
210
  margin, "margin-bottom", "margin-left", "margin-right", "margin-top",
210
- "marker-offset", maroon, match, "max-height", "max-width", maxerr, maxlen,
211
- md5, media, mediumaquamarine, mediumblue, mediumorchid, mediumpurple,
212
- mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise,
213
- mediumvioletred, member, menu, message, meta, midnightblue,
214
- "min-height", "min-width", mintcream, mistyrose, mm, moccasin, moveBy,
215
- moveTo, name, navajowhite, navigator, navy, new, newcap, noframes,
216
- nomen, noscript, nud, object, ol, oldlace, olive, olivedrab, on,
217
- onbeforeunload, onblur, onerror, onevar, onfocus, onload, onresize,
218
- onunload, opacity, open, openURL, opener, opera, optgroup, option,
219
- orange, orangered, orchid, outer, outline, "outline-color",
220
- "outline-style", "outline-width", overflow, "overflow-x", "overflow-y",
221
- p, padding, "padding-bottom", "padding-left", "padding-right",
222
- "padding-top", page, "page-break-after", "page-break-before",
223
- palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip,
224
- param, parent, parseFloat, parseInt, passfail, pc, peachpuff, peru,
225
- pink, play, plum, plusplus, pop, popupMenu, position, powderblue, pre,
226
- predef, preferenceGroups, preferences, print, prompt, prototype, pt,
227
- purple, push, px, q, quit, quotes, random, range, raw, reach, readFile,
228
- readUrl, reason, red, regexp, reloadWidget, removeEventListener,
229
- replace, report, reserved, resizeBy, resizeTo, resolvePath,
230
- resumeUpdates, rhino, right, rosybrown, royalblue, runCommand,
231
- runCommandInBg, saddlebrown, safe, salmon, samp, sandybrown, saveAs,
232
- savePreferences, screen, script, scroll, scrollBy, scrollTo, seagreen,
233
- seal, search, seashell, select, serialize, setInterval, setTimeout,
234
- shift, showWidgetPreferences, sidebar, sienna, silver, skyblue,
235
- slateblue, slategray, sleep, slice, small, snow, sort, span, spawn,
236
- speak, split, springgreen, src, status, steelblue, strict, strong,
237
- style, styleproperty, sub, substr, sup, supplant, suppressUpdates, sync,
211
+ mark, "marker-offset", maroon, match, "max-height", "max-width", maxerr,
212
+ maxlen, md5, media, mediumaquamarine, mediumblue, mediumorchid,
213
+ mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen,
214
+ mediumturquoise, mediumvioletred, member, menu, message, meta, meter,
215
+ midnightblue, "min-height", "min-width", mintcream, mistyrose, mm,
216
+ moccasin, moveBy, moveTo, name, nav, navajowhite, navigator, navy, new,
217
+ newcap, noframes, nomen, noscript, nud, object, ol, oldlace, olive,
218
+ olivedrab, on, onbeforeunload, onblur, onerror, onevar, onfocus, onload,
219
+ onresize, onunload, opacity, open, openURL, opener, opera, optgroup,
220
+ option, orange, orangered, orchid, outer, outline, "outline-color",
221
+ "outline-style", "outline-width", output, overflow, "overflow-x",
222
+ "overflow-y", p, padding, "padding-bottom", "padding-left",
223
+ "padding-right", "padding-top", page, "page-break-after",
224
+ "page-break-before", palegoldenrod, palegreen, paleturquoise,
225
+ palevioletred, papayawhip, param, parent, parseFloat, parseInt,
226
+ passfail, pc, peachpuff, peru, pink, play, plum, plusplus, pop,
227
+ popupMenu, position, powderblue, pre, predef, preferenceGroups,
228
+ preferences, print, progress, prompt, prototype, pt, purple, push, px,
229
+ q, quit, quotes, random, range, raw, reach, readFile, readUrl, reason,
230
+ red, regexp, reloadWidget, removeEventListener, replace, report,
231
+ reserved, resizeBy, resizeTo, resolvePath, resumeUpdates, rhino, right,
232
+ rosybrown, royalblue, rp, rt, ruby, runCommand, runCommandInBg,
233
+ saddlebrown, safe, salmon, samp, sandybrown, saveAs, savePreferences,
234
+ screen, script, scroll, scrollBy, scrollTo, seagreen, seal, search,
235
+ seashell, section, select, serialize, setInterval, setTimeout, shift,
236
+ showWidgetPreferences, sidebar, sienna, silver, skyblue, slateblue,
237
+ slategray, sleep, slice, small, snow, sort, source, span, spawn, speak,
238
+ split, springgreen, src, stack, status, steelblue, strict, strong, style,
239
+ styleproperty, sub, substr, sup, supplant, suppressUpdates, sync,
238
240
  system, table, "table-layout", tan, tbody, td, teal, tellWidget, test,
239
241
  "text-align", "text-decoration", "text-indent", "text-shadow",
240
- "text-transform", textarea, tfoot, th, thead, thistle, title,
242
+ "text-transform", textarea, tfoot, th, thead, thistle, time, title,
241
243
  toLowerCase, toString, toUpperCase, toint32, token, tomato, top, tr, tt,
242
244
  turquoise, type, u, ul, undef, unescape, "unicode-bidi", unused,
243
245
  unwatch, updateNow, urls, value, valueOf, var, version,
244
- "vertical-align", violet, visibility, watch, wheat, white,
246
+ "vertical-align", video, violet, visibility, watch, wheat, white,
245
247
  "white-space", whitesmoke, widget, width, "word-spacing", "word-wrap",
246
248
  yahooCheckLogin, yahooLogin, yahooLogout, yellow, yellowgreen,
247
249
  "z-index"
@@ -294,6 +296,7 @@ var JSLINT = (function () {
294
296
  constructor : true,
295
297
  'eval' : true,
296
298
  prototype : true,
299
+ stack : true,
297
300
  unwatch : true,
298
301
  valueOf : true,
299
302
  watch : true
@@ -330,8 +333,7 @@ var JSLINT = (function () {
330
333
  strict : true, // require the "use strict"; pragma
331
334
  sub : true, // if all forms of subscript notation are tolerated
332
335
  white : true, // if strict whitespace rules apply
333
- widget : true, // if the Yahoo Widgets globals should be predefined
334
- withstmt : true // if with statements should be allowd
336
+ widget : true // if the Yahoo Widgets globals should be predefined
335
337
  },
336
338
 
337
339
  // browser contains a set of global names which are commonly provided by a
@@ -583,6 +585,9 @@ var JSLINT = (function () {
583
585
  address: {},
584
586
  applet: {},
585
587
  area: {empty: true, parent: ' map '},
588
+ article: {},
589
+ aside: {},
590
+ audio: {},
586
591
  b: {},
587
592
  base: {empty: true, parent: ' head '},
588
593
  bdo: {},
@@ -598,8 +603,12 @@ var JSLINT = (function () {
598
603
  code: {},
599
604
  col: {empty: true, parent: ' table colgroup '},
600
605
  colgroup: {parent: ' table '},
606
+ command: {parent: ' menu '},
607
+ datalist: {},
601
608
  dd: {parent: ' dl '},
602
609
  del: {},
610
+ details: {},
611
+ dialog: {},
603
612
  dfn: {},
604
613
  dir: {},
605
614
  div: {},
@@ -608,7 +617,9 @@ var JSLINT = (function () {
608
617
  em: {},
609
618
  embed: {},
610
619
  fieldset: {},
620
+ figure: {},
611
621
  font: {},
622
+ footer: {},
612
623
  form: {},
613
624
  frame: {empty: true, parent: ' frameset '},
614
625
  frameset: {parent: ' html frameset '},
@@ -619,6 +630,8 @@ var JSLINT = (function () {
619
630
  h5: {},
620
631
  h6: {},
621
632
  head: {parent: ' html '},
633
+ header: {},
634
+ hgroup: {},
622
635
  html: {parent: '*'},
623
636
  hr: {empty: true},
624
637
  i: {},
@@ -627,28 +640,39 @@ var JSLINT = (function () {
627
640
  input: {empty: true},
628
641
  ins: {},
629
642
  kbd: {},
643
+ keygen: {},
630
644
  label: {},
631
- legend: {parent: ' fieldset '},
645
+ legend: {parent: ' details fieldset figure '},
632
646
  li: {parent: ' dir menu ol ul '},
633
647
  link: {empty: true, parent: ' head '},
634
648
  map: {},
649
+ mark: {},
635
650
  menu: {},
636
651
  meta: {empty: true, parent: ' head noframes noscript '},
652
+ meter: {},
653
+ nav: {},
637
654
  noframes: {parent: ' html body '},
638
655
  noscript: {parent: ' body head noframes '},
639
656
  object: {},
640
657
  ol: {},
641
658
  optgroup: {parent: ' select '},
642
659
  option: {parent: ' optgroup select '},
660
+ output: {},
643
661
  p: {},
644
662
  param: {empty: true, parent: ' applet object '},
645
663
  pre: {},
664
+ progress: {},
646
665
  q: {},
666
+ rp: {},
667
+ rt: {},
668
+ ruby: {},
647
669
  samp: {},
648
670
  script: {empty: true, parent: ' body div frame head iframe p pre span '},
671
+ section: {},
649
672
  select: {},
650
673
  small: {},
651
674
  span: {},
675
+ source: {},
652
676
  strong: {},
653
677
  style: {parent: ' head ', empty: true},
654
678
  sub: {},
@@ -660,12 +684,14 @@ var JSLINT = (function () {
660
684
  tfoot: {parent: ' table '},
661
685
  th: {parent: ' tr '},
662
686
  thead: {parent: ' table '},
687
+ time: {},
663
688
  title: {parent: ' head '},
664
689
  tr: {parent: ' table tbody thead tfoot '},
665
690
  tt: {},
666
691
  u: {},
667
692
  ul: {},
668
- 'var': {}
693
+ 'var': {},
694
+ video: {}
669
695
  },
670
696
 
671
697
  ids, // HTML ids
@@ -887,7 +913,7 @@ var JSLINT = (function () {
887
913
  sx = /^\s*([{:#%.=,>+\[\]@()"';]|\*=?|\$=|\|=|\^=|~=|[a-zA-Z_][a-zA-Z0-9_\-]*|[0-9]+|<\/|\/\*)/,
888
914
  ssx = /^\s*([@#!"'};:\-%.=,+\[\]()*_]|[a-zA-Z][a-zA-Z0-9._\-]*|\/\*?|\d+(?:\.\d+)?|<\/)/,
889
915
  // attributes characters
890
- qx = /[^a-zA-Z0-9-_\/ ]/,
916
+ qx = /[^a-zA-Z0-9+\-_\/ ]/,
891
917
  // query characters for ids
892
918
  dx = /[\[\]\/\\"'*<>.&:(){}+=#]/,
893
919
 
@@ -1439,7 +1465,8 @@ var JSLINT = (function () {
1439
1465
  errorAt("Unclosed comment.", line, character);
1440
1466
  } else {
1441
1467
  if (option.safe && ax.test(s)) {
1442
- warningAt("ADsafe comment violation.", line, character);
1468
+ warningAt("ADsafe comment violation.",
1469
+ line, character);
1443
1470
  }
1444
1471
  }
1445
1472
  }
@@ -1484,11 +1511,13 @@ var JSLINT = (function () {
1484
1511
  l += 1;
1485
1512
  switch (c) {
1486
1513
  case '':
1487
- errorAt("Unclosed regular expression.", line, from);
1514
+ errorAt("Unclosed regular expression.",
1515
+ line, from);
1488
1516
  return;
1489
1517
  case '/':
1490
1518
  if (depth > 0) {
1491
- warningAt("Unescaped '{a}'.", line, from + l, '/');
1519
+ warningAt("Unescaped '{a}'.",
1520
+ line, from + l, '/');
1492
1521
  }
1493
1522
  c = s.substr(0, l - 1);
1494
1523
  q = {
@@ -1504,15 +1533,18 @@ var JSLINT = (function () {
1504
1533
  s = s.substr(l);
1505
1534
  q = s.charAt(0);
1506
1535
  if (q === '/' || q === '*') {
1507
- errorAt("Confusing regular expression.", line, from);
1536
+ errorAt("Confusing regular expression.",
1537
+ line, from);
1508
1538
  }
1509
1539
  return it('(regexp)', c);
1510
1540
  case '\\':
1511
1541
  c = s.charAt(l);
1512
1542
  if (c < ' ') {
1513
- warningAt("Unexpected control character in regular expression.", line, from + l);
1543
+ warningAt(
1544
+ "Unexpected control character in regular expression.", line, from + l);
1514
1545
  } else if (c === '<') {
1515
- warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
1546
+ warningAt(
1547
+ "Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
1516
1548
  }
1517
1549
  l += 1;
1518
1550
  break;
@@ -1528,7 +1560,8 @@ var JSLINT = (function () {
1528
1560
  l += 1;
1529
1561
  break;
1530
1562
  default:
1531
- warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, ':', s.charAt(l));
1563
+ warningAt(
1564
+ "Expected '{a}' and instead saw '{b}'.", line, from + l, ':', s.charAt(l));
1532
1565
  }
1533
1566
  } else {
1534
1567
  captures += 1;
@@ -1539,7 +1572,8 @@ var JSLINT = (function () {
1539
1572
  break;
1540
1573
  case ')':
1541
1574
  if (depth === 0) {
1542
- warningAt("Unescaped '{a}'.", line, from + l, ')');
1575
+ warningAt("Unescaped '{a}'.",
1576
+ line, from + l, ')');
1543
1577
  } else {
1544
1578
  depth -= 1;
1545
1579
  }
@@ -1551,7 +1585,8 @@ var JSLINT = (function () {
1551
1585
  q += 1;
1552
1586
  }
1553
1587
  if (q > 1) {
1554
- warningAt("Spaces are hard to count. Use {{a}}.", line, from + l, q);
1588
+ warningAt(
1589
+ "Spaces are hard to count. Use {{a}}.", line, from + l, q);
1555
1590
  }
1556
1591
  break;
1557
1592
  case '[':
@@ -1559,55 +1594,64 @@ var JSLINT = (function () {
1559
1594
  if (c === '^') {
1560
1595
  l += 1;
1561
1596
  if (option.regexp) {
1562
- warningAt("Insecure '{a}'.", line, from + l, c);
1597
+ warningAt("Insecure '{a}'.",
1598
+ line, from + l, c);
1563
1599
  }
1564
1600
  }
1565
1601
  q = false;
1566
1602
  if (c === ']') {
1567
- warningAt("Empty class.", line, from + l - 1);
1603
+ warningAt("Empty class.", line,
1604
+ from + l - 1);
1568
1605
  q = true;
1569
1606
  }
1570
- klass: do {
1607
+ klass: do {
1571
1608
  c = s.charAt(l);
1572
1609
  l += 1;
1573
1610
  switch (c) {
1574
1611
  case '[':
1575
1612
  case '^':
1576
- warningAt("Unescaped '{a}'.", line, from + l, c);
1613
+ warningAt("Unescaped '{a}'.",
1614
+ line, from + l, c);
1577
1615
  q = true;
1578
1616
  break;
1579
1617
  case '-':
1580
1618
  if (q) {
1581
1619
  q = false;
1582
1620
  } else {
1583
- warningAt("Unescaped '{a}'.", line, from + l, '-');
1621
+ warningAt("Unescaped '{a}'.",
1622
+ line, from + l, '-');
1584
1623
  q = true;
1585
1624
  }
1586
1625
  break;
1587
1626
  case ']':
1588
1627
  if (!q) {
1589
- warningAt("Unescaped '{a}'.", line, from + l - 1, '-');
1628
+ warningAt("Unescaped '{a}'.",
1629
+ line, from + l - 1, '-');
1590
1630
  }
1591
1631
  break klass;
1592
1632
  case '\\':
1593
1633
  c = s.charAt(l);
1594
1634
  if (c < ' ') {
1595
- warningAt("Unexpected control character in regular expression.", line, from + l);
1635
+ warningAt(
1636
+ "Unexpected control character in regular expression.", line, from + l);
1596
1637
  } else if (c === '<') {
1597
- warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
1638
+ warningAt(
1639
+ "Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
1598
1640
  }
1599
1641
  l += 1;
1600
1642
  q = true;
1601
1643
  break;
1602
1644
  case '/':
1603
- warningAt("Unescaped '{a}'.", line, from + l - 1, '/');
1645
+ warningAt("Unescaped '{a}'.",
1646
+ line, from + l - 1, '/');
1604
1647
  q = true;
1605
1648
  break;
1606
1649
  case '<':
1607
1650
  if (xmode === 'script') {
1608
1651
  c = s.charAt(l);
1609
1652
  if (c === '!' || c === '/') {
1610
- warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c);
1653
+ warningAt(
1654
+ "HTML confusion in regular expression '<{a}'.", line, from + l, c);
1611
1655
  }
1612
1656
  }
1613
1657
  q = true;
@@ -1619,7 +1663,8 @@ var JSLINT = (function () {
1619
1663
  break;
1620
1664
  case '.':
1621
1665
  if (option.regexp) {
1622
- warningAt("Insecure '{a}'.", line, from + l, c);
1666
+ warningAt("Insecure '{a}'.", line,
1667
+ from + l, c);
1623
1668
  }
1624
1669
  break;
1625
1670
  case ']':
@@ -1628,13 +1673,15 @@ var JSLINT = (function () {
1628
1673
  case '}':
1629
1674
  case '+':
1630
1675
  case '*':
1631
- warningAt("Unescaped '{a}'.", line, from + l, c);
1676
+ warningAt("Unescaped '{a}'.", line,
1677
+ from + l, c);
1632
1678
  break;
1633
1679
  case '<':
1634
1680
  if (xmode === 'script') {
1635
1681
  c = s.charAt(l);
1636
1682
  if (c === '!' || c === '/') {
1637
- warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c);
1683
+ warningAt(
1684
+ "HTML confusion in regular expression '<{a}'.", line, from + l, c);
1638
1685
  }
1639
1686
  }
1640
1687
  }
@@ -1652,7 +1699,8 @@ var JSLINT = (function () {
1652
1699
  l += 1;
1653
1700
  c = s.charAt(l);
1654
1701
  if (c < '0' || c > '9') {
1655
- warningAt("Expected a number and instead saw '{a}'.", line, from + l, c);
1702
+ warningAt(
1703
+ "Expected a number and instead saw '{a}'.", line, from + l, c);
1656
1704
  }
1657
1705
  l += 1;
1658
1706
  low = +c;
@@ -1683,7 +1731,8 @@ var JSLINT = (function () {
1683
1731
  }
1684
1732
  }
1685
1733
  if (s.charAt(l) !== '}') {
1686
- warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, '}', c);
1734
+ warningAt(
1735
+ "Expected '{a}' and instead saw '{b}'.", line, from + l, '}', c);
1687
1736
  } else {
1688
1737
  l += 1;
1689
1738
  }
@@ -1691,7 +1740,8 @@ var JSLINT = (function () {
1691
1740
  l += 1;
1692
1741
  }
1693
1742
  if (low > high) {
1694
- warningAt("'{a}' should not be greater than '{b}'.", line, from + l, low, high);
1743
+ warningAt(
1744
+ "'{a}' should not be greater than '{b}'.", line, from + l, low, high);
1695
1745
  }
1696
1746
  }
1697
1747
  }
@@ -1785,7 +1835,8 @@ var JSLINT = (function () {
1785
1835
 
1786
1836
  function addlabel(t, type) {
1787
1837
 
1788
- if (option.safe && funct['(global)'] && typeof predefined[t] !== 'boolean') {
1838
+ if (option.safe && funct['(global)'] &&
1839
+ typeof predefined[t] !== 'boolean') {
1789
1840
  warning('ADsafe global: ' + t + '.', token);
1790
1841
  } else if (t === 'hasOwnProperty') {
1791
1842
  warning("'hasOwnProperty' is a really bad name.");
@@ -1961,7 +2012,8 @@ loop: for (;;) {
1961
2012
  if (nexttoken.id === '(end)') {
1962
2013
  warning("Unmatched '{a}'.", t, t.id);
1963
2014
  } else {
1964
- warning("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
2015
+ warning(
2016
+ "Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
1965
2017
  nexttoken, id, t.id, t.line, nexttoken.value);
1966
2018
  }
1967
2019
  } else if (nexttoken.type !== '(identifier)' ||
@@ -2101,7 +2153,8 @@ loop: for (;;) {
2101
2153
  if (option.white && nexttoken.id !== '(end)') {
2102
2154
  i = indent + (bias || 0);
2103
2155
  if (nexttoken.from !== i) {
2104
- warning("Expected '{a}' to have an indentation at {b} instead at {c}.",
2156
+ warning(
2157
+ "Expected '{a}' to have an indentation at {b} instead at {c}.",
2105
2158
  nexttoken, nexttoken.value, i, nexttoken.from);
2106
2159
  }
2107
2160
  }
@@ -2210,7 +2263,8 @@ loop: for (;;) {
2210
2263
 
2211
2264
  function reservevar(s, v) {
2212
2265
  return reserve(s, function () {
2213
- if (this.id === 'this' || this.id === 'arguments') {
2266
+ if (this.id === 'this' || this.id === 'arguments' ||
2267
+ this.id === 'eval') {
2214
2268
  if (strict_mode && funct['(global)']) {
2215
2269
  warning("Strict violation.", this);
2216
2270
  } else if (option.safe) {
@@ -2365,7 +2419,8 @@ loop: for (;;) {
2365
2419
  x.led = function (left) {
2366
2420
  if (option.plusplus) {
2367
2421
  warning("Unexpected use of '{a}'.", this, this.id);
2368
- } else if ((!left.identifier || left.reserved) && left.id !== '.' && left.id !== '[') {
2422
+ } else if ((!left.identifier || left.reserved) &&
2423
+ left.id !== '.' && left.id !== '[') {
2369
2424
  warning("Bad operand.", this);
2370
2425
  }
2371
2426
  this.left = left;
@@ -2459,9 +2514,6 @@ loop: for (;;) {
2459
2514
  if (!noindent) {
2460
2515
  indentation();
2461
2516
  }
2462
- if (nexttoken.id === 'new') {
2463
- warning("'new' should not be used as a statement.");
2464
- }
2465
2517
  r = parse(0, true);
2466
2518
 
2467
2519
  // Look for the final semicolon.
@@ -2471,6 +2523,8 @@ loop: for (;;) {
2471
2523
  warning(
2472
2524
  "Expected an assignment or function call and instead saw an expression.",
2473
2525
  token);
2526
+ } else if (r.id === '(' && r.left.id === 'new') {
2527
+ warning("Do not use 'new' for side effects.");
2474
2528
  }
2475
2529
  if (nexttoken.id !== ';') {
2476
2530
  warningAt("Missing semicolon.", token.line,
@@ -3511,7 +3565,9 @@ loop: for (;;) {
3511
3565
  if (ids[u] === true) {
3512
3566
  warning("Duplicate id='{a}'.", nexttoken, v);
3513
3567
  }
3514
- if (option.adsafe) {
3568
+ if (!/^[A-Za-z][A-Za-z0-9._:\-]*$/.test(v)) {
3569
+ warning("Bad id: '{a}'.", nexttoken, v);
3570
+ } else if (option.adsafe) {
3515
3571
  if (adsafe_id) {
3516
3572
  if (v.slice(0, adsafe_id.length) !== adsafe_id) {
3517
3573
  warning("ADsafe violation: An id must have a '{a}' prefix",
@@ -4000,6 +4056,9 @@ loop: for (;;) {
4000
4056
  return this;
4001
4057
  });
4002
4058
 
4059
+
4060
+ // ECMAScript parser
4061
+
4003
4062
  delim('(endline)');
4004
4063
  delim('(begin)');
4005
4064
  delim('(end)').reach = true;
@@ -4584,28 +4643,6 @@ loop: for (;;) {
4584
4643
  return p;
4585
4644
  }
4586
4645
  }
4587
- };
4588
-
4589
- function withparams() {
4590
- var i, t = nexttoken, p = [];
4591
- advance('(');
4592
- nospace();
4593
- if (nexttoken.id === ')') {
4594
- advance(')');
4595
- nospace(prevtoken, token);
4596
- return;
4597
- }
4598
- for (;;) {
4599
- i = parse(20);
4600
- p.push(i);
4601
- if (nexttoken.id === ',') {
4602
- comma();
4603
- } else {
4604
- advance(')', t);
4605
- nospace(prevtoken, token);
4606
- return p;
4607
- }
4608
- }
4609
4646
  }
4610
4647
 
4611
4648
  function doFunction(i) {
@@ -4658,8 +4695,8 @@ loop: for (;;) {
4658
4695
  nonadjacent(token, nexttoken);
4659
4696
  }
4660
4697
  doFunction(i);
4661
- if (funct['(loopage)'] && nexttoken.id !== '(') {
4662
- warning("Be careful when making functions within a loop. Consider putting the function in a closure.");
4698
+ if (funct['(loopage)']) {
4699
+ warning("Don't make functions within a loop.");
4663
4700
  }
4664
4701
  return this;
4665
4702
  });
@@ -4690,15 +4727,6 @@ loop: for (;;) {
4690
4727
  return this;
4691
4728
  });
4692
4729
 
4693
- blockstmt('with', function () {
4694
- if (!option.withstmt) {
4695
- warning("Don't use with statements");
4696
- }
4697
- withparams();
4698
- block(true);
4699
- return this;
4700
- });
4701
-
4702
4730
  blockstmt('try', function () {
4703
4731
  var b, e, s;
4704
4732
  if (option.adsafe) {
@@ -5056,6 +5084,9 @@ loop: for (;;) {
5056
5084
  reserve('public');
5057
5085
  reserve('static');
5058
5086
 
5087
+
5088
+ // Parse JSON
5089
+
5059
5090
  function jsonValue() {
5060
5091
 
5061
5092
  function jsonObject() {
@@ -5181,7 +5212,6 @@ loop: for (;;) {
5181
5212
  o.sub = false;
5182
5213
  o.undef = true;
5183
5214
  o.widget = false;
5184
- o.withstmt= false;
5185
5215
  predefined.Date = null;
5186
5216
  predefined['eval'] = null;
5187
5217
  predefined.Function = null;
@@ -5312,6 +5342,7 @@ loop: for (;;) {
5312
5342
  return a;
5313
5343
  }
5314
5344
 
5345
+
5315
5346
  // Data summary.
5316
5347
 
5317
5348
  itself.data = function () {
@@ -5525,8 +5556,8 @@ loop: for (;;) {
5525
5556
  };
5526
5557
  itself.jslint = itself;
5527
5558
 
5528
- itself.edition = '2010-01-20';
5559
+ itself.edition = '2010-03-12';
5529
5560
 
5530
5561
  return itself;
5531
5562
 
5532
- }());
5563
+ }());