linter
Version:
Code quality tools collection in one module
1,113 lines (1,055 loc) • 221 kB
JavaScript
// jslint.js
// 2011-01-26
/*
Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
JSLINT is a global function. It takes two parameters.
var myResult = JSLINT(source, option);
The first parameter is either a string or an array of strings. If it is a
string, it will be split on '\n' or '\r'. If it is an array of strings, it
is assumed that each string represents one line. The source can be a
JavaScript text, or HTML text, or a JSON text, or a CSS text.
The second parameter is an optional object of options which control the
operation of JSLINT. Most of the options are booleans: They are all
optional and have a default value of false. One of the options, predef,
can be an array of names, which will be used to declare global variables,
or an object whose keys are used as global names, with a boolean value
that determines if they are assignable.
If it checks out, JSLINT returns true. Otherwise, it returns false.
If false, you can inspect JSLINT.errors to find out the problems.
JSLINT.errors is an array of objects containing these members:
{
line : The line (relative to 0) at which the lint was found
character : The character (relative to 0) at which the lint was found
reason : The problem
evidence : The text line in which the problem occurred
raw : The raw message before the details were inserted
a : The first detail
b : The second detail
c : The third detail
d : The fourth detail
}
If a fatal error was found, a null will be the last element of the
JSLINT.errors array.
You can request a Function Report, which shows all of the functions
and the parameters and vars that they use. This can be used to find
implied global variables and other problems. The report is in HTML and
can be inserted in an HTML <body>.
var myReport = JSLINT.report(limited);
If limited is true, then the report will be limited to only errors.
You can request a data structure which contains JSLint's results.
var myData = JSLINT.data();
It returns a structure with this form:
{
errors: [
{
line: NUMBER,
character: NUMBER,
reason: STRING,
evidence: STRING
}
],
functions: [
name: STRING,
line: NUMBER,
last: NUMBER,
param: [
STRING
],
closure: [
STRING
],
var: [
STRING
],
exception: [
STRING
],
outer: [
STRING
],
unused: [
STRING
],
global: [
STRING
],
label: [
STRING
]
],
globals: [
STRING
],
member: {
STRING: NUMBER
},
unuseds: [
{
name: STRING,
line: NUMBER
}
],
implieds: [
{
name: STRING,
line: NUMBER
}
],
urls: [
STRING
],
json: BOOLEAN
}
Empty arrays will not be included.
You can obtain the parse tree that JSLint constructed while parsing. The
latest tree is kept in JSLINT.tree. A nice stringication can be produced
with
JSON.stringify(JSLINT.tree, [
'value', 'arity', 'name', 'first',
'second', 'third', 'block', 'else'
], 4));
*/
/*jslint
evil: true, nomen: false, onevar: false, regexp: false, strict: true
*/
/*members "\b", "\t", "\n", "\f", "\r", "!=", "!==", "\"", "%", "'",
"(begin)", "(breakage)", "(context)", "(end)", "(error)", "(global)",
"(identifier)", "(line)", "(loopage)", "(name)", "(onevar)",
"(params)", "(scope)", "(statement)", "(token)", "(verb)", ")", "*",
"+", "-", "/", ";", "<", "</", "<=", "==", "===", ">",
">=", ADSAFE,
ActiveXObject, Array, Boolean, COM, CScript, Canvas, CustomAnimation,
Date, Debug, E, Enumerator, Error, EvalError, FadeAnimation, Flash,
FormField, Frame, Function, HotKey, Image, JSON, LN10, LN2, LOG10E,
LOG2E, MAX_VALUE, MIN_VALUE, Math, MenuItem, MoveAnimation,
NEGATIVE_INFINITY, Number, Object, Option, PI, POSITIVE_INFINITY, Point,
RangeError, Rectangle, ReferenceError, RegExp, ResizeAnimation,
RotateAnimation, SQRT1_2, SQRT2, ScrollBar, String, Style, SyntaxError,
System, Text, TextArea, Timer, TypeError, URIError, URL, VBArray,
WScript, Web, Window, XMLDOM, XMLHttpRequest, "\\", a, a_function,
a_label, a_not_allowed, a_not_defined, a_scope, abbr, acronym,
activeborder, activecaption, addEventListener, address, adsafe,
adsafe_a, adsafe_autocomplete, adsafe_bad_id, adsafe_div,
adsafe_fragment, adsafe_go, adsafe_html, adsafe_id, adsafe_id_go,
adsafe_lib, adsafe_lib_second, adsafe_missing_id, adsafe_name_a,
adsafe_placement, adsafe_prefix_a, adsafe_script, adsafe_source,
adsafe_subscript_a, adsafe_tag, alert, aliceblue, all, already_defined,
and, animator, antiquewhite, appleScript, applet, apply, approved,
appworkspace, aqua, aquamarine, area, arguments, arity, article, aside,
assign, assign_exception, assignment_function_expression, at,
attribute_case_a, audio, autocomplete, avoid_a, azure, b, background,
"background-attachment", "background-color", "background-image",
"background-position", "background-repeat", bad_assignment, bad_color_a,
bad_constructor, bad_entity, bad_html, bad_id_a, bad_in_a,
bad_invocation, bad_name_a, bad_new, bad_number, bad_operand, bad_type,
bad_url, bad_wrap, base, bdo, beep, beige, big, bisque, bitwise, black,
blanchedalmond, block, blockquote, blue, blueviolet, blur, body, border,
"border-bottom", "border-bottom-color", "border-bottom-style",
"border-bottom-width", "border-collapse", "border-color", "border-left",
"border-left-color", "border-left-style", "border-left-width",
"border-right", "border-right-color", "border-right-style",
"border-right-width", "border-spacing", "border-style", "border-top",
"border-top-color", "border-top-style", "border-top-width",
"border-width", bottom, br, braille, brown, browser, burlywood, button,
buttonface, buttonhighlight, buttonshadow, buttontext, bytesToUIString,
c, cadetblue, call, callee, caller, canvas, cap, caption,
"caption-side", captiontext, case, center, charAt, charCodeAt,
character, chartreuse, chocolate, chooseColor, chooseFile, chooseFolder,
cite, clear, clearInterval, clearTimeout, clip, close, closeWidget,
closed, closure, cm, code, col, colgroup, color, combine_var, command,
comments, concat, conditional_assignment, confirm, confusing_a,
confusing_regexp, console, constructor, constructor_name_a, content,
control_a, convertPathToHFS, convertPathToPlatform, coral,
cornflowerblue, cornsilk, "counter-increment", "counter-reset", create,
crimson, css, cursor, cyan, d, dangerous_comment, dangling_a, 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, default, defaultStatus, defineClass, del, deleted,
deserialize, details, devel, dfn, dialog, dimgray, dir, direction,
display, disrupt, div, dl, do, document, dodgerblue, dt, duplicate_a,
edge, edition, else, em, embed, embossed, empty, "empty-cells",
empty_block, empty_case, empty_class, encodeURI, encodeURIComponent,
entityify, errors, es5, escape, eval, event, evidence, evil, ex,
exception, exec, expected_a, expected_a_at_b_c, expected_a_b,
expected_a_b_from_c_d, expected_at_a, expected_attribute_a,
expected_attribute_value_a, expected_class_a, expected_fraction_a,
expected_id_a, expected_identifier_a, expected_identifier_a_reserved,
expected_lang_a, expected_linear_a, expected_media_a, expected_name_a,
expected_nonstandard_style_attribute, expected_number_a,
expected_operator_a, expected_percent_a, expected_positive_a,
expected_pseudo_a, expected_selector_a, expected_small_a,
expected_space_a_b, expected_string_a, expected_style_attribute,
expected_style_pattern, expected_tagname_a, fieldset, figure,
filesystem, firebrick, first, float, floor, floralwhite, focus,
focusWidget, font, "font-family", "font-size", "font-size-adjust",
"font-stretch", "font-style", "font-variant", "font-weight", footer,
for, for_if, forestgreen, forin, form, fragment, frame, frames,
frameset, from, fromCharCode, fuchsia, fud, funct, function,
function_block, function_eval, function_loop, function_statement,
function_strict, functions, g, gainsboro, gc, getComputedStyle, get_set,
ghostwhite, 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, "hta:application", html, html_confusion_a,
html_handlers, i, iTunes, id, identifier, identifier_function, iframe,
img, immed, implied_evil, implieds, in, inactiveborder, inactivecaption,
inactivecaptiontext, include, indent, indexOf, indianred, indigo,
infobackground, infotext, init, input, ins, insecure_a, isAlpha,
isApplicationRunning, isArray, isDigit, isFinite, isNaN, ivory, join,
jslint, json, kbd, keygen, keys, khaki, konfabulatorVersion, label,
label_a_b, lang, lavender, lavenderblush, lawngreen, lbp,
leading_decimal_a, 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", mark, "marker-offset",
maroon, match, "max-height", "max-width", maxerr, maxlen, md5,
mediumaquamarine, mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise,
mediumvioletred, member, menu, menutext, message, meta, meter,
midnightblue, "min-height", "min-width", mintcream, missing_a,
missing_a_after_b, missing_option, missing_property, missing_space_a_b,
missing_url, missing_use_strict, mistyrose, mixed, mm, moccasin, mode,
moveBy, moveTo, move_invocation, move_var, name, name_function, nav,
navajowhite, navigator, navy, nested_comment, newcap, next, noframes,
nomen, noscript, not, not_a_constructor, not_a_function, not_a_label,
not_a_scope, not_greater, 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",
"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",
palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip,
param, parameter_a_get_b, parameter_set_a, paren, parent, parseFloat,
parseInt, passfail, pc, peachpuff, peru, pink, play, plum, plusplus,
pop, popupMenu, position, postcomments, powderblue, pre, predef,
preferenceGroups, preferences, prev, print, progress, projection,
prompt, prototype, pt, purple, push, px, q, quit, quote, quotes, radix,
random, range, raw, readFile, readUrl, read_only, reason, red,
redefinition_a, regexp, reloadWidget, removeEventListener, replace,
report, reserved, reserved_a, resizeBy, resizeTo, resolvePath,
resumeUpdates, rhino, right, rosybrown, royalblue, rp, rt, ruby,
runCommand, runCommandInBg, saddlebrown, safe, salmon, samp, sandybrown,
saveAs, savePreferences, scanned_a_b, screen, script, scroll, scrollBy,
scrollTo, scrollbar, seagreen, seal, search, seashell, second, section,
select, serialize, setInterval, setTimeout, shift,
showWidgetPreferences, sienna, silver, skyblue, slash_equal, slateblue,
slategray, sleep, slice, small, snow, sort, source, span, spawn, speak,
speech, split, springgreen, src, stack, statement, statement_block,
status, steelblue, stopping, strange_loop, strict, strong, style,
styleproperty, sub, subscript, substr, sup, supplant, suppressUpdates,
switch, sync, system, table, "table-layout", tag_a_in_b, tan, tbody, td,
teal, tellWidget, test, "text-align", "text-decoration", "text-indent",
"text-shadow", "text-transform", textarea, tfoot, th, thead, third,
thistle, threeddarkshadow, threedface, threedhighlight,
threedlightshadow, threedshadow, thru, time, title, toLowerCase,
toString, toUpperCase, toint32, token, tomato, too_long, too_many, top,
tr, trailing_decimal_a, tree, tt, tty, turquoise, tv, type, u, ul,
unbegun_comment, unclosed, unclosed_comment, unclosed_regexp, undef,
unescape, unescaped_a, unexpected_a, unexpected_char_a_b,
unexpected_comment, unexpected_member_a, unexpected_space_a_b,
"unicode-bidi", unnecessary_escapement, unnecessary_initialize,
unnecessary_use, unreachable_a_b, unrecognized_style_attribute_a,
unrecognized_tag_a, unsafe, unused, unwatch, updateNow, url, urls,
use_array, use_braces, use_object, used_before_a, value, valueOf, var,
var_a_not, version, "vertical-align", video, violet, visibility, was,
watch, weird_new, weird_program, wheat, while, white, "white-space",
whitesmoke, widget, width, window, windowframe, windows, windowtext,
"word-spacing", "word-wrap", wrap, wrap_immediate, wrap_regexp,
write_is_wrong, yahooCheckLogin, yahooLogin, yahooLogout, yellow,
yellowgreen, "z-index", "}"
*/
// We build the application inside a function so that we produce only a single
// global variable. That function will be invoked immediately, and its return
// value is the JSLINT function itself. That function is also an object that
// can contain data and other functions.
var JSLINT = (function () {
"use strict";
var adsafe_id, // The widget's ADsafe id.
adsafe_may, // The widget may load approved scripts.
adsafe_went, // ADSAFE.go has been called.
anonname, // The guessed name for anonymous functions.
approved, // ADsafe approved urls.
// These are operators that should not be used with the ! operator.
bang = {
'<': true,
'<=': true,
'==': true,
'===': true,
'!==': true,
'!=': true,
'>': true,
'>=': true,
'+': true,
'-': true,
'*': true,
'/': true,
'%': true
},
// These are property names that should not be permitted in the safe subset.
banned = { // the member names that ADsafe prohibits.
'arguments' : true,
callee : true,
caller : true,
constructor : true,
'eval' : true,
prototype : true,
stack : true,
unwatch : true,
valueOf : true,
watch : true
},
// These are the JSLint boolean options.
boolOptions = {
adsafe : true, // if ADsafe should be enforced
bitwise : true, // if bitwise operators should not be allowed
browser : true, // if the standard browser globals should be predefined
cap : true, // if upper case HTML should be allowed
css : true, // if CSS workarounds should be tolerated
debug : true, // if debugger statements should be allowed
devel : true, // if logging should be allowed (console, alert, etc.)
es5 : true, // if ES5 syntax should be allowed
evil : true, // if eval should be allowed
forin : true, // if for in statements must filter
fragment : true, // if HTML fragments should be allowed
newcap : true, // if constructor names must be capitalized
nomen : true, // if names should be checked
on : true, // if HTML event handlers should be allowed
onevar : true, // if only one var statement per function should be allowed
passfail : true, // if the scan should stop on first error
plusplus : true, // if increment/decrement should not be allowed
regexp : true, // if the . should not be allowed in regexp literals
rhino : true, // if the Rhino environment globals should be predefined
undef : true, // if variables should be declared before used
safe : true, // if use of some browser features should be restricted
windows : true, // if MS Windows-specigic globals should be predefined
strict : true, // require the "use strict"; pragma
sub : true, // if all forms of subscript notation are tolerated
white : true, // if strict whitespace rules apply
widget : true // if the Yahoo Widgets globals should be predefined
},
// browser contains a set of global names which are commonly provided by a
// web browser environment.
browser = {
addEventListener: false,
blur : false,
clearInterval : false,
clearTimeout : false,
close : false,
closed : false,
defaultStatus : false,
document : false,
event : false,
focus : false,
frames : false,
getComputedStyle: false,
history : false,
Image : false,
length : false,
location : false,
moveBy : false,
moveTo : false,
name : false,
navigator : false,
onbeforeunload : true,
onblur : true,
onerror : true,
onfocus : true,
onload : true,
onresize : true,
onunload : true,
open : false,
opener : false,
Option : false,
parent : false,
print : false,
removeEventListener: false,
resizeBy : false,
resizeTo : false,
screen : false,
scroll : false,
scrollBy : false,
scrollTo : false,
setInterval : false,
setTimeout : false,
status : false,
top : false,
XMLHttpRequest : false
},
bundle = {
a_function: "'{a}' is a function.",
a_label: "'{a}' is a statement label.",
a_not_allowed: "'{a}' is not allowed.",
a_not_defined: "'{a}' is not defined.",
a_scope: "'{a}' used out of scope.",
adsafe: "ADsafe violation.",
adsafe_a: "ADsafe violation: '{a}'.",
adsafe_autocomplete: "ADsafe autocomplete violation.",
adsafe_bad_id: "ADSAFE violation: bad id.",
adsafe_div: "ADsafe violation: Wrap the widget in a div.",
adsafe_fragment: "ADSAFE: Use the fragment option.",
adsafe_go: "ADsafe violation: Missing ADSAFE.go.",
adsafe_html: "Currently, ADsafe does not operate on whole HTML documents. It operates on <div> fragments and .js files.",
adsafe_id: "ADsafe violation: id does not match.",
adsafe_id_go: "ADsafe violation: Missing ADSAFE.id or ADSAFE.go.",
adsafe_lib: "ADsafe lib violation.",
adsafe_lib_second: "ADsafe: The second argument to lib must be a function.",
adsafe_missing_id: "ADSAFE violation: missing ID_.",
adsafe_name_a: "ADsafe name violation: '{a}'.",
adsafe_placement: "ADsafe script placement violation.",
adsafe_prefix_a: "ADsafe violation: An id must have a '{a}' prefix",
adsafe_script: "ADsafe script violation.",
adsafe_source: "ADsafe unapproved script source.",
adsafe_subscript_a: "ADsafe subscript '{a}'.",
adsafe_tag: "ADsafe violation: Disallowed tag '{a}'.",
already_defined: "'{a}' is already defined.",
and: "The '&&' subexpression should be wrapped in parens.",
assign_exception: "Do not assign to the exception parameter.",
assignment_function_expression: "Expected an assignment or function call and instead saw an expression.",
attribute_case_a: "Attribute '{a}' not all lower case.",
avoid_a: "Avoid '{a}'.",
bad_assignment: "Bad assignment.",
bad_color_a: "Bad hex color '{a}'.",
bad_constructor: "Bad constructor.",
bad_entity: "Bad entity.",
bad_html: "Bad HTML string",
bad_id_a: "Bad id: '{a}'.",
bad_in_a: "Bad for in variable '{a}'.",
bad_invocation: "Bad invocation.",
bad_name_a: "Bad name: '{a}'.",
bad_new: "Do not use 'new' for side effects.",
bad_number: "Bad number '{a}'.",
bad_operand: "Bad operand.",
bad_type: "Bad type.",
bad_url: "Bad url string.",
bad_wrap: "Do not wrap function literals in parens unless they are to be immediately invoked.",
combine_var: "Combine this with the previous 'var' statement.",
conditional_assignment: "Expected a conditional expression and instead saw an assignment.",
confusing_a: "Confusing use of '{a}'.",
confusing_regexp: "Confusing regular expression.",
constructor_name_a: "A constructor name '{a}' should start with an uppercase letter.",
control_a: "Unexpected control character '{a}'.",
css: "A css file should begin with @charset 'UTF-8';",
dangling_a: "Unexpected dangling '_' in '{a}'.",
dangerous_comment: "Dangerous comment.",
deleted: "Only properties should be deleted.",
duplicate_a: "Duplicate '{a}'.",
empty_block: "Empty block.",
empty_case: "Empty case.",
empty_class: "Empty class.",
evil: "eval is evil.",
expected_a: "Expected '{a}'.",
expected_a_b: "Expected '{a}' and instead saw '{b}'.",
expected_a_b_from_c_d: "Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
expected_at_a: "Expected an at-rule, and instead saw @{a}.",
expected_a_at_b_c: "Expected '{a}' at column {b}, not column {c}.",
expected_attribute_a: "Expected an attribute, and instead saw [{a}].",
expected_attribute_value_a: "Expected an attribute value and instead saw '{a}'.",
expected_class_a: "Expected a class, and instead saw .{a}.",
expected_fraction_a: "Expected a number between 0 and 1 and instead saw '{a}'",
expected_id_a: "Expected an id, and instead saw #{a}.",
expected_identifier_a: "Expected an identifier and instead saw '{a}'.",
expected_identifier_a_reserved: "Expected an identifier and instead saw '{a}' (a reserved word).",
expected_linear_a: "Expected a linear unit and instead saw '{a}'.",
expected_lang_a: "Expected a lang code, and instead saw :{a}.",
expected_media_a: "Expected a CSS media type, and instead saw '{a}'.",
expected_name_a: "Expected a name and instead saw '{a}'.",
expected_nonstandard_style_attribute: "Expected a non-standard style attribute and instead saw '{a}'.",
expected_number_a: "Expected a number and instead saw '{a}'.",
expected_operator_a: "Expected an operator and instead saw '{a}'.",
expected_percent_a: "Expected a percentage and instead saw '{a}'",
expected_positive_a: "Expected a positive number and instead saw '{a}'",
expected_pseudo_a: "Expected a pseudo, and instead saw :{a}.",
expected_selector_a: "Expected a CSS selector, and instead saw {a}.",
expected_small_a: "Expected a small number and instead saw '{a}'",
expected_space_a_b: "Expected exactly one space between '{a}' and '{b}'.",
expected_string_a: "Expected a string and instead saw {a}.",
expected_style_attribute: "Excepted a style attribute, and instead saw '{a}'.",
expected_style_pattern: "Expected a style pattern, and instead saw '{a}'.",
expected_tagname_a: "Expected a tagName, and instead saw {a}.",
for_if: "The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.",
function_block: "Function statements should not be placed in blocks. " +
"Use a function expression or move the statement to the top of " +
"the outer function.",
function_eval: "The Function constructor is eval.",
function_loop: "Don't make functions within a loop.",
function_statement: "Function statements are not invocable. " +
"Wrap the whole function invocation in parens.",
function_strict: "Use the function form of \"use strict\".",
get_set: "get/set are ES5 features.",
html_confusion_a: "HTML confusion in regular expression '<{a}'.",
html_handlers: "Avoid HTML event handlers.",
identifier_function: "Expected an identifier in an assignment and instead saw a function invocation.",
implied_evil: "Implied eval is evil. Pass a function instead of a string.",
insecure_a: "Insecure '{a}'.",
isNaN: "Use the isNaN function to compare with NaN.",
label_a_b: "Label '{a}' on '{b}' statement.",
lang: "lang is deprecated.",
leading_decimal_a: "A leading decimal point can be confused with a dot: '.{a}'.",
missing_a: "Missing '{a}'.",
missing_a_after_b: "Missing '{a}' after '{b}'.",
missing_option: "Missing option value.",
missing_property: "Missing property name.",
missing_space_a_b: "Missing space between '{a}' and '{b}'.",
missing_url: "Missing url.",
missing_use_strict: "Missing \"use strict\" statement.",
mixed: "Mixed spaces and tabs.",
move_invocation: "Move the invocation into the parens that contain the function.",
move_var: "Move 'var' declarations to the top of the function.",
name_function: "Missing name in function statement.",
nested_comment: "Nested comment.",
not: "Nested not.",
not_a_constructor: "Do not use {a} as a constructor.",
not_a_function: "'{a}' is not a function.",
not_a_label: "'{a}' is not a label.",
not_a_scope: "'{a}' is out of scope.",
not_greater: "'{a}' should not be greater than '{b}'.",
parameter_a_get_b: "Unexpected parameter '{a}' in get {b} function.",
parameter_set_a: "Expected parameter (value) in set {a} function.",
radix: "Missing radix parameter.",
read_only: "Read only.",
redefinition_a: "Redefinition of '{a}'.",
reserved_a: "Reserved name '{a}'.",
scanned_a_b: "{a} ({b}% scanned).",
slash_equal: "A regular expression literal can be confused with '/='.",
statement_block: "Expected to see a statement and instead saw a block.",
stopping: "Stopping. ",
strange_loop: "Strange loop.",
strict: "Strict violation.",
subscript: "['{a}'] is better written in dot notation.",
tag_a_in_b: "A '<{a}>' must be within '<{b}>'.",
too_long: "Line too long.",
too_many: "Too many errors.",
trailing_decimal_a: "A trailing decimal point can be confused with a dot: '.{a}'.",
type: "type is unnecessary.",
unbegun_comment: "Unbegun comment.",
unclosed: "Unclosed string.",
unclosed_comment: "Unclosed comment.",
unclosed_regexp: "Unclosed regular expression.",
unescaped_a: "Unescaped '{a}'.",
unexpected_a: "Unexpected '{a}'.",
unexpected_char_a_b: "Unexpected character '{a}' in {b}.",
unexpected_comment: "Unexpected comment.",
unexpected_member_a: "Unexpected /*member {a}.",
unexpected_space_a_b: "Unexpected space between '{a}' and '{b}'.",
unnecessary_escapement: "Unnecessary escapement.",
unnecessary_initialize: "It is not necessary to initialize '{a}' to 'undefined'.",
unnecessary_use: "Unnecessary \"use strict\".",
unreachable_a_b: "Unreachable '{a}' after '{b}'.",
unrecognized_style_attribute_a: "Unrecognized style attribute '{a}'.",
unrecognized_tag_a: "Unrecognized tag '<{a}>'.",
unsafe: "Unsafe character.",
url: "JavaScript URL.",
use_array: "Use the array literal notation [].",
use_braces: "Spaces are hard to count. Use {{a}}.",
use_object: "Use the object literal notation {}.",
used_before_a: "'{a}' was used before it was defined.",
var_a_not: "Variable {a} was not declared correctly.",
weird_new: "Weird construction. Delete 'new'.",
weird_program: "Weird program.",
wrap_immediate: "Wrap an immediate function invocation in parentheses " +
"to assist the reader in understanding that the expression " +
"is the result of a function, and not the function itself.",
wrap_regexp: "Wrap the /regexp/ literal in parens to disambiguate the slash operator.",
write_is_wrong: "document.write can be a form of eval."
},
cssAttributeData,
cssAny,
cssColorData = {
"aliceblue" : true,
"antiquewhite" : true,
"aqua" : true,
"aquamarine" : true,
"azure" : true,
"beige" : true,
"bisque" : true,
"black" : true,
"blanchedalmond" : true,
"blue" : true,
"blueviolet" : true,
"brown" : true,
"burlywood" : true,
"cadetblue" : true,
"chartreuse" : true,
"chocolate" : true,
"coral" : true,
"cornflowerblue" : true,
"cornsilk" : true,
"crimson" : true,
"cyan" : true,
"darkblue" : true,
"darkcyan" : true,
"darkgoldenrod" : true,
"darkgray" : true,
"darkgreen" : true,
"darkkhaki" : true,
"darkmagenta" : true,
"darkolivegreen" : true,
"darkorange" : true,
"darkorchid" : true,
"darkred" : true,
"darksalmon" : true,
"darkseagreen" : true,
"darkslateblue" : true,
"darkslategray" : true,
"darkturquoise" : true,
"darkviolet" : true,
"deeppink" : true,
"deepskyblue" : true,
"dimgray" : true,
"dodgerblue" : true,
"firebrick" : true,
"floralwhite" : true,
"forestgreen" : true,
"fuchsia" : true,
"gainsboro" : true,
"ghostwhite" : true,
"gold" : true,
"goldenrod" : true,
"gray" : true,
"green" : true,
"greenyellow" : true,
"honeydew" : true,
"hotpink" : true,
"indianred" : true,
"indigo" : true,
"ivory" : true,
"khaki" : true,
"lavender" : true,
"lavenderblush" : true,
"lawngreen" : true,
"lemonchiffon" : true,
"lightblue" : true,
"lightcoral" : true,
"lightcyan" : true,
"lightgoldenrodyellow" : true,
"lightgreen" : true,
"lightpink" : true,
"lightsalmon" : true,
"lightseagreen" : true,
"lightskyblue" : true,
"lightslategray" : true,
"lightsteelblue" : true,
"lightyellow" : true,
"lime" : true,
"limegreen" : true,
"linen" : true,
"magenta" : true,
"maroon" : true,
"mediumaquamarine" : true,
"mediumblue" : true,
"mediumorchid" : true,
"mediumpurple" : true,
"mediumseagreen" : true,
"mediumslateblue" : true,
"mediumspringgreen" : true,
"mediumturquoise" : true,
"mediumvioletred" : true,
"midnightblue" : true,
"mintcream" : true,
"mistyrose" : true,
"moccasin" : true,
"navajowhite" : true,
"navy" : true,
"oldlace" : true,
"olive" : true,
"olivedrab" : true,
"orange" : true,
"orangered" : true,
"orchid" : true,
"palegoldenrod" : true,
"palegreen" : true,
"paleturquoise" : true,
"palevioletred" : true,
"papayawhip" : true,
"peachpuff" : true,
"peru" : true,
"pink" : true,
"plum" : true,
"powderblue" : true,
"purple" : true,
"red" : true,
"rosybrown" : true,
"royalblue" : true,
"saddlebrown" : true,
"salmon" : true,
"sandybrown" : true,
"seagreen" : true,
"seashell" : true,
"sienna" : true,
"silver" : true,
"skyblue" : true,
"slateblue" : true,
"slategray" : true,
"snow" : true,
"springgreen" : true,
"steelblue" : true,
"tan" : true,
"teal" : true,
"thistle" : true,
"tomato" : true,
"turquoise" : true,
"violet" : true,
"wheat" : true,
"white" : true,
"whitesmoke" : true,
"yellow" : true,
"yellowgreen" : true,
"activeborder" : true,
"activecaption" : true,
"appworkspace" : true,
"background" : true,
"buttonface" : true,
"buttonhighlight" : true,
"buttonshadow" : true,
"buttontext" : true,
"captiontext" : true,
"graytext" : true,
"highlight" : true,
"highlighttext" : true,
"inactiveborder" : true,
"inactivecaption" : true,
"inactivecaptiontext" : true,
"infobackground" : true,
"infotext" : true,
"menu" : true,
"menutext" : true,
"scrollbar" : true,
"threeddarkshadow" : true,
"threedface" : true,
"threedhighlight" : true,
"threedlightshadow" : true,
"threedshadow" : true,
"window" : true,
"windowframe" : true,
"windowtext" : true
},
cssBorderStyle,
cssBreak,
cssLengthData = {
'%': true,
'cm': true,
'em': true,
'ex': true,
'in': true,
'mm': true,
'pc': true,
'pt': true,
'px': true
},
cssMedia,
cssOverflow,
devel = {
alert : false,
confirm : false,
console : false,
Debug : false,
opera : false,
prompt : false
},
escapes = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'/' : '\\/',
'\\': '\\\\'
},
funct, // The current function
functionicity = [
'closure', 'exception', 'global', 'label',
'outer', 'unused', 'var'
],
functions, // All of the functions
global, // The global scope
htmltag = {
a: {},
abbr: {},
acronym: {},
address: {},
applet: {},
area: {empty: true, parent: ' map '},
article: {},
aside: {},
audio: {},
b: {},
base: {empty: true, parent: ' head '},
bdo: {},
big: {},
blockquote: {},
body: {parent: ' html noframes '},
br: {empty: true},
button: {},
canvas: {parent: ' body p div th td '},
caption: {parent: ' table '},
center: {},
cite: {},
code: {},
col: {empty: true, parent: ' table colgroup '},
colgroup: {parent: ' table '},
command: {parent: ' menu '},
datalist: {},
dd: {parent: ' dl '},
del: {},
details: {},
dialog: {},
dfn: {},
dir: {},
div: {},
dl: {},
dt: {parent: ' dl '},
em: {},
embed: {},
fieldset: {},
figure: {},
font: {},
footer: {},
form: {},
frame: {empty: true, parent: ' frameset '},
frameset: {parent: ' html frameset '},
h1: {},
h2: {},
h3: {},
h4: {},
h5: {},
h6: {},
head: {parent: ' html '},
header: {},
hgroup: {},
hr: {empty: true},
'hta:application':
{empty: true, parent: ' head '},
html: {parent: '*'},
i: {},
iframe: {},
img: {empty: true},
input: {empty: true},
ins: {},
kbd: {},
keygen: {},
label: {},
legend: {parent: ' details fieldset figure '},
li: {parent: ' dir menu ol ul '},
link: {empty: true, parent: ' head '},
map: {},
mark: {},
menu: {},
meta: {empty: true, parent: ' head noframes noscript '},
meter: {},
nav: {},
noframes: {parent: ' html body '},
noscript: {parent: ' body head noframes '},
object: {},
ol: {},
optgroup: {parent: ' select '},
option: {parent: ' optgroup select '},
output: {},
p: {},
param: {empty: true, parent: ' applet object '},
pre: {},
progress: {},
q: {},
rp: {},
rt: {},
ruby: {},
samp: {},
script: {empty: true, parent: ' body div frame head iframe p pre span '},
section: {},
select: {},
small: {},
span: {},
source: {},
strong: {},
style: {parent: ' head ', empty: true},
sub: {},
sup: {},
table: {},
tbody: {parent: ' table '},
td: {parent: ' tr '},
textarea: {},
tfoot: {parent: ' table '},
th: {parent: ' tr '},
thead: {parent: ' table '},
time: {},
title: {parent: ' head '},
tr: {parent: ' table tbody thead tfoot '},
tt: {},
u: {},
ul: {},
'var': {},
video: {}
},
ids, // HTML ids
implied, // Implied globals
inblock,
indent,
jsonmode,
labelled = {
'do': true,
'for': true,
'switch': true,
'while': true
},
lines,
lookahead,
member,
membersOnly,
nexttoken,
option,
postscript = {
'(end)': true,
'(error)': true,
'</': true,
'}': true,
'"': true,
'\'': true,
'case': true,
'default': true
},
predefined, // Global variables defined by option
prereg,
prevtoken,
rhino = {
defineClass : false,
deserialize : false,
gc : false,
help : false,
load : false,
loadClass : false,
print : false,
quit : false,
readFile : false,
readUrl : false,
runCommand : false,
seal : false,
serialize : false,
spawn : false,
sync : false,
toint32 : false,
version : false
},
scope, // The current scope
semicolon_coda = {
';' : true,
'"' : true,
'\'': true,
')' : true
},
src,
stack,
// standard contains the global names that are provided by the
// ECMAScript standard.
standard = {
Array : false,
Boolean : false,
Date : false,
decodeURI : false,
decodeURIComponent : false,
encodeURI : false,
encodeURIComponent : false,
Error : false,
'eval' : false,
EvalError : false,
Function : false,
hasOwnProperty : false,
isFinite : false,
isNaN : false,
JSON : false,
Math : false,
Number : false,
Object : false,
parseInt : false,
parseFloat : false,
RangeError : false,
ReferenceError : false,
RegExp : false,
String : false,
SyntaxError : false,
TypeError : false,
URIError : false
},
standard_member = {
E : true,
LN2 : true,
LN10 : true,
LOG2E : true,
LOG10E : true,
MAX_VALUE : true,
MIN_VALUE : true,
NEGATIVE_INFINITY : true,
PI : true,
POSITIVE_INFINITY : true,
SQRT1_2 : true,
SQRT2 : true
},
strict_mode,
syntax = {},
tab,
token,
urls,
var_mode,
warnings,
// widget contains the global names which are provided to a Yahoo
// (fna Konfabulator) widget.
widget = {
alert : true,
animator : true,
appleScript : true,
beep : true,
bytesToUIString : true,
Canvas : true,
chooseColor : true,
chooseFile : true,
chooseFolder : true,
closeWidget : true,
COM : true,
convertPathToHFS : true,
convertPathToPlatform : true,
CustomAnimation : true,
escape : true,
FadeAnimation : true,
filesystem : true,
Flash : true,
focusWidget : true,
form : true,
FormField : true,
Frame : true,
HotKey : true,
Image : true,
include : true,
isApplicationRunning : true,
iTunes : true,
konfabulatorVersion : true,
log : true,
md5 : true,
MenuItem : true,
MoveAnimation : true,
openURL : true,
play : true,
Point : true,