update jshint
This commit is contained in:
parent
7a607ba621
commit
491818bcc4
1 changed files with 114 additions and 63 deletions
|
|
@ -1,3 +1,4 @@
|
|||
define(function(require, exports, module) {
|
||||
/*
|
||||
* JSHint, by JSHint Community.
|
||||
*
|
||||
|
|
@ -32,8 +33,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
/*
|
||||
JSHINT is a global function. It takes two parameters.
|
||||
|
||||
|
|
@ -160,7 +159,7 @@ define(function(require, exports, module) {
|
|||
"(begin)", "(breakage)", "(context)", "(error)", "(global)",
|
||||
"(identifier)", "(last)", "(line)", "(loopage)", "(name)", "(onevar)",
|
||||
"(params)", "(scope)", "(statement)", "(verb)", "*", "+", "++", "-",
|
||||
"--", "\/", "<", "<=", "==", "===", ">", ">=", ADSAFE, __filename, __dirname,
|
||||
"--", "\/", "<", "<=", "==", "===", ">", ">=", $, ADSAFE, __filename, __dirname,
|
||||
ActiveXObject, Array, Boolean, Buffer, COM, CScript, Canvas, CustomAnimation,
|
||||
Date, Debug, E, Enumerator, Error, EvalError, FadeAnimation, Flash,
|
||||
FormField, Frame, Function, HotKey, Image, JSON, LN10, LN2, LOG10E,
|
||||
|
|
@ -172,8 +171,8 @@ define(function(require, exports, module) {
|
|||
WScript, Web, Window, XMLDOM, XMLHttpRequest, "\\", a, abbr, acronym,
|
||||
activeborder, activecaption, addEventListener, address, adsafe, alert,
|
||||
aliceblue, all, animator, antiquewhite, appleScript, applet, apply,
|
||||
approved, appworkspace, aqua, aquamarine, area, arguments, arity,
|
||||
article, aside, audio, autocomplete, azure, b, background,
|
||||
approved, appworkspace, applicationCache, aqua, aquamarine, area, arguments,
|
||||
arity, article, aside, audio, autocomplete, azure, b, background,
|
||||
"background-attachment", "background-color", "background-image",
|
||||
"background-position", "background-repeat", base, bdo, beep, beige, big,
|
||||
bisque, bitwise, black, blanchedalmond, block, blockquote, blue,
|
||||
|
|
@ -192,22 +191,22 @@ define(function(require, exports, module) {
|
|||
closeWidget, closed, closure, cm, code, col, colgroup, color, command,
|
||||
comment, condition, confirm, console, constructor, content,
|
||||
convertPathToHFS, convertPathToPlatform, coral, cornflowerblue,
|
||||
cornsilk, "counter-increment", "counter-reset", create, crimson, css, curly,
|
||||
cursor, cyan, d, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen,
|
||||
darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred,
|
||||
darksalmon, darkseagreen, darkslateblue, darkslategray, darkturquoise,
|
||||
cornsilk, couch, "counter-increment", "counter-reset", create, crimson,
|
||||
css, curly, cursor, cyan, d, darkblue, darkcyan, darkgoldenrod, darkgray,
|
||||
darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid,
|
||||
darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkturquoise,
|
||||
darkviolet, data, datalist, dd, debug, decodeURI, decodeURIComponent,
|
||||
deeppink, deepskyblue, defaultStatus, defineClass, del, deserialize,
|
||||
details, devel, dfn, dialog, dimgray, dir, direction, display, div, dl,
|
||||
document, dodgerblue, dt, edition, else, em, embed, embossed, empty,
|
||||
document, dodgerblue, dt, edition, else, em, embed, embossed, emit, empty,
|
||||
"empty-cells", encodeURI, encodeURIComponent, entityify, eqeqeq, errors,
|
||||
es5, escape, eval, event, evidence, evil, ex, exception, exec, exps, exports,
|
||||
fieldset, figure, filesystem, firebrick, first, float, floor,
|
||||
fieldset, figure, filesystem, FileReader, firebrick, first, float, floor,
|
||||
floralwhite, focus, focusWidget, font, "font-family", "font-size",
|
||||
"font-size-adjust", "font-stretch", "font-style", "font-variant",
|
||||
"font-weight", footer, forestgreen, forin, form, fragment, frame,
|
||||
frames, frameset, from, fromCharCode, fuchsia, fud, funct, function,
|
||||
functions, g, gainsboro, gc, getComputedStyle, ghostwhite, GLOBAL, global,
|
||||
functions, g, gainsboro, gc, getComputedStyle, getRow, ghostwhite, GLOBAL, global,
|
||||
globals, gold, goldenrod, gray, graytext, green, greenyellow, h1, h2,
|
||||
h3, h4, h5, h6, handheld, hasOwnProperty, head, header, height, help,
|
||||
hgroup, highlight, highlighttext, history, honeydew, hotpink, hr,
|
||||
|
|
@ -215,16 +214,16 @@ define(function(require, exports, module) {
|
|||
implieds, in, inactiveborder, inactivecaption, inactivecaptiontext,
|
||||
include, indent, indexOf, indianred, indigo, infobackground, infotext,
|
||||
init, input, ins, isAlpha, isApplicationRunning, isArray, isDigit,
|
||||
isFinite, isNaN, ivory, join, jshint, JSHINT, json, kbd, keygen, keys, khaki,
|
||||
konfabulatorVersion, label, labelled, lang, last, lavender,
|
||||
lavenderblush, lawngreen, laxbreak, lbp, led, left, legend,
|
||||
isFinite, isNaN, ivory, join, jshint, JSHINT, json, jquery, jQuery, kbd,
|
||||
keygen, keys, khaki, konfabulatorVersion, label, labelled, lang, last,
|
||||
lavender, lavenderblush, lawngreen, laxbreak, lbp, led, left, legend,
|
||||
lemonchiffon, length, "letter-spacing", li, lib, lightblue, lightcoral,
|
||||
lightcyan, lightgoldenrodyellow, lightgreen, lightpink, lightsalmon,
|
||||
lightseagreen, lightskyblue, lightslategray, lightsteelblue,
|
||||
lightyellow, lime, limegreen, line, "line-height", linen, link,
|
||||
"list-style", "list-style-image", "list-style-position",
|
||||
"list-style-type", load, loadClass, location, log, m, magenta, map,
|
||||
margin, "margin-bottom", "margin-left", "margin-right", "margin-top",
|
||||
"list-style-type", load, loadClass, localStorage, location, log, m, magenta,
|
||||
map, margin, "margin-bottom", "margin-left", "margin-right", "margin-top",
|
||||
mark, "marker-offset", maroon, match, "max-height", "max-width", maxerr,
|
||||
maxlen, md5, mediumaquamarine, mediumblue, mediumorchid, mediumpurple,
|
||||
mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise,
|
||||
|
|
@ -233,8 +232,8 @@ define(function(require, exports, module) {
|
|||
moccasin, module, moveBy, moveTo, name, nav, navajowhite, navigator, navy, new,
|
||||
newcap, noarg, node, noempty, noframes, nomen, nonew, noscript, nud, object, ol,
|
||||
oldlace, olive, olivedrab, on, onbeforeunload, onblur, onerror, onevar,
|
||||
onfocus, onload, onresize, onunload, opacity, open, openURL, opener, opera,
|
||||
optgroup, option, orange, orangered, orchid, outer, outline, "outline-color",
|
||||
onfocus, onload, onresize, onunload, opacity, open, openDatabase, openURL, opener,
|
||||
opera, optgroup, option, orange, orangered, orchid, outer, outline, "outline-color",
|
||||
"outline-style", "outline-width", output, overflow, "overflow-x",
|
||||
"overflow-y", p, padding, "padding-bottom", "padding-left",
|
||||
"padding-right", "padding-top", "page-break-after", "page-break-before",
|
||||
|
|
@ -245,15 +244,15 @@ define(function(require, exports, module) {
|
|||
prompt, prototype, pt, purple, push, px, q, quit, quotes, random, range,
|
||||
raw, reach, readFile, readUrl, reason, red, regexp, reloadWidget,
|
||||
removeEventListener, replace, report, require, reserved, resizeBy, resizeTo,
|
||||
resolvePath, resumeUpdates, rhino, right, rosybrown, royalblue, rp, rt,
|
||||
ruby, runCommand, runCommandInBg, saddlebrown, safe, salmon, samp,
|
||||
resolvePath, resumeUpdates, respond, rhino, right, rosybrown, royalblue,
|
||||
rp, rt, ruby, runCommand, runCommandInBg, saddlebrown, safe, salmon, samp,
|
||||
sandybrown, saveAs, savePreferences, screen, script, scroll, scrollBy,
|
||||
scrollTo, scrollbar, seagreen, seal, search, seashell, section, select,
|
||||
scrollTo, scrollbar, seagreen, seal, search, seashell, section, send, select,
|
||||
serialize, setInterval, setTimeout, shift, showWidgetPreferences,
|
||||
sienna, silver, skyblue, slateblue, slategray, sleep, slice, small,
|
||||
snow, sort, source, span, spawn, speak, speech, split, springgreen, src,
|
||||
stack, status, steelblue, strict, strong, style, styleproperty, sub,
|
||||
substr, sup, supplant, suppressUpdates, sync, system, table,
|
||||
stack, status, start, steelblue, strict, strong, style, styleproperty, sub,
|
||||
substr, sum, sup, supplant, suppressUpdates, sync, system, table,
|
||||
"table-layout", tan, tbody, td, teal, tellWidget, test, "text-align",
|
||||
"text-decoration", "text-indent", "text-shadow", "text-transform",
|
||||
textarea, tfoot, th, thead, thistle, threeddarkshadow, threedface,
|
||||
|
|
@ -261,10 +260,10 @@ define(function(require, exports, module) {
|
|||
toLowerCase, toString, toUpperCase, toint32, token, tomato, top, tr, tt,
|
||||
tty, turquoise, tv, type, u, ul, undef, unescape, "unicode-bidi",
|
||||
unused, unwatch, updateNow, urls, value, valueOf, var, version,
|
||||
"vertical-align", video, violet, visibility, watch, wheat, white,
|
||||
"vertical-align", video, violet, visibility, watch, WebSocket, wheat, white,
|
||||
"white-space", whitesmoke, widget, width, window, windowframe, windows,
|
||||
windowtext, "word-spacing", "word-wrap", yahooCheckLogin, yahooLogin,
|
||||
yahooLogout, yellow, yellowgreen, "z-index"
|
||||
windowtext, Worker, "word-spacing", "word-wrap", yahooCheckLogin,
|
||||
yahooLogin, yahooLogout, yellow, yellowgreen, "z-index"
|
||||
*/
|
||||
|
||||
/*global exports: false */
|
||||
|
|
@ -321,9 +320,10 @@ var JSHINT = (function () {
|
|||
boolOptions = {
|
||||
adsafe : true, // if ADsafe should be enforced
|
||||
bitwise : true, // if bitwise operators should not be allowed
|
||||
boss : true, // if assignments inside if/for/while/do should be allowed
|
||||
boss : true, // if advanced usage of assignments and == should be allowed
|
||||
browser : true, // if the standard browser globals should be predefined
|
||||
cap : true, // if upper case HTML should be allowed
|
||||
couch : true, // if CouchDB globals should be predefined
|
||||
css : true, // if CSS workarounds should be tolerated
|
||||
curly : true, // if curly braces around blocks should be required (even in if/for/while)
|
||||
debug : true, // if debugger statements should be allowed
|
||||
|
|
@ -334,6 +334,7 @@ var JSHINT = (function () {
|
|||
forin : true, // if for in statements must filter
|
||||
fragment : true, // if HTML fragments should be allowed
|
||||
immed : true, // if immediate invocations must be wrapped in parens
|
||||
jquery : true, // if jQuery globals should be predefined
|
||||
laxbreak : true, // if line breaks should not be checked
|
||||
newcap : true, // if constructor names must be capitalized
|
||||
noarg : true, // if arguments.caller and arguments.callee should be disallowed
|
||||
|
|
@ -361,6 +362,7 @@ var JSHINT = (function () {
|
|||
|
||||
browser = {
|
||||
addEventListener: false,
|
||||
applicationCache: false,
|
||||
blur : false,
|
||||
clearInterval : false,
|
||||
clearTimeout : false,
|
||||
|
|
@ -369,12 +371,14 @@ var JSHINT = (function () {
|
|||
defaultStatus : false,
|
||||
document : false,
|
||||
event : false,
|
||||
FileReader : false,
|
||||
focus : false,
|
||||
frames : false,
|
||||
getComputedStyle: false,
|
||||
history : false,
|
||||
Image : false,
|
||||
length : false,
|
||||
localStorage : false,
|
||||
location : false,
|
||||
moveBy : false,
|
||||
moveTo : false,
|
||||
|
|
@ -388,6 +392,7 @@ var JSHINT = (function () {
|
|||
onresize : true,
|
||||
onunload : true,
|
||||
open : false,
|
||||
openDatabase : false,
|
||||
opener : false,
|
||||
Option : false,
|
||||
parent : false,
|
||||
|
|
@ -403,10 +408,25 @@ var JSHINT = (function () {
|
|||
setTimeout : false,
|
||||
status : false,
|
||||
top : false,
|
||||
WebSocket : false,
|
||||
window : false,
|
||||
Worker : false,
|
||||
XMLHttpRequest : false
|
||||
},
|
||||
|
||||
couch = {
|
||||
"require" : false,
|
||||
respond : false,
|
||||
getRow : false,
|
||||
emit : false,
|
||||
send : false,
|
||||
start : false,
|
||||
sum : false,
|
||||
log : false,
|
||||
exports : false,
|
||||
module : false
|
||||
},
|
||||
|
||||
cssAttributeData,
|
||||
cssAny,
|
||||
|
||||
|
|
@ -752,6 +772,12 @@ var JSHINT = (function () {
|
|||
inblock,
|
||||
indent,
|
||||
jsonmode,
|
||||
|
||||
jquery = {
|
||||
'$' : false,
|
||||
jQuery : false
|
||||
},
|
||||
|
||||
lines,
|
||||
lookahead,
|
||||
member,
|
||||
|
|
@ -1102,26 +1128,32 @@ var JSHINT = (function () {
|
|||
}
|
||||
|
||||
function assume() {
|
||||
if (!option.safe) {
|
||||
if (option.rhino) {
|
||||
combine(predefined, rhino);
|
||||
}
|
||||
if (option.node) {
|
||||
combine(predefined, node);
|
||||
}
|
||||
if (option.devel) {
|
||||
combine(predefined, devel);
|
||||
}
|
||||
if (option.browser) {
|
||||
combine(predefined, browser);
|
||||
}
|
||||
if (option.windows) {
|
||||
combine(predefined, windows);
|
||||
}
|
||||
if (option.widget) {
|
||||
combine(predefined, widget);
|
||||
}
|
||||
}
|
||||
if (option.safe)
|
||||
return;
|
||||
|
||||
if (option.couch)
|
||||
combine(predefined, couch);
|
||||
|
||||
if (option.rhino)
|
||||
combine(predefined, rhino);
|
||||
|
||||
if (option.node)
|
||||
combine(predefined, node);
|
||||
|
||||
if (option.devel)
|
||||
combine(predefined, devel);
|
||||
|
||||
if (option.browser)
|
||||
combine(predefined, browser);
|
||||
|
||||
if (option.jquery)
|
||||
combine(predefined, jquery);
|
||||
|
||||
if (option.windows)
|
||||
combine(predefined, windows);
|
||||
|
||||
if (option.widget)
|
||||
combine(predefined, widget);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2429,10 +2461,10 @@ loop: for (;;) {
|
|||
return node &&
|
||||
((node.type === '(number)' && +node.value === 0) ||
|
||||
(node.type === '(string)' && node.value === '') ||
|
||||
(node.type === 'null' && !option.boss) ||
|
||||
node.type === 'true' ||
|
||||
node.type === 'false' ||
|
||||
node.type === 'undefined' ||
|
||||
node.type === 'null');
|
||||
node.type === 'undefined');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2538,22 +2570,30 @@ loop: for (;;) {
|
|||
}
|
||||
|
||||
|
||||
function optionalidentifier() {
|
||||
// fnparam means that this identifier is being defined as a function
|
||||
// argument (see identifier())
|
||||
function optionalidentifier(fnparam) {
|
||||
if (nexttoken.identifier) {
|
||||
advance();
|
||||
if (option.safe && banned[token.value]) {
|
||||
warning("ADsafe violation: '{a}'.", token, token.value);
|
||||
} else if (token.reserved && !option.es5) {
|
||||
warning("Expected an identifier and instead saw '{a}' (a reserved word).",
|
||||
token, token.id);
|
||||
// `undefined` as a function param is a common pattern to protect
|
||||
// against the case when somebody does `undefined = true` and
|
||||
// help with minification. More info: https://gist.github.com/315916
|
||||
if (!fnparam || token.value != 'undefined') {
|
||||
warning("Expected an identifier and instead saw '{a}' (a reserved word).",
|
||||
token, token.id);
|
||||
}
|
||||
}
|
||||
return token.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function identifier() {
|
||||
var i = optionalidentifier();
|
||||
// fnparam means that this identifier is being defined as a function
|
||||
// argument
|
||||
function identifier(fnparam) {
|
||||
var i = optionalidentifier(fnparam);
|
||||
if (i) {
|
||||
return i;
|
||||
}
|
||||
|
|
@ -2746,10 +2786,10 @@ loop: for (;;) {
|
|||
/*
|
||||
* Parses a single block. A block is a sequence of statements wrapped in
|
||||
* braces.
|
||||
*
|
||||
* ordinary - true for everything but function bodies and try blocks.
|
||||
* stmt - true if block can be a single statement (e.g. in if/for/while).
|
||||
*/
|
||||
*
|
||||
* ordinary - true for everything but function bodies and try blocks.
|
||||
* stmt - true if block can be a single statement (e.g. in if/for/while).
|
||||
*/
|
||||
function block(ordinary, stmt) {
|
||||
var a,
|
||||
b = inblock,
|
||||
|
|
@ -4176,9 +4216,14 @@ loop: for (;;) {
|
|||
|
||||
// The name is not defined in the function. If we are in the global scope,
|
||||
// then we have an undefined variable.
|
||||
//
|
||||
// Operators typeof and delete do not raise runtime errors even if the base
|
||||
// object of a reference is null so no need to display warning if we're
|
||||
// inside of typeof or delete.
|
||||
|
||||
} else if (funct['(global)']) {
|
||||
if (option.undef && typeof predefined[v] !== 'boolean') {
|
||||
if (anonname != 'typeof' && anonname != 'delete' &&
|
||||
option.undef && typeof predefined[v] !== 'boolean') {
|
||||
warning("'{a}' is not defined.", token, v);
|
||||
}
|
||||
note_implied(token);
|
||||
|
|
@ -4211,7 +4256,11 @@ loop: for (;;) {
|
|||
warning("'{a}' is not allowed.", token, v);
|
||||
note_implied(token);
|
||||
} else if (typeof s !== 'object') {
|
||||
if (option.undef) {
|
||||
|
||||
// Operators typeof and delete do not raise runtime errors even if the base object of
|
||||
// a reference is null so no need to display warning if we're inside of typeof or delete.
|
||||
|
||||
if (anonname != 'typeof' && anonname != 'delete' && option.undef) {
|
||||
warning("'{a}' is not defined.", token, v);
|
||||
} else {
|
||||
funct[v] = true;
|
||||
|
|
@ -4772,7 +4821,7 @@ loop: for (;;) {
|
|||
return;
|
||||
}
|
||||
for (;;) {
|
||||
i = identifier();
|
||||
i = identifier(true);
|
||||
p.push(i);
|
||||
addlabel(i, 'parameter');
|
||||
if (nexttoken.id === ',') {
|
||||
|
|
@ -5846,6 +5895,8 @@ loop: for (;;) {
|
|||
};
|
||||
itself.jshint = itself;
|
||||
|
||||
itself.edition = '2011-02-19';
|
||||
|
||||
return itself;
|
||||
|
||||
}());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue