init commit

This commit is contained in:
2016-06-09 17:51:55 -04:00
commit 486ed15b61
9915 changed files with 1035994 additions and 0 deletions

751
node_modules/jshint/src/cli.js generated vendored Normal file
View File

@@ -0,0 +1,751 @@
"use strict";
var _ = require("lodash");
var fs = require("fs");
var cli = require("cli");
var path = require("path");
var shjs = require("shelljs");
var minimatch = require("minimatch");
var htmlparser = require("htmlparser2");
var exit = require("exit");
var stripJsonComments = require("strip-json-comments");
var JSHINT = require("./jshint.js").JSHINT;
var defReporter = require("./reporters/default").reporter;
var OPTIONS = {
"config": ["c", "Custom configuration file", "string", false ],
"reporter": ["reporter", "Custom reporter (<PATH>|jslint|checkstyle|unix)", "string", undefined ],
"exclude": ["exclude",
"Exclude files matching the given filename pattern (same as .jshintignore)", "string", null],
"exclude-path": ["exclude-path", "Pass in a custom jshintignore file path", "string", null],
"filename": ["filename",
"Pass in a filename when using STDIN to emulate config lookup for that file name",
"string", null],
"verbose": ["verbose", "Show message codes"],
"show-non-errors": ["show-non-errors", "Show additional data generated by jshint"],
"extra-ext": ["e",
"Comma-separated list of file extensions to use (default is .js)", "string", ""],
"extract": [
"extract",
"Extract inline scripts contained in HTML (auto|always|never, default to never)",
"string",
"never"
],
// Deprecated options.
"jslint-reporter": [
"jslint-reporter",
deprecated("Use a jslint compatible reporter", "--reporter=jslint")
],
"checkstyle-reporter": [
"checkstyle-reporter",
deprecated("Use a CheckStyle compatible XML reporter", "--reporter=checkstyle")
]
};
/**
* Returns the same text but with a deprecation notice.
* Useful for options descriptions.
*
* @param {string} text
* @param {string} alt (optional) Alternative command to include in the
* deprecation notice.
*
* @returns {string}
*/
function deprecated(text, alt) {
if (!alt) {
return text + " (DEPRECATED)";
}
return text + " (DEPRECATED, use " + alt + " instead)";
}
/**
* Tries to find a configuration file in either project directory
* or in the home directory. Configuration files are named
* '.jshintrc'.
*
* @param {string} file path to the file to be linted
* @returns {string} a path to the config file
*/
function findConfig(file) {
var dir = path.dirname(path.resolve(file));
var envs = getHomeDir();
if (!envs)
return home;
var home = path.normalize(path.join(envs, ".jshintrc"));
var proj = findFile(".jshintrc", dir);
if (proj)
return proj;
if (shjs.test("-e", home))
return home;
return null;
}
function getHomeDir() {
var homePath = "";
var environment = global.process.env;
var paths = [
environment.USERPROFILE,
environment.HOME,
environment.HOMEPATH,
environment.HOMEDRIVE + environment.HOMEPATH
];
while (paths.length) {
homePath = paths.shift();
if (fs.existsSync(homePath)) {
return homePath;
}
}
}
/**
* Tries to find JSHint configuration within a package.json file
* (if any). It search in the current directory and then goes up
* all the way to the root just like findFile.
*
* @param {string} file path to the file to be linted
* @returns {object} config object
*/
function loadNpmConfig(file) {
var dir = path.dirname(path.resolve(file));
var fp = findFile("package.json", dir);
if (!fp)
return null;
try {
return require(fp).jshintConfig;
} catch (e) {
return null;
}
}
/**
* Tries to import a reporter file and returns its reference.
*
* @param {string} fp a path to the reporter file
* @returns {object} imported module for the reporter or 'null'
* if a module cannot be imported.
*/
function loadReporter(fp) {
try {
return require(fp).reporter;
} catch (err) {
return null;
}
}
// Storage for memoized results from find file
// Should prevent lots of directory traversal &
// lookups when liniting an entire project
var findFileResults = {};
/**
* Searches for a file with a specified name starting with
* 'dir' and going all the way up either until it finds the file
* or hits the root.
*
* @param {string} name filename to search for (e.g. .jshintrc)
* @param {string} dir directory to start search from (default:
* current working directory)
*
* @returns {string} normalized filename
*/
function findFile(name, cwd) {
cwd = cwd || process.cwd();
var filename = path.normalize(path.join(cwd, name));
if (findFileResults[filename] !== undefined) {
return findFileResults[filename];
}
var parent = path.resolve(cwd, "../");
if (shjs.test("-e", filename)) {
findFileResults[filename] = filename;
return filename;
}
if (cwd === parent) {
findFileResults[filename] = null;
return null;
}
return findFile(name, parent);
}
/**
* Loads a list of files that have to be skipped. JSHint assumes that
* the list is located in a file called '.jshintignore'.
*
* @return {array} a list of files to ignore.
*/
function loadIgnores(params) {
var file = findFile(params.excludePath || ".jshintignore", params.cwd) || "";
if (!file && !params.exclude) {
return [];
}
var lines = (file ? shjs.cat(file) : "").split("\n");
lines.unshift(params.exclude || "");
return lines
.filter(function(line) {
return !!line.trim();
})
.map(function(line) {
if (line[0] === "!")
return "!" + path.resolve(path.dirname(file), line.substr(1).trim());
return path.join(path.dirname(file), line.trim());
});
}
/**
* Checks whether we should ignore a file or not.
*
* @param {string} fp a path to a file
* @param {array} patterns a list of patterns for files to ignore
*
* @return {boolean} 'true' if file should be ignored, 'false' otherwise.
*/
function isIgnored(fp, patterns) {
return patterns.some(function(ip) {
if (minimatch(path.resolve(fp), ip, { nocase: true })) {
return true;
}
if (path.resolve(fp) === ip) {
return true;
}
if (shjs.test("-d", fp) && ip.match(/^[^\/]*\/?$/) &&
fp.match(new RegExp("^" + ip + ".*"))) {
return true;
}
});
}
/**
* Extract JS code from a given source code. The source code my be either HTML
* code or JS code. In the latter case, no extraction will be done unless
* 'always' is given.
*
* @param {string} code a piece of code
* @param {string} when 'always' will extract the JS code, no matter what.
* 'never' won't do anything. 'auto' will check if the code looks like HTML
* before extracting it.
*
* @return {string} the extracted code
*/
function extract(code, when) {
// A JS file won't start with a less-than character, whereas a HTML file
// should always start with that.
if (when !== "always" && (when !== "auto" || !/^\s*</.test(code)))
return code;
var inscript = false;
var index = 0;
var js = [];
var startOffset;
// Test if current tag is a valid <script> tag.
function onopen(name, attrs) {
if (name !== "script")
return;
if (attrs.type && !/text\/javascript/.test(attrs.type.toLowerCase()))
return;
// Mark that we're inside a <script> a tag and push all new lines
// in between the last </script> tag and this <script> tag to preserve
// location information.
inscript = true;
js.push.apply(js, code.slice(index, parser.endIndex).match(/\n\r|\n|\r/g));
startOffset = null;
}
function onclose(name) {
if (name !== "script" || !inscript)
return;
inscript = false;
index = parser.startIndex;
startOffset = null;
}
function ontext(data) {
if (!inscript)
return;
var lines = data.split(/\n\r|\n|\r/);
if (!startOffset) {
lines.some(function(line) {
if (!line) return;
startOffset = /^(\s*)/.exec(line)[1];
return true;
});
}
// check for startOffset again to remove leading white space from first line
if (startOffset) {
lines = lines.map(function(line) {
return line.replace(startOffset, "");
});
data = lines.join("\n");
}
js.push(data); // Collect JavaScript code.
}
var parser = new htmlparser.Parser({ onopentag: onopen, onclosetag: onclose, ontext: ontext });
parser.parseComplete(code);
return js.join("");
}
/**
* Crude version of source maps: extract how much JavaSscript in HTML
* was shifted based on first JS line. For example if first js line
* is offset by 4 spaces, each line in this js fragment will have offset 4
* to restore the original column.
*
* @param {string} code a piece of code
* @param {string} when 'always' will extract the JS code, no matter what.
* 'never' won't do anything. 'auto' will check if the code looks like HTML
* before extracting it.
*
* @return {Array} extracted offsets
*/
function extractOffsets(code, when) {
// A JS file won't start with a less-than character, whereas a HTML file
// should always start with that.
if (when !== "always" && (when !== "auto" || !/^\s*</.test(code)))
return;
var inscript = false;
var index = 0;
var lineCounter = 0;
var startOffset;
var offsets = [];
// Test if current tag is a valid <script> tag.
function onopen(name, attrs) {
if (name !== "script")
return;
if (attrs.type && !/text\/javascript/.test(attrs.type.toLowerCase()))
return;
// Mark that we're inside a <script> a tag and push all new lines
// in between the last </script> tag and this <script> tag to preserve
// location information.
inscript = true;
var fragment = code.slice(index, parser.endIndex);
var n = (fragment.match(/\n\r|\n|\r/g) || []).length;
lineCounter += n;
startOffset = null;
}
function onclose(name) {
if (name !== "script" || !inscript)
return;
inscript = false;
index = parser.startIndex;
startOffset = null;
}
function ontext(data) {
if (!inscript)
return;
var lines = data.split(/\n\r|\n|\r/);
if (!startOffset) {
lines.some(function(line) {
if (!line) return;
startOffset = /^(\s*)/.exec(line)[1];
return true;
});
}
// check for startOffset again to remove leading white space from first line
lines.forEach(function() {
lineCounter += 1;
if (startOffset) {
offsets[lineCounter] = startOffset.length;
} else {
offsets[lineCounter] = 0;
}
});
}
var parser = new htmlparser.Parser({ onopentag: onopen, onclosetag: onclose, ontext: ontext });
parser.parseComplete(code);
return offsets;
}
/**
* Recursively gather all files that need to be linted,
* excluding those that user asked to ignore.
*
* @param {string} fp a path to a file or directory to lint
* @param {array} files a pointer to an array that stores a list of files
* @param {array} ignores a list of patterns for files to ignore
* @param {array} ext a list of non-dot-js extensions to lint
*/
function collect(fp, files, ignores, ext) {
if (ignores && isIgnored(fp, ignores)) {
return;
}
if (!shjs.test("-e", fp)) {
cli.error("Can't open " + fp);
return;
}
if (shjs.test("-d", fp)) {
shjs.ls(fp).forEach(function(item) {
var itempath = path.join(fp, item);
if (shjs.test("-d", itempath) || item.match(ext)) {
collect(itempath, files, ignores, ext);
}
});
return;
}
files.push(fp);
}
/**
* Runs JSHint against provided file and saves the result
*
* @param {string} code code that needs to be linted
* @param {object} results a pointer to an object with results
* @param {object} config an object with JSHint configuration
* @param {object} data a pointer to an object with extra data
* @param {string} file (optional) file name that is being linted
*/
function lint(code, results, config, data, file) {
var globals;
var lintData;
var buffer = [];
config = config || {};
config = JSON.parse(JSON.stringify(config));
if (config.prereq) {
config.prereq.forEach(function(fp) {
fp = path.join(config.dirname, fp);
if (shjs.test("-e", fp))
buffer.push(shjs.cat(fp));
});
delete config.prereq;
}
if (config.globals) {
globals = config.globals;
delete config.globals;
}
if (config.overrides) {
if (file) {
_.each(config.overrides, function(options, pattern) {
if (minimatch(path.normalize(file), pattern, { nocase: true, matchBase: true })) {
if (options.globals) {
globals = _.extend(globals || {}, options.globals);
delete options.globals;
}
_.extend(config, options);
}
});
}
delete config.overrides;
}
delete config.dirname;
buffer.push(code);
buffer = buffer.join("\n");
buffer = buffer.replace(/^\uFEFF/, ""); // Remove potential Unicode BOM.
if (!JSHINT(buffer, config, globals)) {
JSHINT.errors.forEach(function(err) {
if (err) {
results.push({ file: file || "stdin", error: err });
}
});
}
lintData = JSHINT.data();
if (lintData) {
lintData.file = file || "stdin";
data.push(lintData);
}
}
var exports = {
extract: extract,
exit: exit,
/**
* Returns a configuration file or nothing, if it can't be found.
*/
getConfig: function(fp) {
return loadNpmConfig(fp) || exports.loadConfig(findConfig(fp));
},
/**
* Loads and parses a configuration file.
*
* @param {string} fp a path to the config file
* @returns {object} config object
*/
loadConfig: function(fp) {
if (!fp) {
return {};
}
if (!shjs.test("-e", fp)) {
cli.error("Can't find config file: " + fp);
exports.exit(1);
}
try {
var config = JSON.parse(stripJsonComments(shjs.cat(fp)));
config.dirname = path.dirname(fp);
if (config['extends']) {
var baseConfig = exports.loadConfig(path.resolve(config.dirname, config['extends']));
config = _.merge({}, baseConfig, config, function(a, b) {
if (_.isArray(a)) {
return a.concat(b);
}
});
delete config['extends'];
}
return config;
} catch (err) {
cli.error("Can't parse config file: " + fp + "\nError:" + err);
exports.exit(1);
}
},
/**
* Gathers all files that need to be linted
*
* @param {object} post-processed options from 'interpret':
* args - CLI arguments
* ignores - A list of files/dirs to ignore (defaults to .jshintignores)
* extensions - A list of non-dot-js extensions to check
*/
gather: function(opts) {
var files = [];
var reg = new RegExp("\\.(js" +
(!opts.extensions ? "" : "|" +
opts.extensions.replace(/,/g, "|").replace(/[\. ]/g, "")) + ")$");
var ignores = !opts.ignores ? loadIgnores({ cwd: opts.cwd }) :
opts.ignores.map(function(target) {
return path.resolve(target);
});
opts.args.forEach(function(target) {
collect(target, files, ignores, reg);
});
return files;
},
/**
* Gathers all files that need to be linted, lints them, sends them to
* a reporter and returns the overall result.
*
* @param {object} post-processed options from 'interpret':
* args - CLI arguments
* config - Configuration object
* reporter - Reporter function
* ignores - A list of files/dirs to ignore
* extensions - A list of non-dot-js extensions to check
* @param {function} cb a callback to call when function is finished
* asynchronously.
*
* @returns {bool} 'true' if all files passed, 'false' otherwise and 'null'
* when function will be finished asynchronously.
*/
run: function(opts, cb) {
var files = exports.gather(opts);
var results = [];
var data = [];
if (opts.useStdin) {
cli.withStdin(function(code) {
var config = opts.config;
var filename;
// There is an if(filename) check in the lint() function called below.
// passing a filename of undefined is the same as calling the function
// without a filename. If there is no opts.filename, filename remains
// undefined and lint() is effectively called with 4 parameters.
if (opts.filename) {
filename = path.resolve(opts.filename);
}
if (filename && !config) {
config = loadNpmConfig(filename) ||
exports.loadConfig(findConfig(filename));
}
config = config || {};
lint(extract(code, opts.extract), results, config, data, filename);
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
cb(results.length === 0);
});
return null;
}
files.forEach(function(file) {
var config = opts.config || exports.getConfig(file);
var code;
try {
code = shjs.cat(file);
} catch (err) {
cli.error("Can't open " + file);
exports.exit(1);
}
lint(extract(code, opts.extract), results, config, data, file);
if (results.length) {
var offsets = extractOffsets(code, opts.extract);
if (offsets && offsets.length) {
results.forEach(function(errorInfo) {
var line = errorInfo.error.line;
if (line >= 0 && line < offsets.length) {
var offset = +offsets[line];
errorInfo.error.character += offset;
}
});
}
}
});
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
return results.length === 0;
},
/**
* Helper exposed for testing.
* Used to determine is stdout has any buffered output before exiting the program
*/
getBufferSize: function() {
return process.stdout.bufferSize;
},
/**
* Main entrance function. Parses arguments and calls 'run' when
* its done. This function is called from bin/jshint file.
*
* @param {object} args, arguments in the process.argv format.
*/
interpret: function(args) {
cli.setArgv(args);
cli.options = {};
cli.enable("version", "glob", "help");
cli.setApp(path.resolve(__dirname + "/../package.json"));
var options = cli.parse(OPTIONS);
// Use config file if specified
var config;
if (options.config) {
config = exports.loadConfig(options.config);
}
switch (true) {
// JSLint reporter
case options.reporter === "jslint":
case options["jslint-reporter"]:
options.reporter = "./reporters/jslint_xml.js";
break;
// CheckStyle (XML) reporter
case options.reporter === "checkstyle":
case options["checkstyle-reporter"]:
options.reporter = "./reporters/checkstyle.js";
break;
// Unix reporter
case options.reporter === "unix":
options.reporter = "./reporters/unix.js";
break;
// Reporter that displays additional JSHint data
case options["show-non-errors"]:
options.reporter = "./reporters/non_error.js";
break;
// Custom reporter
case options.reporter !== undefined:
options.reporter = path.resolve(process.cwd(), options.reporter);
}
var reporter;
if (options.reporter) {
reporter = loadReporter(options.reporter);
if (reporter === null) {
cli.error("Can't load reporter file: " + options.reporter);
exports.exit(1);
}
}
// This is a hack. exports.run is both sync and async function
// because I needed stdin support (and cli.withStdin is async)
// and was too lazy to change tests.
function done(passed) {
/*jshint eqnull:true */
if (passed == null)
return;
exports.exit(passed ? 0 : 2);
}
done(exports.run({
args: cli.args,
config: config,
reporter: reporter,
ignores: loadIgnores({ exclude: options.exclude, excludePath: options["exclude-path"] }),
extensions: options["extra-ext"],
verbose: options.verbose,
extract: options.extract,
filename: options.filename,
useStdin: { "-": true, "/dev/stdin": true }[args[args.length - 1]]
}, done));
}
};
module.exports = exports;

5641
node_modules/jshint/src/jshint.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1843
node_modules/jshint/src/lex.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

236
node_modules/jshint/src/messages.js generated vendored Normal file
View File

@@ -0,0 +1,236 @@
"use strict";
var _ = require("lodash");
var errors = {
// JSHint options
E001: "Bad option: '{a}'.",
E002: "Bad option value.",
// JSHint input
E003: "Expected a JSON value.",
E004: "Input is neither a string nor an array of strings.",
E005: "Input is empty.",
E006: "Unexpected early end of program.",
// Strict mode
E007: "Missing \"use strict\" statement.",
E008: "Strict violation.",
E009: "Option 'validthis' can't be used in a global scope.",
E010: "'with' is not allowed in strict mode.",
// Constants
E011: "const '{a}' has already been declared.",
E012: "const '{a}' is initialized to 'undefined'.",
E013: "Attempting to override '{a}' which is a constant.",
// Regular expressions
E014: "A regular expression literal can be confused with '/='.",
E015: "Unclosed regular expression.",
E016: "Invalid regular expression.",
// Tokens
E017: "Unclosed comment.",
E018: "Unbegun comment.",
E019: "Unmatched '{a}'.",
E020: "Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
E021: "Expected '{a}' and instead saw '{b}'.",
E022: "Line breaking error '{a}'.",
E023: "Missing '{a}'.",
E024: "Unexpected '{a}'.",
E025: "Missing ':' on a case clause.",
E026: "Missing '}' to match '{' from line {a}.",
E027: "Missing ']' to match '[' from line {a}.",
E028: "Illegal comma.",
E029: "Unclosed string.",
// Everything else
E030: "Expected an identifier and instead saw '{a}'.",
E031: "Bad assignment.", // FIXME: Rephrase
E032: "Expected a small integer or 'false' and instead saw '{a}'.",
E033: "Expected an operator and instead saw '{a}'.",
E034: "get/set are ES5 features.",
E035: "Missing property name.",
E036: "Expected to see a statement and instead saw a block.",
E037: null,
E038: null,
E039: "Function declarations are not invocable. Wrap the whole function invocation in parens.",
E040: "Each value should have its own case label.",
E041: "Unrecoverable syntax error.",
E042: "Stopping.",
E043: "Too many errors.",
E044: null,
E045: "Invalid for each loop.",
E046: "A yield statement shall be within a generator function (with syntax: `function*`)",
E047: null, // Vacant
E048: "{a} declaration not directly within block.",
E049: "A {a} cannot be named '{b}'.",
E050: "Mozilla requires the yield expression to be parenthesized here.",
E051: "Regular parameters cannot come after default parameters.",
E052: "Unclosed template literal.",
E053: "Export declaration must be in global scope.",
E054: "Class properties must be methods. Expected '(' but instead saw '{a}'.",
E055: "The '{a}' option cannot be set after any executable code."
};
var warnings = {
W001: "'hasOwnProperty' is a really bad name.",
W002: "Value of '{a}' may be overwritten in IE 8 and earlier.",
W003: "'{a}' was used before it was defined.",
W004: "'{a}' is already defined.",
W005: "A dot following a number can be confused with a decimal point.",
W006: "Confusing minuses.",
W007: "Confusing plusses.",
W008: "A leading decimal point can be confused with a dot: '{a}'.",
W009: "The array literal notation [] is preferable.",
W010: "The object literal notation {} is preferable.",
W011: null,
W012: null,
W013: null,
W014: "Bad line breaking before '{a}'.",
W015: null,
W016: "Unexpected use of '{a}'.",
W017: "Bad operand.",
W018: "Confusing use of '{a}'.",
W019: "Use the isNaN function to compare with NaN.",
W020: "Read only.",
W021: "'{a}' is a function.",
W022: "Do not assign to the exception parameter.",
W023: "Expected an identifier in an assignment and instead saw a function invocation.",
W024: "Expected an identifier and instead saw '{a}' (a reserved word).",
W025: "Missing name in function declaration.",
W026: "Inner functions should be listed at the top of the outer function.",
W027: "Unreachable '{a}' after '{b}'.",
W028: "Label '{a}' on {b} statement.",
W030: "Expected an assignment or function call and instead saw an expression.",
W031: "Do not use 'new' for side effects.",
W032: "Unnecessary semicolon.",
W033: "Missing semicolon.",
W034: "Unnecessary directive \"{a}\".",
W035: "Empty block.",
W036: "Unexpected /*member '{a}'.",
W037: "'{a}' is a statement label.",
W038: "'{a}' used out of scope.",
W039: "'{a}' is not allowed.",
W040: "Possible strict violation.",
W041: "Use '{a}' to compare with '{b}'.",
W042: "Avoid EOL escaping.",
W043: "Bad escaping of EOL. Use option multistr if needed.",
W044: "Bad or unnecessary escaping.", /* TODO(caitp): remove W044 */
W045: "Bad number '{a}'.",
W046: "Don't use extra leading zeros '{a}'.",
W047: "A trailing decimal point can be confused with a dot: '{a}'.",
W048: "Unexpected control character in regular expression.",
W049: "Unexpected escaped character '{a}' in regular expression.",
W050: "JavaScript URL.",
W051: "Variables should not be deleted.",
W052: "Unexpected '{a}'.",
W053: "Do not use {a} as a constructor.",
W054: "The Function constructor is a form of eval.",
W055: "A constructor name should start with an uppercase letter.",
W056: "Bad constructor.",
W057: "Weird construction. Is 'new' necessary?",
W058: "Missing '()' invoking a constructor.",
W059: "Avoid arguments.{a}.",
W060: "document.write can be a form of eval.",
W061: "eval can be harmful.",
W062: "Wrap an immediate function invocation in parens " +
"to assist the reader in understanding that the expression " +
"is the result of a function, and not the function itself.",
W063: "Math is not a function.",
W064: "Missing 'new' prefix when invoking a constructor.",
W065: "Missing radix parameter.",
W066: "Implied eval. Consider passing a function instead of a string.",
W067: "Bad invocation.",
W068: "Wrapping non-IIFE function literals in parens is unnecessary.",
W069: "['{a}'] is better written in dot notation.",
W070: "Extra comma. (it breaks older versions of IE)",
W071: "This function has too many statements. ({a})",
W072: "This function has too many parameters. ({a})",
W073: "Blocks are nested too deeply. ({a})",
W074: "This function's cyclomatic complexity is too high. ({a})",
W075: "Duplicate {a} '{b}'.",
W076: "Unexpected parameter '{a}' in get {b} function.",
W077: "Expected a single parameter in set {a} function.",
W078: "Setter is defined without getter.",
W079: "Redefinition of '{a}'.",
W080: "It's not necessary to initialize '{a}' to 'undefined'.",
W081: null,
W082: "Function declarations should not be placed in blocks. " +
"Use a function expression or move the statement to the top of " +
"the outer function.",
W083: "Don't make functions within a loop.",
W084: "Expected a conditional expression and instead saw an assignment.",
W085: "Don't use 'with'.",
W086: "Expected a 'break' statement before '{a}'.",
W087: "Forgotten 'debugger' statement?",
W088: "Creating global 'for' variable. Should be 'for (var {a} ...'.",
W089: "The body of a for in should be wrapped in an if statement to filter " +
"unwanted properties from the prototype.",
W090: "'{a}' is not a statement label.",
W091: "'{a}' is out of scope.",
W093: "Did you mean to return a conditional instead of an assignment?",
W094: "Unexpected comma.",
W095: "Expected a string and instead saw {a}.",
W096: "The '{a}' key may produce unexpected results.",
W097: "Use the function form of \"use strict\".",
W098: "'{a}' is defined but never used.",
W099: null,
W100: "This character may get silently deleted by one or more browsers.",
W101: "Line is too long.",
W102: null,
W103: "The '{a}' property is deprecated.",
W104: "'{a}' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).",
W105: "Unexpected {a} in '{b}'.",
W106: "Identifier '{a}' is not in camel case.",
W107: "Script URL.",
W108: "Strings must use doublequote.",
W109: "Strings must use singlequote.",
W110: "Mixed double and single quotes.",
W112: "Unclosed string.",
W113: "Control character in string: {a}.",
W114: "Avoid {a}.",
W115: "Octal literals are not allowed in strict mode.",
W116: "Expected '{a}' and instead saw '{b}'.",
W117: "'{a}' is not defined.",
W118: "'{a}' is only available in Mozilla JavaScript extensions (use moz option).",
W119: "'{a}' is only available in ES6 (use esnext option).",
W120: "You might be leaking a variable ({a}) here.",
W121: "Extending prototype of native object: '{a}'.",
W122: "Invalid typeof value '{a}'",
W123: "'{a}' is already defined in outer scope.",
W124: "A generator function shall contain a yield statement.",
W125: "This line contains non-breaking spaces: http://jshint.com/doc/options/#nonbsp",
W126: "Unnecessary grouping operator.",
W127: "Unexpected use of a comma operator.",
W128: "Empty array elements require elision=true.",
W129: "'{a}' is defined in a future version of JavaScript. Use a " +
"different variable name to avoid migration issues.",
W130: "Invalid element after rest element.",
W131: "Invalid parameter after rest parameter.",
W132: "`var` declarations are forbidden. Use `let` or `const` instead.",
W133: "Invalid for-{a} loop left-hand-side: {b}.",
W134: "The '{a}' option is only available when linting ECMAScript {b} code."
};
var info = {
I001: "Comma warnings can be turned off with 'laxcomma'.",
I002: null,
I003: "ES5 option is now set per default"
};
exports.errors = {};
exports.warnings = {};
exports.info = {};
_.each(errors, function(desc, code) {
exports.errors[code] = { code: code, desc: desc };
});
_.each(warnings, function(desc, code) {
exports.warnings[code] = { code: code, desc: desc };
});
_.each(info, function(desc, code) {
exports.info[code] = { code: code, desc: desc };
});

74
node_modules/jshint/src/name-stack.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
"use strict";
function NameStack() {
this._stack = [];
}
Object.defineProperty(NameStack.prototype, "length", {
get: function() {
return this._stack.length;
}
});
/**
* Create a new entry in the stack. Useful for tracking names across
* expressions.
*/
NameStack.prototype.push = function() {
this._stack.push(null);
};
/**
* Discard the most recently-created name on the stack.
*/
NameStack.prototype.pop = function() {
this._stack.pop();
};
/**
* Update the most recent name on the top of the stack.
*
* @param {object} token The token to consider as the source for the most
* recent name.
*/
NameStack.prototype.set = function(token) {
this._stack[this.length - 1] = token;
};
/**
* Generate a string representation of the most recent name.
*
* @returns {string}
*/
NameStack.prototype.infer = function() {
var nameToken = this._stack[this.length - 1];
var prefix = "";
var type;
// During expected operation, the topmost entry on the stack will only
// reflect the current function's name when the function is declared without
// the `function` keyword (i.e. for in-line accessor methods). In other
// cases, the `function` expression itself will introduce an empty entry on
// the top of the stack, and this should be ignored.
if (!nameToken || nameToken.type === "class") {
nameToken = this._stack[this.length - 2];
}
if (!nameToken) {
return "(empty)";
}
type = nameToken.type;
if (type !== "(string)" && type !== "(number)" && type !== "(identifier)" && type !== "default") {
return "(expression)";
}
if (nameToken.accessorType) {
prefix = nameToken.accessorType + " ";
}
return prefix + nameToken.value;
};
module.exports = NameStack;

972
node_modules/jshint/src/options.js generated vendored Normal file
View File

@@ -0,0 +1,972 @@
"use strict";
// These are the JSHint boolean options.
exports.bool = {
enforcing: {
/**
* This option prohibits the use of bitwise operators such as `^` (XOR),
* `|` (OR) and others. Bitwise operators are very rare in JavaScript
* programs and quite often `&` is simply a mistyped `&&`.
*/
bitwise : true,
/**
*
* This options prohibits overwriting prototypes of native objects such as
* `Array`, `Date` and so on.
*
* // jshint freeze:true
* Array.prototype.count = function (value) { return 4; };
* // -> Warning: Extending prototype of native object: 'Array'.
*/
freeze : true,
/**
* This option allows you to force all variable names to use either
* camelCase style or UPPER_CASE with underscores.
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
camelcase : true,
/**
* This option requires you to always put curly braces around blocks in
* loops and conditionals. JavaScript allows you to omit curly braces when
* the block consists of only one statement, for example:
*
* while (day)
* shuffle();
*
* However, in some circumstances, it can lead to bugs (you'd think that
* `sleep()` is a part of the loop while in reality it is not):
*
* while (day)
* shuffle();
* sleep();
*/
curly : true,
/**
* This options prohibits the use of `==` and `!=` in favor of `===` and
* `!==`. The former try to coerce values before comparing them which can
* lead to some unexpected results. The latter don't do any coercion so
* they are generally safer. If you would like to learn more about type
* coercion in JavaScript, we recommend [Truth, Equality and
* JavaScript](http://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/)
* by Angus Croll.
*/
eqeqeq : true,
/**
* This option enables warnings about the use of identifiers which are
* defined in future versions of JavaScript. Although overwriting them has
* no effect in contexts where they are not implemented, this practice can
* cause issues when migrating codebases to newer versions of the language.
*/
futurehostile: true,
/**
* This option suppresses warnings about invalid `typeof` operator values.
* This operator has only [a limited set of possible return
* values](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof).
* By default, JSHint warns when you compare its result with an invalid
* value which often can be a typo.
*
* // 'fuction' instead of 'function'
* if (typeof a == "fuction") { // Invalid typeof value 'fuction'
* // ...
* }
*
* Do not use this option unless you're absolutely sure you don't want
* these checks.
*/
notypeof : true,
/**
* This option tells JSHint that your code needs to adhere to ECMAScript 3
* specification. Use this option if you need your program to be executable
* in older browsers—such as Internet Explorer 6/7/8/9—and other legacy
* JavaScript environments.
*/
es3 : true,
/**
* This option enables syntax first defined in [the ECMAScript 5.1
* specification](http://es5.github.io/). This includes allowing reserved
* keywords as object properties.
*/
es5 : true,
/**
* This option requires all `for in` loops to filter object's items. The
* for in statement allows for looping through the names of all of the
* properties of an object including those inherited through the prototype
* chain. This behavior can lead to unexpected items in your object so it
* is generally safer to always filter inherited properties out as shown in
* the example:
*
* for (key in obj) {
* if (obj.hasOwnProperty(key)) {
* // We are sure that obj[key] belongs to the object and was not inherited.
* }
* }
*
* For more in-depth understanding of `for in` loops in JavaScript, read
* [Exploring JavaScript for-in
* loops](http://javascriptweblog.wordpress.com/2011/01/04/exploring-javascript-for-in-loops/)
* by Angus Croll.
*/
forin : true,
/**
* This option suppresses warnings about declaring variables inside of
* control
* structures while accessing them later from the outside. Even though
* JavaScript has only two real scopes—global and function—such practice
* leads to confusion among people new to the language and hard-to-debug
* bugs. This is why, by default, JSHint warns about variables that are
* used outside of their intended scope.
*
* function test() {
* if (true) {
* var x = 0;
* }
*
* x += 1; // Default: 'x' used out of scope.
* // No warning when funcscope:true
* }
*/
funcscope : true,
/**
* This option prohibits the use of immediate function invocations without
* wrapping them in parentheses. Wrapping parentheses assists readers of
* your code in understanding that the expression is the result of a
* function, and not the function itself.
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
immed : true,
/**
* This option suppresses warnings about the `__iterator__` property. This
* property is not supported by all browsers so use it carefully.
*/
iterator : true,
/**
* This option requires you to capitalize names of constructor functions.
* Capitalizing functions that are intended to be used with `new` operator
* is just a convention that helps programmers to visually distinguish
* constructor functions from other types of functions to help spot
* mistakes when using `this`.
*
* Not doing so won't break your code in any browsers or environments but
* it will be a bit harder to figure out—by reading the code—if the
* function was supposed to be used with or without new. And this is
* important because when the function that was intended to be used with
* `new` is used without it, `this` will point to the global object instead
* of a new object.
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
newcap : true,
/**
* This option prohibits the use of `arguments.caller` and
* `arguments.callee`. Both `.caller` and `.callee` make quite a few
* optimizations impossible so they were deprecated in future versions of
* JavaScript. In fact, ECMAScript 5 forbids the use of `arguments.callee`
* in strict mode.
*/
noarg : true,
/**
* This option prohibits the use of the comma operator. When misused, the
* comma operator can obscure the value of a statement and promote
* incorrect code.
*/
nocomma : true,
/**
* This option warns when you have an empty block in your code. JSLint was
* originally warning for all empty blocks and we simply made it optional.
* There were no studies reporting that empty blocks in JavaScript break
* your code in any way.
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
noempty : true,
/**
* This option warns about "non-breaking whitespace" characters. These
* characters can be entered with option-space on Mac computers and have a
* potential of breaking non-UTF8 web pages.
*/
nonbsp : true,
/**
* This option prohibits the use of constructor functions for side-effects.
* Some people like to call constructor functions without assigning its
* result to any variable:
*
* new MyConstructor();
*
* There is no advantage in this approach over simply calling
* `MyConstructor` since the object that the operator `new` creates isn't
* used anywhere so you should generally avoid constructors like this one.
*/
nonew : true,
/**
* This option prohibits the use of explicitly undeclared variables. This
* option is very useful for spotting leaking and mistyped variables.
*
* // jshint undef:true
*
* function test() {
* var myVar = 'Hello, World';
* console.log(myvar); // Oops, typoed here. JSHint with undef will complain
* }
*
* If your variable is defined in another file, you can use the `global`
* directive to tell JSHint about it.
*/
undef : true,
/**
* This option prohibits the use of the grouping operator when it is not
* strictly required. Such usage commonly reflects a misunderstanding of
* unary operators, for example:
*
* // jshint singleGroups: true
*
* delete(obj.attr); // Warning: Unnecessary grouping operator.
*/
singleGroups: false,
/**
* This option requires all functions to run in ECMAScript 5's strict mode.
* [Strict mode](https://developer.mozilla.org/en/JavaScript/Strict_mode)
* is a way to opt in to a restricted variant of JavaScript. Strict mode
* eliminates some JavaScript pitfalls that didn't cause errors by changing
* them to produce errors. It also fixes mistakes that made it difficult
* for the JavaScript engines to perform certain optimizations.
*
* *Note:* This option enables strict mode for function scope only. It
* *prohibits* the global scoped strict mode because it might break
* third-party widgets on your page. If you really want to use global
* strict mode, see the *globalstrict* option.
*/
strict : true,
/**
* When set to true, the use of VariableStatements are forbidden.
* For example:
*
* // jshint varstmt: true
*
* var a; // Warning: `var` declarations are forbidden. Use `let` or `const` instead.
*/
varstmt: false,
/**
* This option is a short hand for the most strict JSHint configuration as
* available in JSHint version 2.6.3. It enables all enforcing options and
* disables all relaxing options that were defined in that release.
*
* @deprecated The option cannot be maintained without automatically opting
* users in to new features. This can lead to unexpected
* warnings/errors in when upgrading between minor versions of
* JSHint.
*/
enforceall : false
},
relaxing: {
/**
* This option suppresses warnings about missing semicolons. There is a lot
* of FUD about semicolon spread by quite a few people in the community.
* The common myths are that semicolons are required all the time (they are
* not) and that they are unreliable. JavaScript has rules about semicolons
* which are followed by *all* browsers so it is up to you to decide
* whether you should or should not use semicolons in your code.
*
* For more information about semicolons in JavaScript read [An Open Letter
* to JavaScript Leaders Regarding
* Semicolons](http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding)
* by Isaac Schlueter and [JavaScript Semicolon
* Insertion](http://inimino.org/~inimino/blog/javascript_semicolons).
*/
asi : true,
/**
* This option suppresses warnings about multi-line strings. Multi-line
* strings can be dangerous in JavaScript because all hell breaks loose if
* you accidentally put a whitespace in between the escape character (`\`)
* and a new line.
*
* Note that even though this option allows correct multi-line strings, it
* still warns about multi-line strings without escape characters or with
* anything in between the escape character and a whitespace.
*
* // jshint multistr:true
*
* var text = "Hello\
* World"; // All good.
*
* text = "Hello
* World"; // Warning, no escape character.
*
* text = "Hello\
* World"; // Warning, there is a space after \
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
multistr : true,
/**
* This option suppresses warnings about the `debugger` statements in your
* code.
*/
debug : true,
/**
* This option suppresses warnings about the use of assignments in cases
* where comparisons are expected. More often than not, code like `if (a =
* 10) {}` is a typo. However, it can be useful in cases like this one:
*
* for (var i = 0, person; person = people[i]; i++) {}
*
* You can silence this error on a per-use basis by surrounding the assignment
* with parenthesis, such as:
*
* for (var i = 0, person; (person = people[i]); i++) {}
*/
boss : true,
/**
* This option suppresses warnings about the use of `eval`. The use of
* `eval` is discouraged because it can make your code vulnerable to
* various injection attacks and it makes it hard for JavaScript
* interpreter to do certain optimizations.
*/
evil : true,
/**
* This option suppresses warnings about the use of global strict mode.
* Global strict mode can break third-party widgets so it is not
* recommended.
*
* For more info about strict mode see the `strict` option.
*/
globalstrict: true,
/**
* This option prohibits the use of unary increment and decrement
* operators. Some people think that `++` and `--` reduces the quality of
* their coding styles and there are programming languages—such as
* Python—that go completely without these operators.
*/
plusplus : true,
/**
* This option suppresses warnings about the `__proto__` property.
*/
proto : true,
/**
* This option suppresses warnings about the use of script-targeted
* URLs—such as `javascript:...`.
*/
scripturl : true,
/**
* This option suppresses warnings about using `[]` notation when it can be
* expressed in dot notation: `person['name']` vs. `person.name`.
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
sub : true,
/**
* This option suppresses warnings about "weird" constructions like
* `new function () { ... }` and `new Object;`. Such constructions are
* sometimes used to produce singletons in JavaScript:
*
* var singleton = new function() {
* var privateVar;
*
* this.publicMethod = function () {}
* this.publicMethod2 = function () {}
* };
*/
supernew : true,
/**
* This option suppresses most of the warnings about possibly unsafe line
* breakings in your code. It doesn't suppress warnings about comma-first
* coding style. To suppress those you have to use `laxcomma` (see below).
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
laxbreak : true,
/**
* This option suppresses warnings about comma-first coding style:
*
* var obj = {
* name: 'Anton'
* , handle: 'valueof'
* , role: 'SW Engineer'
* };
*
* @deprecated JSHint is limiting its scope to issues of code correctness.
* If you would like to enforce rules relating to code style,
* check out [the JSCS
* project](https://github.com/jscs-dev/node-jscs).
*/
laxcomma : true,
/**
* This option suppresses warnings about possible strict violations when
* the code is running in strict mode and you use `this` in a
* non-constructor function. You should use this option—in a function scope
* only—when you are positive that your use of `this` is valid in the
* strict mode (for example, if you call your function using
* `Function.call`).
*
* **Note:** This option can be used only inside of a function scope.
* JSHint will fail with an error if you will try to set this option
* globally.
*/
validthis : true,
/**
* This option suppresses warnings about the use of the `with` statement.
* The semantics of the `with` statement can cause confusion among
* developers and accidental definition of global variables.
*
* More info:
*
* * [with Statement Considered
* Harmful](http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/)
*/
withstmt : true,
/**
* This options tells JSHint that your code uses Mozilla JavaScript
* extensions. Unless you develop specifically for the Firefox web browser
* you don't need this option.
*
* More info:
*
* * [New in JavaScript
* 1.7](https://developer.mozilla.org/en-US/docs/JavaScript/New_in_JavaScript/1.7)
*/
moz : true,
/**
* This option suppresses warnings about generator functions with no
* `yield` statement in them.
*/
noyield : true,
/**
* This option suppresses warnings about `== null` comparisons. Such
* comparisons are often useful when you want to check if a variable is
* `null` or `undefined`.
*/
eqnull : true,
/**
* This option suppresses warnings about missing semicolons, but only when
* the semicolon is omitted for the last statement in a one-line block:
*
* var name = (function() { return 'Anton' }());
*
* This is a very niche use case that is useful only when you use automatic
* JavaScript code generators.
*/
lastsemic : true,
/**
* This option suppresses warnings about functions inside of loops.
* Defining functions inside of loops can lead to bugs such as this one:
*
* var nums = [];
*
* for (var i = 0; i < 10; i++) {
* nums[i] = function (j) {
* return i + j;
* };
* }
*
* nums[0](2); // Prints 12 instead of 2
*
* To fix the code above you need to copy the value of `i`:
*
* var nums = [];
*
* for (var i = 0; i < 10; i++) {
* (function (i) {
* nums[i] = function (j) {
* return i + j;
* };
* }(i));
* }
*/
loopfunc : true,
/**
* This option suppresses warnings about the use of expressions where
* normally you would expect to see assignments or function calls. Most of
* the time, such code is a typo. However, it is not forbidden by the spec
* and that's why this warning is optional.
*/
expr : true,
/**
* This option tells JSHint that your code uses ECMAScript 6 specific
* syntax. Note that these features are not finalized yet and not all
* browsers implement them.
*
* More info:
*
* * [Draft Specification for ES.next (ECMA-262 Ed.
* 6)](http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts)
*/
esnext : true,
/**
* This option tells JSHint that your code uses ES3 array elision elements,
* or empty elements (for example, `[1, , , 4, , , 7]`).
*/
elision : true,
},
// Third party globals
environments: {
/**
* This option defines globals exposed by the
* [MooTools](http://mootools.net/) JavaScript framework.
*/
mootools : true,
/**
* This option defines globals exposed by
* [CouchDB](http://couchdb.apache.org/). CouchDB is a document-oriented
* database that can be queried and indexed in a MapReduce fashion using
* JavaScript.
*/
couch : true,
/**
* This option defines globals exposed by [the Jasmine unit testing
* framework](https://jasmine.github.io/).
*/
jasmine : true,
/**
* This option defines globals exposed by the [jQuery](http://jquery.com/)
* JavaScript library.
*/
jquery : true,
/**
* This option defines globals available when your code is running inside
* of the Node runtime environment. [Node.js](http://nodejs.org/) is a
* server-side JavaScript environment that uses an asynchronous
* event-driven model. This option also skips some warnings that make sense
* in the browser environments but don't make sense in Node such as
* file-level `use strict` pragmas and `console.log` statements.
*/
node : true,
/**
* This option defines globals exposed by [the QUnit unit testing
* framework](http://qunitjs.com/).
*/
qunit : true,
/**
* This option defines globals available when your code is running inside
* of the Rhino runtime environment. [Rhino](http://www.mozilla.org/rhino/)
* is an open-source implementation of JavaScript written entirely in Java.
*/
rhino : true,
/**
* This option defines globals exposed by [the ShellJS
* library](http://documentup.com/arturadib/shelljs).
*/
shelljs : true,
/**
* This option defines globals exposed by the
* [Prototype](http://www.prototypejs.org/) JavaScript framework.
*/
prototypejs : true,
/**
* This option defines globals exposed by the [YUI](http://yuilibrary.com/)
* JavaScript framework.
*/
yui : true,
/**
* This option defines globals exposed by the "BDD" and "TDD" UIs of the
* [Mocha unit testing framework](http://mochajs.org/).
*/
mocha : true,
/**
* This option informs JSHint that the input code describes an ECMAScript 6
* module. All module code is interpreted as strict mode code.
*/
module : true,
/**
* This option defines globals available when your code is running as a
* script for the [Windows Script
* Host](http://en.wikipedia.org/wiki/Windows_Script_Host).
*/
wsh : true,
/**
* This option defines globals available when your code is running inside
* of a Web Worker. [Web
* Workers](https://developer.mozilla.org/en/Using_web_workers) provide a
* simple means for web content to run scripts in background threads.
*/
worker : true,
/**
* This option defines non-standard but widely adopted globals such as
* `escape` and `unescape`.
*/
nonstandard : true,
/**
* This option defines globals exposed by modern browsers: all the way from
* good old `document` and `navigator` to the HTML5 `FileReader` and other
* new developments in the browser world.
*
* **Note:** This option doesn't expose variables like `alert` or
* `console`. See option `devel` for more information.
*/
browser : true,
/**
* This option defines globals available when using [the Browserify
* tool](http://browserify.org/) to build a project.
*/
browserify : true,
/**
* This option defines globals that are usually used for logging poor-man's
* debugging: `console`, `alert`, etc. It is usually a good idea to not
* ship them in production because, for example, `console.log` breaks in
* legacy versions of Internet Explorer.
*/
devel : true,
/**
* This option defines globals exposed by the [Dojo
* Toolkit](http://dojotoolkit.org/).
*/
dojo : true,
/**
* This option defines globals for typed array constructors.
*
* More info:
*
* * [JavaScript typed
* arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays)
*/
typed : true,
/**
* This option defines globals available when your core is running inside
* of the PhantomJS runtime environment. [PhantomJS](http://phantomjs.org/)
* is a headless WebKit scriptable with a JavaScript API. It has fast and
* native support for various web standards: DOM handling, CSS selector,
* JSON, Canvas, and SVG.
*/
phantom : true
},
// Obsolete options
obsolete: {
onecase : true, // if one case switch statements should be allowed
regexp : true, // if the . should not be allowed in regexp literals
regexdash : true // if unescaped first/last dash (-) inside brackets
// should be tolerated
}
};
// These are the JSHint options that can take any value
// (we use this object to detect invalid options)
exports.val = {
/**
* This option lets you set the maximum length of a line.
*
* @deprecated JSHint is limiting its scope to issues of code correctness. If
* you would like to enforce rules relating to code style, check
* out [the JSCS project](https://github.com/jscs-dev/node-jscs).
*/
maxlen : false,
/**
* This option sets a specific tab width for your code.
*
* @deprecated JSHint is limiting its scope to issues of code correctness. If
* you would like to enforce rules relating to code style, check
* out [the JSCS project](https://github.com/jscs-dev/node-jscs).
*/
indent : false,
/**
* This options allows you to set the maximum amount of warnings JSHint will
* produce before giving up. Default is 50.
*/
maxerr : false,
predef : false, // predef is deprecated and being replaced by globals
/**
* This option can be used to specify a white list of global variables that
* are not formally defined in the source code. This is most useful when
* combined with the `undef` option in order to suppress warnings for
* project-specific global variables.
*
* Setting an entry to `true` enables reading and writing to that variable.
* Setting it to `false` will trigger JSHint to consider that variable
* read-only.
*
* See also the "environment" options: a set of options to be used as short
* hand for enabling global variables defined in common JavaScript
* environments.
*/
globals : false,
/**
* This option enforces the consistency of quotation marks used throughout
* your code. It accepts three values: `true` if you don't want to enforce
* one particular style but want some consistency, `"single"` if you want to
* allow only single quotes and `"double"` if you want to allow only double
* quotes.
*
* @deprecated JSHint is limiting its scope to issues of code correctness. If
* you would like to enforce rules relating to code style, check
* out [the JSCS project](https://github.com/jscs-dev/node-jscs).
*/
quotmark : false,
scope : false,
/**
* This option lets you set the max number of statements allowed per function:
*
* // jshint maxstatements:4
*
* function main() {
* var i = 0;
* var j = 0;
*
* // Function declarations count as one statement. Their bodies
* // don't get taken into account for the outer function.
* function inner() {
* var i2 = 1;
* var j2 = 1;
*
* return i2 + j2;
* }
*
* j = i + j;
* return j; // JSHint: Too many statements per function. (5)
* }
*/
maxstatements: false,
/**
* This option lets you control how nested do you want your blocks to be:
*
* // jshint maxdepth:2
*
* function main(meaning) {
* var day = true;
*
* if (meaning === 42) {
* while (day) {
* shuffle();
*
* if (tired) { // JSHint: Blocks are nested too deeply (3).
* sleep();
* }
* }
* }
* }
*/
maxdepth : false,
/**
* This option lets you set the max number of formal parameters allowed per
* function:
*
* // jshint maxparams:3
*
* function login(request, onSuccess) {
* // ...
* }
*
* // JSHint: Too many parameters per function (4).
* function logout(request, isManual, whereAmI, onSuccess) {
* // ...
* }
*/
maxparams : false,
/**
* This option lets you control cyclomatic complexity throughout your code.
* Cyclomatic complexity measures the number of linearly independent paths
* through a program's source code. Read more about [cyclomatic complexity on
* Wikipedia](http://en.wikipedia.org/wiki/Cyclomatic_complexity).
*/
maxcomplexity: false,
/**
* This option suppresses warnings about variable shadowing i.e. declaring a
* variable that had been already declared somewhere in the outer scope.
*
* - "inner" - check for variables defined in the same scope only
* - "outer" - check for variables defined in outer scopes as well
* - false - same as inner
* - true - allow variable shadowing
*/
shadow : false,
/**
* This option warns when you define and never use your variables. It is very
* useful for general code cleanup, especially when used in addition to
* `undef`.
*
* // jshint unused:true
*
* function test(a, b) {
* var c, d = 2;
*
* return a + d;
* }
*
* test(1, 2);
*
* // Line 3: 'b' was defined but never used.
* // Line 4: 'c' was defined but never used.
*
* In addition to that, this option will warn you about unused global
* variables declared via the `global` directive.
*
* This can be set to `vars` to only check for variables, not function
* parameters, or `strict` to check all variables and parameters. The
* default (true) behavior is to allow unused parameters that are followed by
* a used parameter.
*/
unused : true,
/**
* This option prohibits the use of a variable before it was defined.
* JavaScript has function scope only and, in addition to that, all variables
* are always moved—or hoisted— to the top of the function. This behavior can
* lead to some very nasty bugs and that's why it is safer to always use
* variable only after they have been explicitly defined.
*
* Setting this option to "nofunc" will allow function declarations to be
* ignored.
*
* For more in-depth understanding of scoping and hoisting in JavaScript,
* read [JavaScript Scoping and
* Hoisting](http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting)
* by Ben Cherry.
*/
latedef : false,
ignore : false, // start/end ignoring lines of code, bypassing the lexer
// start - start ignoring lines, including the current line
// end - stop ignoring lines, starting on the next line
// line - ignore warnings / errors for just a single line
// (this option does not bypass the lexer)
ignoreDelimiters: false // array of start/end delimiters used to ignore
// certain chunks from code
};
// These are JSHint boolean options which are shared with JSLint
// where the definition in JSHint is opposite JSLint
exports.inverted = {
bitwise : true,
forin : true,
newcap : true,
plusplus: true,
regexp : true,
undef : true,
// Inverted and renamed, use JSHint name here
eqeqeq : true,
strict : true
};
exports.validNames = Object.keys(exports.val)
.concat(Object.keys(exports.bool.relaxing))
.concat(Object.keys(exports.bool.enforcing))
.concat(Object.keys(exports.bool.obsolete))
.concat(Object.keys(exports.bool.environments));
// These are JSHint boolean options which are shared with JSLint
// where the name has been changed but the effect is unchanged
exports.renamed = {
eqeq : "eqeqeq",
windows: "wsh",
sloppy : "strict"
};
exports.removed = {
nomen: true,
onevar: true,
passfail: true,
white: true,
gcl: true,
smarttabs: true,
trailing: true
};
// Add options here which should not be automatically enforced by
// `enforceall`.
exports.noenforceall = {
varstmt: true,
strict: true
};

115
node_modules/jshint/src/platforms/rhino.js generated vendored Normal file
View File

@@ -0,0 +1,115 @@
/*jshint boss: true, rhino: true, unused: true, undef: true, quotmark: double */
/*global JSHINT, readFully */
(function(args) {
"use strict";
var filenames = [];
var flags = {};
var opts = {};
var globals = {};
var retval = 0;
var readf = (typeof readFully === "function" ? readFully : readFile);
var optstr; // arg1=val1,arg2=val2,...
var predef; // global1=true,global2,global3,...
args.forEach(function(arg) {
if (arg.indexOf("--") === 0) {
// Configuration Flags might be boolean or will be split into name and value
if (arg.indexOf("=") > -1) {
var o = arg.split("=");
flags[o[0].slice(2)] = o[1];
} else {
flags[arg.slice(2)] = true;
}
return;
} else if (arg.indexOf("=") > -1) {
// usual rhino configuration, like "boss=true,browser=true"
if (!optstr) {
// First time it's the options.
optstr = arg;
} else {
predef = arg;
}
return;
}
if (optstr) {
predef = arg;
return;
}
filenames.push(arg);
});
if (filenames.length === 0) {
print("Usage: jshint.js file.js");
quit(1);
}
// If a config flag has been provided, try and load that
if ("config" in flags) {
var cfgFileContent;
try {
cfgFileContent = readf(flags.config);
} catch (e) {
print("Could not read config file " + flags.config);
quit(1);
}
opts = JSON.parse(cfgFileContent);
}
if (optstr) {
optstr.split(",").forEach(function(arg) {
var o = arg.split("=");
if (o[0] === "indent") {
opts[o[0]] = parseInt(o[1], 10);
} else {
opts[o[0]] = (function(ov) {
switch (ov) {
case "true":
return true;
case "false":
return false;
default:
return ov;
}
}(o[1]));
}
});
}
globals = opts.globals || {};
delete(opts.globals);
if (predef) {
predef.split(",").forEach(function(arg) {
var global = arg.split("=");
globals[global[0]] = global[1] === "true" ? true : false;
});
}
filenames.forEach(function(name) {
var input = readf(name);
if (!input) {
print("jshint: Couldn't open file " + name);
quit(1);
}
if (!JSHINT(input, opts, globals)) {
for (var i = 0, err; err = JSHINT.errors[i]; i += 1) {
print(err.reason + " (" + name + ":" + err.line + ":" + err.character + ")");
print("> " + (err.evidence || "").replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
print("");
}
retval = 2;
}
});
quit(retval);
}(arguments));

38
node_modules/jshint/src/reg.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
/*
* Regular expressions. Some of these are stupidly long.
*/
/*jshint maxlen:1000 */
"use strict";
// Unsafe comment or string (ax)
exports.unsafeString =
/@cc|<\/?|script|\]\s*\]|<\s*!|&lt/i;
// Unsafe characters that are silently deleted by one or more browsers (cx)
exports.unsafeChars =
/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
// Characters in strings that need escaping (nx and nxg)
exports.needEsc =
/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
exports.needEscGlobal =
/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
// Star slash (lx)
exports.starSlash = /\*\//;
// Identifier (ix)
exports.identifier = /^([a-zA-Z_$][a-zA-Z0-9_$]*)$/;
// JavaScript URL (jx)
exports.javascriptURL = /^(?:javascript|jscript|ecmascript|vbscript|livescript)\s*:/i;
// Catches /* falls through */ comments (ft)
exports.fallsThrough = /^\s*\/\*\s*falls?\sthrough\s*\*\/\s*$/;
// very conservative rule (eg: only one space between the start of the comment and the first character)
// to relax the maxlen option
exports.maxlenException = /^(?:(?:\/\/|\/\*|\*) ?)?[^ ]+$/;

94
node_modules/jshint/src/reporters/checkstyle.js generated vendored Normal file
View File

@@ -0,0 +1,94 @@
// Author: Boy Baukema
// http://github.com/relaxnow
module.exports =
{
reporter: function(results, data, opts) {
"use strict";
var files = {},
out = [],
pairs = {
"&": "&amp;",
'"': "&quot;",
"'": "&apos;",
"<": "&lt;",
">": "&gt;"
},
fileName, i, issue, errorMessage;
opts = opts || {};
function encode(s) {
for (var r in pairs) {
if (typeof(s) !== "undefined") {
s = s.replace(new RegExp(r, "g"), pairs[r]);
}
}
return s || "";
}
results.forEach(function(result) {
// Register the file
result.file = result.file.replace(/^\.\//, '');
if (!files[result.file]) {
files[result.file] = [];
}
// Create the error message
errorMessage = result.error.reason;
if (opts.verbose) {
errorMessage += ' (' + result.error.code + ')';
}
var typeNo = result.error.code;
var severity = '';
switch (typeNo[0]) {
case 'I':
severity = 'info';
break;
case 'W':
severity = 'warning';
break;
case 'E':
severity = 'error';
break;
}
// Add the error
files[result.file].push({
severity: severity,
line: result.error.line,
column: result.error.character,
message: errorMessage,
source: 'jshint.' + result.error.code
});
});
out.push("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.push("<checkstyle version=\"4.3\">");
for (fileName in files) {
if (files.hasOwnProperty(fileName)) {
out.push("\t<file name=\"" + fileName + "\">");
for (i = 0; i < files[fileName].length; i++) {
issue = files[fileName][i];
out.push(
"\t\t<error " +
"line=\"" + issue.line + "\" " +
"column=\"" + issue.column + "\" " +
"severity=\"" + issue.severity + "\" " +
"message=\"" + encode(issue.message) + "\" " +
"source=\"" + encode(issue.source) + "\" " +
"/>"
);
}
out.push("\t</file>");
}
}
out.push("</checkstyle>");
console.log(out.join("\n"));
}
};

34
node_modules/jshint/src/reporters/default.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
"use strict";
module.exports = {
reporter: function(results, data, opts) {
var len = results.length;
var str = '';
var prevfile;
opts = opts || {};
results.forEach(function(result) {
var file = result.file;
var error = result.error;
if (prevfile && prevfile !== file) {
str += "\n";
}
prevfile = file;
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason;
if (opts.verbose) {
str += ' (' + error.code + ')';
}
str += '\n';
});
if (str) {
console.log(str + "\n" + len + ' error' + ((len === 1) ? '' : 's'));
}
}
};

56
node_modules/jshint/src/reporters/jslint_xml.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
module.exports =
{
reporter: function(results) {
"use strict";
var files = {},
out = [],
pairs = {
"&": "&amp;",
'"': "&quot;",
"'": "&apos;",
"<": "&lt;",
">": "&gt;"
},
file, i, issue;
function encode(s) {
for (var r in pairs) {
if (typeof(s) !== "undefined") {
s = s.replace(new RegExp(r, "g"), pairs[r]);
}
}
return s || "";
}
results.forEach(function(result) {
result.file = result.file.replace(/^\.\//, '');
if (!files[result.file]) {
files[result.file] = [];
}
files[result.file].push(result.error);
});
out.push("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.push("<jslint>");
for (file in files) {
out.push("\t<file name=\"" + file + "\">");
for (i = 0; i < files[file].length; i++) {
issue = files[file][i];
out.push("\t\t<issue line=\"" + issue.line +
"\" char=\"" + issue.character +
"\" reason=\"" + encode(issue.reason) +
"\" evidence=\"" + encode(issue.evidence) +
(issue.code ? "\" severity=\"" + encode(issue.code.charAt(0)) : "") +
"\" />");
}
out.push("\t</file>");
}
out.push("</jslint>");
console.log(out.join("\n") + "\n");
}
};

52
node_modules/jshint/src/reporters/non_error.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
"use strict";
module.exports = {
reporter: function(results, data, opts) {
var len = results.length,
str = '',
file, error, globals, unuseds;
results.forEach(function(result) {
file = result.file;
error = result.error;
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason;
// Add the error code if the --verbose option is set
if (opts.verbose) {
str += ' (' + error.code + ')';
}
str += '\n';
});
str += len > 0 ? ("\n" + len + ' error' + ((len === 1) ? '' : 's')) : "";
data.forEach(function(data) {
file = data.file;
globals = data.implieds;
unuseds = data.unused;
if (globals || unuseds) {
str += '\n\n' + file + ' :\n';
}
if (globals) {
str += '\tImplied globals:\n';
globals.forEach(function(global) {
str += '\t\t' + global.name + ': ' + global.line + '\n';
});
}
if (unuseds) {
str += '\tUnused Variables:\n\t\t';
unuseds.forEach(function(unused) {
str += unused.name + '(' + unused.line + '), ';
});
}
});
if (str) {
console.log(str + "\n");
}
}
};

37
node_modules/jshint/src/reporters/unix.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
"use strict";
// Reporter that respects Unix output conventions
// frequently employed by preprocessors and compilers.
// The format is "FILENAME:LINE:COL: MESSAGE".
module.exports = {
reporter: function(results, data, opts) {
var len = results.length;
var str = "";
var prevfile;
opts = opts || {};
results.forEach(function(result) {
var file = result.file;
var error = result.error;
if (prevfile && prevfile !== file) {
str += "\n";
}
prevfile = file;
str += file + ":" + error.line + ":" + error.character + ": " + error.reason;
if (opts.verbose) {
str += " (" + error.code + ")";
}
str += "\n";
});
if (str) {
console.log(str + "\n" + len + " error" + ((len === 1) ? "" : "s"));
}
}
};

68
node_modules/jshint/src/state.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
"use strict";
var NameStack = require("./name-stack.js");
var state = {
syntax: {},
/**
* Determine if the code currently being linted is strict mode code.
*
* @returns {boolean}
*/
isStrict: function() {
return this.directive["use strict"] || this.inClassBody ||
this.option.module;
},
// Assumption: chronologically ES3 < ES5 < ES6/ESNext < Moz
inMoz: function() {
return this.option.moz && !this.option.esnext;
},
/**
* @param {object} options
* @param {boolean} options.strict - When `true`, only consider ESNext when
* in "esnext" code and *not* in "moz".
*/
inESNext: function(strict) {
if (strict) {
return !this.option.moz && this.option.esnext;
}
return this.option.moz || this.option.esnext;
},
inES5: function() {
return !this.option.es3;
},
inES3: function() {
return this.option.es3;
},
reset: function() {
this.tokens = {
prev: null,
next: null,
curr: null
};
this.option = {};
this.ignored = {};
this.directive = {};
this.jsonMode = false;
this.jsonWarnings = [];
this.lines = [];
this.tab = "";
this.cache = {}; // Node.JS doesn't have Map. Sniff.
this.ignoredLines = {};
this.forinifcheckneeded = false;
this.nameStack = new NameStack();
this.inClassBody = false;
// Blank out non-multi-line-commented lines when ignoring linter errors
this.ignoreLinterErrors = false;
}
};
exports.state = state;

143
node_modules/jshint/src/style.js generated vendored Normal file
View File

@@ -0,0 +1,143 @@
"use strict";
exports.register = function(linter) {
// Check for properties named __proto__. This special property was
// deprecated and then re-introduced for ES6.
linter.on("Identifier", function style_scanProto(data) {
if (linter.getOption("proto")) {
return;
}
if (data.name === "__proto__") {
linter.warn("W103", {
line: data.line,
char: data.char,
data: [ data.name ]
});
}
});
// Check for properties named __iterator__. This is a special property
// available only in browsers with JavaScript 1.7 implementation.
linter.on("Identifier", function style_scanIterator(data) {
if (linter.getOption("iterator")) {
return;
}
if (data.name === "__iterator__") {
linter.warn("W104", {
line: data.line,
char: data.char,
data: [ data.name ]
});
}
});
// Check that all identifiers are using camelCase notation.
// Exceptions: names like MY_VAR and _myVar.
linter.on("Identifier", function style_scanCamelCase(data) {
if (!linter.getOption("camelcase")) {
return;
}
if (data.name.replace(/^_+|_+$/g, "").indexOf("_") > -1 && !data.name.match(/^[A-Z0-9_]*$/)) {
linter.warn("W106", {
line: data.line,
char: data.from,
data: [ data.name ]
});
}
});
// Enforce consistency in style of quoting.
linter.on("String", function style_scanQuotes(data) {
var quotmark = linter.getOption("quotmark");
var code;
if (!quotmark) {
return;
}
// If quotmark is set to 'single' warn about all double-quotes.
if (quotmark === "single" && data.quote !== "'") {
code = "W109";
}
// If quotmark is set to 'double' warn about all single-quotes.
if (quotmark === "double" && data.quote !== "\"") {
code = "W108";
}
// If quotmark is set to true, remember the first quotation style
// and then warn about all others.
if (quotmark === true) {
if (!linter.getCache("quotmark")) {
linter.setCache("quotmark", data.quote);
}
if (linter.getCache("quotmark") !== data.quote) {
code = "W110";
}
}
if (code) {
linter.warn(code, {
line: data.line,
char: data.char,
});
}
});
linter.on("Number", function style_scanNumbers(data) {
if (data.value.charAt(0) === ".") {
// Warn about a leading decimal point.
linter.warn("W008", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
if (data.value.substr(data.value.length - 1) === ".") {
// Warn about a trailing decimal point.
linter.warn("W047", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
if (/^00+/.test(data.value)) {
// Multiple leading zeroes.
linter.warn("W046", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
});
// Warn about script URLs.
linter.on("String", function style_scanJavaScriptURLs(data) {
var re = /^(?:javascript|jscript|ecmascript|vbscript|livescript)\s*:/i;
if (linter.getOption("scripturl")) {
return;
}
if (re.test(data.value)) {
linter.warn("W107", {
line: data.line,
char: data.char
});
}
});
};

715
node_modules/jshint/src/vars.js generated vendored Normal file
View File

@@ -0,0 +1,715 @@
// jshint -W001
"use strict";
// Identifiers provided by the ECMAScript standard.
exports.reservedVars = {
arguments : false,
NaN : false
};
exports.ecmaIdentifiers = {
3: {
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,
Math : false,
Number : false,
Object : false,
parseInt : false,
parseFloat : false,
RangeError : false,
ReferenceError : false,
RegExp : false,
String : false,
SyntaxError : false,
TypeError : false,
URIError : false
},
5: {
JSON : false
},
6: {
Map : false,
Promise : false,
Proxy : false,
Reflect : false,
Set : false,
Symbol : false,
WeakMap : false,
WeakSet : false
}
};
// Global variables commonly provided by a web browser environment.
exports.browser = {
Audio : false,
Blob : false,
addEventListener : false,
applicationCache : false,
atob : false,
blur : false,
btoa : false,
cancelAnimationFrame : false,
CanvasGradient : false,
CanvasPattern : false,
CanvasRenderingContext2D: false,
CSS : false,
clearInterval : false,
clearTimeout : false,
close : false,
closed : false,
Comment : false,
CustomEvent : false,
DOMParser : false,
defaultStatus : false,
Document : false,
document : false,
DocumentFragment : false,
Element : false,
ElementTimeControl : false,
Event : false,
event : false,
fetch : false,
FileReader : false,
FormData : false,
focus : false,
frames : false,
getComputedStyle : false,
HTMLElement : false,
HTMLAnchorElement : false,
HTMLBaseElement : false,
HTMLBlockquoteElement: false,
HTMLBodyElement : false,
HTMLBRElement : false,
HTMLButtonElement : false,
HTMLCanvasElement : false,
HTMLDirectoryElement : false,
HTMLDivElement : false,
HTMLDListElement : false,
HTMLFieldSetElement : false,
HTMLFontElement : false,
HTMLFormElement : false,
HTMLFrameElement : false,
HTMLFrameSetElement : false,
HTMLHeadElement : false,
HTMLHeadingElement : false,
HTMLHRElement : false,
HTMLHtmlElement : false,
HTMLIFrameElement : false,
HTMLImageElement : false,
HTMLInputElement : false,
HTMLIsIndexElement : false,
HTMLLabelElement : false,
HTMLLayerElement : false,
HTMLLegendElement : false,
HTMLLIElement : false,
HTMLLinkElement : false,
HTMLMapElement : false,
HTMLMenuElement : false,
HTMLMetaElement : false,
HTMLModElement : false,
HTMLObjectElement : false,
HTMLOListElement : false,
HTMLOptGroupElement : false,
HTMLOptionElement : false,
HTMLParagraphElement : false,
HTMLParamElement : false,
HTMLPreElement : false,
HTMLQuoteElement : false,
HTMLScriptElement : false,
HTMLSelectElement : false,
HTMLStyleElement : false,
HTMLTableCaptionElement: false,
HTMLTableCellElement : false,
HTMLTableColElement : false,
HTMLTableElement : false,
HTMLTableRowElement : false,
HTMLTableSectionElement: false,
HTMLTemplateElement : false,
HTMLTextAreaElement : false,
HTMLTitleElement : false,
HTMLUListElement : false,
HTMLVideoElement : false,
history : false,
Image : false,
Intl : false,
length : false,
localStorage : false,
location : false,
matchMedia : false,
MessageChannel : false,
MessageEvent : false,
MessagePort : false,
MouseEvent : false,
moveBy : false,
moveTo : false,
MutationObserver : false,
name : false,
Node : false,
NodeFilter : false,
NodeList : false,
Notification : false,
navigator : false,
onbeforeunload : true,
onblur : true,
onerror : true,
onfocus : true,
onload : true,
onresize : true,
onunload : true,
open : false,
openDatabase : false,
opener : false,
Option : false,
parent : false,
print : false,
Range : false,
requestAnimationFrame : false,
removeEventListener : false,
resizeBy : false,
resizeTo : false,
screen : false,
scroll : false,
scrollBy : false,
scrollTo : false,
sessionStorage : false,
setInterval : false,
setTimeout : false,
SharedWorker : false,
status : false,
SVGAElement : false,
SVGAltGlyphDefElement: false,
SVGAltGlyphElement : false,
SVGAltGlyphItemElement: false,
SVGAngle : false,
SVGAnimateColorElement: false,
SVGAnimateElement : false,
SVGAnimateMotionElement: false,
SVGAnimateTransformElement: false,
SVGAnimatedAngle : false,
SVGAnimatedBoolean : false,
SVGAnimatedEnumeration: false,
SVGAnimatedInteger : false,
SVGAnimatedLength : false,
SVGAnimatedLengthList: false,
SVGAnimatedNumber : false,
SVGAnimatedNumberList: false,
SVGAnimatedPathData : false,
SVGAnimatedPoints : false,
SVGAnimatedPreserveAspectRatio: false,
SVGAnimatedRect : false,
SVGAnimatedString : false,
SVGAnimatedTransformList: false,
SVGAnimationElement : false,
SVGCSSRule : false,
SVGCircleElement : false,
SVGClipPathElement : false,
SVGColor : false,
SVGColorProfileElement: false,
SVGColorProfileRule : false,
SVGComponentTransferFunctionElement: false,
SVGCursorElement : false,
SVGDefsElement : false,
SVGDescElement : false,
SVGDocument : false,
SVGElement : false,
SVGElementInstance : false,
SVGElementInstanceList: false,
SVGEllipseElement : false,
SVGExternalResourcesRequired: false,
SVGFEBlendElement : false,
SVGFEColorMatrixElement: false,
SVGFEComponentTransferElement: false,
SVGFECompositeElement: false,
SVGFEConvolveMatrixElement: false,
SVGFEDiffuseLightingElement: false,
SVGFEDisplacementMapElement: false,
SVGFEDistantLightElement: false,
SVGFEFloodElement : false,
SVGFEFuncAElement : false,
SVGFEFuncBElement : false,
SVGFEFuncGElement : false,
SVGFEFuncRElement : false,
SVGFEGaussianBlurElement: false,
SVGFEImageElement : false,
SVGFEMergeElement : false,
SVGFEMergeNodeElement: false,
SVGFEMorphologyElement: false,
SVGFEOffsetElement : false,
SVGFEPointLightElement: false,
SVGFESpecularLightingElement: false,
SVGFESpotLightElement: false,
SVGFETileElement : false,
SVGFETurbulenceElement: false,
SVGFilterElement : false,
SVGFilterPrimitiveStandardAttributes: false,
SVGFitToViewBox : false,
SVGFontElement : false,
SVGFontFaceElement : false,
SVGFontFaceFormatElement: false,
SVGFontFaceNameElement: false,
SVGFontFaceSrcElement: false,
SVGFontFaceUriElement: false,
SVGForeignObjectElement: false,
SVGGElement : false,
SVGGlyphElement : false,
SVGGlyphRefElement : false,
SVGGradientElement : false,
SVGHKernElement : false,
SVGICCColor : false,
SVGImageElement : false,
SVGLangSpace : false,
SVGLength : false,
SVGLengthList : false,
SVGLineElement : false,
SVGLinearGradientElement: false,
SVGLocatable : false,
SVGMPathElement : false,
SVGMarkerElement : false,
SVGMaskElement : false,
SVGMatrix : false,
SVGMetadataElement : false,
SVGMissingGlyphElement: false,
SVGNumber : false,
SVGNumberList : false,
SVGPaint : false,
SVGPathElement : false,
SVGPathSeg : false,
SVGPathSegArcAbs : false,
SVGPathSegArcRel : false,
SVGPathSegClosePath : false,
SVGPathSegCurvetoCubicAbs: false,
SVGPathSegCurvetoCubicRel: false,
SVGPathSegCurvetoCubicSmoothAbs: false,
SVGPathSegCurvetoCubicSmoothRel: false,
SVGPathSegCurvetoQuadraticAbs: false,
SVGPathSegCurvetoQuadraticRel: false,
SVGPathSegCurvetoQuadraticSmoothAbs: false,
SVGPathSegCurvetoQuadraticSmoothRel: false,
SVGPathSegLinetoAbs : false,
SVGPathSegLinetoHorizontalAbs: false,
SVGPathSegLinetoHorizontalRel: false,
SVGPathSegLinetoRel : false,
SVGPathSegLinetoVerticalAbs: false,
SVGPathSegLinetoVerticalRel: false,
SVGPathSegList : false,
SVGPathSegMovetoAbs : false,
SVGPathSegMovetoRel : false,
SVGPatternElement : false,
SVGPoint : false,
SVGPointList : false,
SVGPolygonElement : false,
SVGPolylineElement : false,
SVGPreserveAspectRatio: false,
SVGRadialGradientElement: false,
SVGRect : false,
SVGRectElement : false,
SVGRenderingIntent : false,
SVGSVGElement : false,
SVGScriptElement : false,
SVGSetElement : false,
SVGStopElement : false,
SVGStringList : false,
SVGStylable : false,
SVGStyleElement : false,
SVGSwitchElement : false,
SVGSymbolElement : false,
SVGTRefElement : false,
SVGTSpanElement : false,
SVGTests : false,
SVGTextContentElement: false,
SVGTextElement : false,
SVGTextPathElement : false,
SVGTextPositioningElement: false,
SVGTitleElement : false,
SVGTransform : false,
SVGTransformList : false,
SVGTransformable : false,
SVGURIReference : false,
SVGUnitTypes : false,
SVGUseElement : false,
SVGVKernElement : false,
SVGViewElement : false,
SVGViewSpec : false,
SVGZoomAndPan : false,
Text : false,
TextDecoder : false,
TextEncoder : false,
TimeEvent : false,
top : false,
URL : false,
WebGLActiveInfo : false,
WebGLBuffer : false,
WebGLContextEvent : false,
WebGLFramebuffer : false,
WebGLProgram : false,
WebGLRenderbuffer : false,
WebGLRenderingContext: false,
WebGLShader : false,
WebGLShaderPrecisionFormat: false,
WebGLTexture : false,
WebGLUniformLocation : false,
WebSocket : false,
window : false,
Worker : false,
XDomainRequest : false,
XMLHttpRequest : false,
XMLSerializer : false,
XPathEvaluator : false,
XPathException : false,
XPathExpression : false,
XPathNamespace : false,
XPathNSResolver : false,
XPathResult : false
};
exports.devel = {
alert : false,
confirm: false,
console: false,
Debug : false,
opera : false,
prompt : false
};
exports.worker = {
importScripts : true,
postMessage : true,
self : true,
FileReaderSync : true
};
// Widely adopted global names that are not part of ECMAScript standard
exports.nonstandard = {
escape : false,
unescape: false
};
// Globals provided by popular JavaScript environments.
exports.couch = {
"require" : false,
respond : false,
getRow : false,
emit : false,
send : false,
start : false,
sum : false,
log : false,
exports : false,
module : false,
provides : false
};
exports.node = {
__filename : false,
__dirname : false,
GLOBAL : false,
global : false,
module : false,
require : false,
// These globals are writeable because Node allows the following
// usage pattern: var Buffer = require("buffer").Buffer;
Buffer : true,
console : true,
exports : true,
process : true,
setTimeout : true,
clearTimeout : true,
setInterval : true,
clearInterval : true,
setImmediate : true, // v0.9.1+
clearImmediate: true // v0.9.1+
};
exports.browserify = {
__filename : false,
__dirname : false,
global : false,
module : false,
require : false,
Buffer : true,
exports : true,
process : true
};
exports.phantom = {
phantom : true,
require : true,
WebPage : true,
console : true, // in examples, but undocumented
exports : true // v1.7+
};
exports.qunit = {
asyncTest : false,
deepEqual : false,
equal : false,
expect : false,
module : false,
notDeepEqual : false,
notEqual : false,
notPropEqual : false,
notStrictEqual : false,
ok : false,
propEqual : false,
QUnit : false,
raises : false,
start : false,
stop : false,
strictEqual : false,
test : false,
"throws" : false
};
exports.rhino = {
defineClass : false,
deserialize : false,
gc : false,
help : false,
importClass : false,
importPackage: false,
"java" : false,
load : false,
loadClass : false,
Packages : false,
print : false,
quit : false,
readFile : false,
readUrl : false,
runCommand : false,
seal : false,
serialize : false,
spawn : false,
sync : false,
toint32 : false,
version : false
};
exports.shelljs = {
target : false,
echo : false,
exit : false,
cd : false,
pwd : false,
ls : false,
find : false,
cp : false,
rm : false,
mv : false,
mkdir : false,
test : false,
cat : false,
sed : false,
grep : false,
which : false,
dirs : false,
pushd : false,
popd : false,
env : false,
exec : false,
chmod : false,
config : false,
error : false,
tempdir : false
};
exports.typed = {
ArrayBuffer : false,
ArrayBufferView : false,
DataView : false,
Float32Array : false,
Float64Array : false,
Int16Array : false,
Int32Array : false,
Int8Array : false,
Uint16Array : false,
Uint32Array : false,
Uint8Array : false,
Uint8ClampedArray : false
};
exports.wsh = {
ActiveXObject : true,
Enumerator : true,
GetObject : true,
ScriptEngine : true,
ScriptEngineBuildVersion : true,
ScriptEngineMajorVersion : true,
ScriptEngineMinorVersion : true,
VBArray : true,
WSH : true,
WScript : true,
XDomainRequest : true
};
// Globals provided by popular JavaScript libraries.
exports.dojo = {
dojo : false,
dijit : false,
dojox : false,
define : false,
"require": false
};
exports.jquery = {
"$" : false,
jQuery : false
};
exports.mootools = {
"$" : false,
"$$" : false,
Asset : false,
Browser : false,
Chain : false,
Class : false,
Color : false,
Cookie : false,
Core : false,
Document : false,
DomReady : false,
DOMEvent : false,
DOMReady : false,
Drag : false,
Element : false,
Elements : false,
Event : false,
Events : false,
Fx : false,
Group : false,
Hash : false,
HtmlTable : false,
IFrame : false,
IframeShim : false,
InputValidator: false,
instanceOf : false,
Keyboard : false,
Locale : false,
Mask : false,
MooTools : false,
Native : false,
Options : false,
OverText : false,
Request : false,
Scroller : false,
Slick : false,
Slider : false,
Sortables : false,
Spinner : false,
Swiff : false,
Tips : false,
Type : false,
typeOf : false,
URI : false,
Window : false
};
exports.prototypejs = {
"$" : false,
"$$" : false,
"$A" : false,
"$F" : false,
"$H" : false,
"$R" : false,
"$break" : false,
"$continue" : false,
"$w" : false,
Abstract : false,
Ajax : false,
Class : false,
Enumerable : false,
Element : false,
Event : false,
Field : false,
Form : false,
Hash : false,
Insertion : false,
ObjectRange : false,
PeriodicalExecuter: false,
Position : false,
Prototype : false,
Selector : false,
Template : false,
Toggle : false,
Try : false,
Autocompleter : false,
Builder : false,
Control : false,
Draggable : false,
Draggables : false,
Droppables : false,
Effect : false,
Sortable : false,
SortableObserver : false,
Sound : false,
Scriptaculous : false
};
exports.yui = {
YUI : false,
Y : false,
YUI_config: false
};
exports.mocha = {
// BDD
describe : false,
xdescribe : false,
it : false,
xit : false,
context : false,
xcontext : false,
before : false,
after : false,
beforeEach : false,
afterEach : false,
// TDD
suite : false,
test : false,
setup : false,
teardown : false,
suiteSetup : false,
suiteTeardown : false
};
exports.jasmine = {
jasmine : false,
describe : false,
xdescribe : false,
it : false,
xit : false,
beforeEach : false,
afterEach : false,
setFixtures : false,
loadFixtures: false,
spyOn : false,
expect : false,
// Jasmine 1.3
runs : false,
waitsFor : false,
waits : false,
// Jasmine 2.1
beforeAll : false,
afterAll : false,
fail : false,
fdescribe : false,
fit : false
};