disable JSHint's "asi" relaxing option

This commit is contained in:
Jeff Williams 2012-07-06 07:40:24 -07:00
parent 0940120238
commit c43c183aaa
24 changed files with 71 additions and 74 deletions

View File

@ -15,7 +15,7 @@
"strict": false, "strict": false,
"trailing": true, "trailing": true,
"asi": true, "asi": false,
"boss": true, "boss": true,
"debug": true, "debug": true,
"eqnull": true, "eqnull": true,

View File

@ -89,7 +89,7 @@ include.resolve = function(filepath) {
} }
return env.dirname + '/' + filepath; return env.dirname + '/' + filepath;
} };
/** Print string/s out to the console. /** Print string/s out to the console.
@param {string} ... String/s to print out to console. @param {string} ... String/s to print out to console.
@ -172,7 +172,7 @@ app = {
parser: new (require('jsdoc/src/parser').Parser)(), parser: new (require('jsdoc/src/parser').Parser)(),
name: require('jsdoc/name') name: require('jsdoc/name')
} }
} };
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

View File

@ -39,7 +39,7 @@ function getParser(parser, conf) {
return function(source) { return function(source) {
return parser.renderJsonML(parser.toHTMLTree(source, conf.dialect)); return parser.renderJsonML(parser.toHTMLTree(source, conf.dialect));
} };
} else { } else {
throw "unknown Markdown parser: '" + parser + "'"; throw "unknown Markdown parser: '" + parser + "'";
} }

View File

@ -18,7 +18,7 @@ var doop = require("jsdoc/util/doop").doop;
docs.push(doc); docs.push(doc);
}); });
}); });
} };
function mapDependencies(index) { function mapDependencies(index) {
var doclets, doc, len, dependencies = {}; var doclets, doc, len, dependencies = {};

View File

@ -48,4 +48,4 @@ exports.resolveBorrows = function(docs) {
delete doc.borrowed; delete doc.borrowed;
} }
}); });
} };

View File

@ -39,5 +39,4 @@ module.exports = Config;
*/ */
Config.prototype.get = function() { Config.prototype.get = function() {
return this._config; return this._config;
} };

View File

@ -144,7 +144,7 @@ exports.Doclet = function(docletSrc, meta) {
} }
this.postProcess(); this.postProcess();
} };
/** Called once after all tags have been added. */ /** Called once after all tags have been added. */
exports.Doclet.prototype.postProcess = function() { exports.Doclet.prototype.postProcess = function() {
@ -172,7 +172,7 @@ exports.Doclet.prototype.postProcess = function() {
} }
} }
} }
} };
/** Add a tag to this doclet. /** Add a tag to this doclet.
@param {string} title - The title of the tag being added. @param {string} title - The title of the tag being added.
@ -183,7 +183,7 @@ exports.Doclet.prototype.addTag = function(title, text) {
newTag = new jsdoc.tag.Tag(title, text, this.meta); newTag = new jsdoc.tag.Tag(title, text, this.meta);
if (tagDef && tagDef.onTagged) { if (tagDef && tagDef.onTagged) {
tagDef.onTagged(this, newTag) tagDef.onTagged(this, newTag);
} }
if (!tagDef) { if (!tagDef) {
@ -192,7 +192,7 @@ exports.Doclet.prototype.addTag = function(title, text) {
} }
applyTag.call(this, newTag); applyTag.call(this, newTag);
} };
/** Set the `memberof` property of this doclet. /** Set the `memberof` property of this doclet.
@param {string} sid - The longname of the symbol that this doclet is a member of. @param {string} sid - The longname of the symbol that this doclet is a member of.
@ -204,7 +204,7 @@ exports.Doclet.prototype.setMemberof = function(sid) {
@type string @type string
*/ */
this.memberof = sid.replace(/\.prototype/g, '#'); this.memberof = sid.replace(/\.prototype/g, '#');
} };
/** Set the `longname` property of this doclet. /** Set the `longname` property of this doclet.
@param {string} name @param {string} name
@ -220,7 +220,7 @@ exports.Doclet.prototype.setLongname = function(name) {
if (jsdoc.tag.dictionary.isNamespace(this.kind)) { if (jsdoc.tag.dictionary.isNamespace(this.kind)) {
this.longname = jsdoc.name.applyNamespace(this.longname, this.kind); this.longname = jsdoc.name.applyNamespace(this.longname, this.kind);
} }
} };
/** Add a symbol to this doclet's `borrowed` array. /** Add a symbol to this doclet's `borrowed` array.
@param {string} source - The longname of the symbol that is the source. @param {string} source - The longname of the symbol that is the source.
@ -238,7 +238,7 @@ exports.Doclet.prototype.borrow = function(source, target) {
this.borrowed = []; this.borrowed = [];
} }
this.borrowed.push(about); this.borrowed.push(about);
} };
exports.Doclet.prototype.mix = function(source) { exports.Doclet.prototype.mix = function(source) {
if (!this.mixes) { if (!this.mixes) {
@ -249,7 +249,7 @@ exports.Doclet.prototype.mix = function(source) {
this.mixes = []; this.mixes = [];
} }
this.mixes.push(source); this.mixes.push(source);
} };
/** Add a symbol to this doclet's `augments` array. /** Add a symbol to this doclet's `augments` array.
@param {string} base - The longname of the base symbol. @param {string} base - The longname of the base symbol.
@ -263,7 +263,7 @@ exports.Doclet.prototype.augment = function(base) {
this.augments = []; this.augments = [];
} }
this.augments.push(base); this.augments.push(base);
} };
/** /**
Set the `meta` property of this doclet. Set the `meta` property of this doclet.
@ -329,4 +329,4 @@ exports.Doclet.prototype.setMeta = function(meta) {
this.meta.code.paramnames = meta.code.paramnames.concat([]); this.meta.code.paramnames = meta.code.paramnames.concat([]);
} }
} }
} };

View File

@ -91,7 +91,7 @@ exports.resolve = function(doclet) {
if (about.variation) { if (about.variation) {
doclet.variation = about.variation; doclet.variation = about.variation;
} }
} };
/** /**
@inner @inner
@ -113,7 +113,7 @@ function quoteUnsafe(name, kind) { // docspaced names may have unsafe characters
RegExp.escape = RegExp.escape || function(str) { RegExp.escape = RegExp.escape || function(str) {
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
return str.replace(specials, "\\$&"); return str.replace(specials, "\\$&");
} };
/** /**
@method module:jsdoc/name.applyNamespace @method module:jsdoc/name.applyNamespace
@ -131,7 +131,7 @@ exports.applyNamespace = function(longname, ns) {
} }
return longname; return longname;
} };
/** /**
Given a longname like "a.b#c(2)", slice it up into ["a.b", "#", 'c', '2'], Given a longname like "a.b#c(2)", slice it up into ["a.b", "#", 'c', '2'],
@ -198,7 +198,7 @@ exports.shorten = function(longname, forcedMemberof) {
//// ////
return {longname: longname, memberof: memberof, scope: scope, name: name, variation: variation}; return {longname: longname, memberof: memberof, scope: scope, name: name, variation: variation};
} };
/** /**
Split a string that starts with a name and ends with a description, into its parts. Split a string that starts with a name and ends with a description, into its parts.
@ -241,4 +241,4 @@ exports.splitName = function(nameDesc) {
} }
return { name: name, description: desc }; return { name: name, description: desc };
} };

View File

@ -51,14 +51,14 @@ exports.parse = function(args) {
ourOptions = argParser.parse(args, defaults); ourOptions = argParser.parse(args, defaults);
return ourOptions; return ourOptions;
} };
/** /**
Display help message for options. Display help message for options.
*/ */
exports.help = function() { exports.help = function() {
return argParser.help(); return argParser.help();
} };
/** /**
Get a named option. Get a named option.
@ -75,4 +75,4 @@ exports.get = function(name) {
else { else {
return ourOptions[name]; return ourOptions[name];
} }
} };

View File

@ -66,5 +66,4 @@ exports.Package = function(json) {
* ] * ]
*/ */
this.licenses = json.licenses; this.licenses = json.licenses;
} };

View File

@ -33,7 +33,7 @@ function getParser(parser, conf) {
return function(source) { return function(source) {
return parser.renderJsonML(parser.toHTMLTree(source, conf.dialect)); return parser.renderJsonML(parser.toHTMLTree(source, conf.dialect));
} };
} }
else { else {
throw 'unknown Markdown parser: "' + parser + '"'; throw 'unknown Markdown parser: "' + parser + '"';

View File

@ -20,7 +20,7 @@ exports.Filter = function(opts) {
this.excludePattern = opts.excludePattern? this.excludePattern = opts.excludePattern?
typeof opts.excludePattern === 'string'? new RegExp(opts.excludePattern) : opts.excludePattern typeof opts.excludePattern === 'string'? new RegExp(opts.excludePattern) : opts.excludePattern
: null; : null;
} };
/** /**
@param {string} filepath - The filepath to check. @param {string} filepath - The filepath to check.
@ -40,4 +40,4 @@ exports.Filter.prototype.isIncluded = function(filepath) {
} }
return true; return true;
} };

View File

@ -83,14 +83,14 @@ exports.Parser.prototype.parse = function(sourceFiles, encoding) {
*/ */
exports.Parser.prototype.results = function() { exports.Parser.prototype.results = function() {
return this._resultBuffer; return this._resultBuffer;
} };
/** /**
* @param {Object} o The parse result to add to the result buffer. * @param {Object} o The parse result to add to the result buffer.
*/ */
exports.Parser.prototype.addResult = function(o) { exports.Parser.prototype.addResult = function(o) {
this._resultBuffer.push(o); this._resultBuffer.push(o);
} };
/** /**
* Empty any accumulated results of calls to parse. * Empty any accumulated results of calls to parse.
@ -99,21 +99,21 @@ exports.Parser.prototype.clear = function() {
currentParser = null; currentParser = null;
currentSourceName = ''; currentSourceName = '';
this._resultBuffer = []; this._resultBuffer = [];
} };
/** /**
* Adds a node visitor to use in parsing * Adds a node visitor to use in parsing
*/ */
exports.Parser.prototype.addNodeVisitor = function(visitor) { exports.Parser.prototype.addNodeVisitor = function(visitor) {
this._visitors.push(visitor); this._visitors.push(visitor);
} };
/** /**
* Get the node visitors used in parsing * Get the node visitors used in parsing
*/ */
exports.Parser.prototype.getVisitors = function() { exports.Parser.prototype.getVisitors = function() {
return this._visitors; return this._visitors;
} };
function pretreat(code) { function pretreat(code) {
return code return code
@ -168,7 +168,7 @@ function nodeToString(node) {
str = [nodeToString(node.target), node.property.string].join('.'); str = [nodeToString(node.target), node.property.string].join('.');
} }
else if (node.type === Token.VAR) { else if (node.type === Token.VAR) {
str = nodeToString(node.target) str = nodeToString(node.target);
} }
else if (node.type === Token.NAME) { else if (node.type === Token.NAME) {
str = node.string; str = node.string;
@ -281,7 +281,7 @@ function makeVarsFinisher(funcDoc) {
if (funcDoc && e.doclet && e.doclet.alias) { if (funcDoc && e.doclet && e.doclet.alias) {
funcDoc.meta.vars[e.code.name] = e.doclet.longname; funcDoc.meta.vars[e.code.name] = e.doclet.longname;
} }
} };
return func; return func;
} }
@ -425,7 +425,7 @@ function visitNode(node) {
e.finishers.push(makeVarsFinisher(funcDoc)); e.finishers.push(makeVarsFinisher(funcDoc));
} }
var basename = getBasename(e.code.name) var basename = getBasename(e.code.name);
e.code.funcscope = currentParser.resolveVar(node, basename); e.code.funcscope = currentParser.resolveVar(node, basename);
} }
@ -470,7 +470,7 @@ exports.Parser.prototype._parseSourceCode = function(sourceCode, sourceName) {
this.fire('fileComplete', e); this.fire('fileComplete', e);
currentSourceName = ''; currentSourceName = '';
} };
/** /**
* Given a node, determine what the node is a member of. * Given a node, determine what the node is a member of.
@ -523,7 +523,7 @@ exports.Parser.prototype.astnodeToMemberof = function(node) {
} }
return doclet.longname||doclet.name; return doclet.longname||doclet.name;
} }
} };
/** /**
* Resolve what "this" refers too, relative to a node. * Resolve what "this" refers too, relative to a node.
@ -579,7 +579,7 @@ exports.Parser.prototype.resolveThis = function(node) {
else { else {
return ''; // global? return ''; // global?
} }
} };
/** /**
Given: foo = { x:1 }, find foo from x. Given: foo = { x:1 }, find foo from x.
@ -598,7 +598,7 @@ exports.Parser.prototype.resolvePropertyParent = function(node) {
if (memberof.doclet) { return memberof; } if (memberof.doclet) { return memberof; }
} }
} };
/** /**
* Resolve what function a var is limited to. * Resolve what function a var is limited to.
@ -617,7 +617,7 @@ exports.Parser.prototype.resolveVar = function(node, basename) {
} }
return this.resolveVar(enclosingFunction, basename); return this.resolveVar(enclosingFunction, basename);
} };
exports.Parser.prototype.addDocletRef = function(e) { exports.Parser.prototype.addDocletRef = function(e) {
var node = e.code.node; var node = e.code.node;
@ -630,7 +630,7 @@ exports.Parser.prototype.addDocletRef = function(e) {
meta: { code: e.code } meta: { code: e.code }
}; };
} }
} };
exports.Parser.prototype.resolveEnum = function(e) { exports.Parser.prototype.resolveEnum = function(e) {
var doop = require("jsdoc/util/doop").doop, var doop = require("jsdoc/util/doop").doop,
@ -645,7 +645,7 @@ exports.Parser.prototype.resolveEnum = function(e) {
// use a copy of the doclet to avoid circular references // use a copy of the doclet to avoid circular references
parent.doclet.properties.push( doop(e.doclet) ); parent.doclet.properties.push( doop(e.doclet) );
} }
} };
/** /**
Fired whenever the parser encounters a JSDoc comment in the current source code. Fired whenever the parser encounters a JSDoc comment in the current source code.

View File

@ -19,7 +19,7 @@ var fs = require('fs');
@mixes module:common.events @mixes module:common.events
*/ */
exports.Scanner = function() { exports.Scanner = function() {
} };
common.mixin(exports.Scanner.prototype, common.events); common.mixin(exports.Scanner.prototype, common.events);
/** /**
@ -56,5 +56,4 @@ exports.Scanner.prototype.scan = function(searchPaths, depth, filter) {
}); });
return filePaths; return filePaths;
} };

View File

@ -137,4 +137,4 @@ exports.Tag = function(tagTitle, tagBody, meta) {
throw e; throw e;
} }
} }
} };

View File

@ -27,7 +27,7 @@ function TagDefinition(title, etc) {
TagDefinition.prototype.synonym = function(synonymName) { TagDefinition.prototype.synonym = function(synonymName) {
_synonyms[synonymName.toLowerCase()] = this.title; _synonyms[synonymName.toLowerCase()] = this.title;
return this; // chainable return this; // chainable
} };
/** @exports jsdoc/tag/dictionary */ /** @exports jsdoc/tag/dictionary */
dictionary = { dictionary = {

View File

@ -66,7 +66,7 @@ function setDocletNameToFilename(doclet, tag) {
for (var i = 0, len = env.opts._.length; i < len; i++) { for (var i = 0, len = env.opts._.length; i < len; i++) {
if (name.indexOf(env.opts._[i]) === 0) { if (name.indexOf(env.opts._[i]) === 0) {
name = name.replace(env.opts._[0], ''); name = name.replace(env.opts._[0], '');
break break;
} }
} }
doclet.name = name; doclet.name = name;
@ -234,7 +234,7 @@ exports.defineTags = function(dictionary) {
doclet.defaultvalue = doclet.meta.code.value; doclet.defaultvalue = doclet.meta.code.value;
if (doclet.meta.code.type === 'STRING') { if (doclet.meta.code.type === 'STRING') {
// TODO: handle escaped quotes in values // TODO: handle escaped quotes in values
doclet.defaultvalue = '"'+doclet.defaultvalue.replace(/"/g, '\\"')+'"' doclet.defaultvalue = '"'+doclet.defaultvalue.replace(/"/g, '\\"')+'"';
} }
if (doclet.defaultvalue === 'TRUE' || doclet.defaultvalue == 'FALSE') { if (doclet.defaultvalue === 'TRUE' || doclet.defaultvalue == 'FALSE') {
@ -243,7 +243,7 @@ exports.defineTags = function(dictionary) {
} }
else if (doclet.meta.code.type === 'NULL') { else if (doclet.meta.code.type === 'NULL') {
// TODO: handle escaped quotes in values // TODO: handle escaped quotes in values
doclet.defaultvalue = 'null' doclet.defaultvalue = 'null';
} }
} }
} }
@ -644,4 +644,4 @@ exports.defineTags = function(dictionary) {
doclet.version = tag.value; doclet.version = tag.value;
} }
}); });
} };

View File

@ -130,4 +130,4 @@ exports.parse = function(tagValue) {
nullable: nullable.nullable, nullable: nullable.nullable,
variable: variable.variable variable: variable.variable
}; };
} };

View File

@ -48,4 +48,4 @@ exports.validate = function(tag, meta) {
throw new TagValueNotPermittedError(tag.title, meta); throw new TagValueNotPermittedError(tag.title, meta);
} }
} }
} };

View File

@ -108,7 +108,7 @@ exports.resolve = function() {
} }
item = conf[name]; item = conf[name];
current = tutorials[name] current = tutorials[name];
// set title // set title
if (item.title) { if (item.title) {

View File

@ -48,7 +48,7 @@ seen.has = function(object) {
if (seen[i] === object) { return true; } if (seen[i] === object) { return true; }
} }
return false; return false;
} };
function stringify(o) { function stringify(o) {
return JSON.stringify(o); return JSON.stringify(o);
@ -96,13 +96,13 @@ function walk(object) {
output += value + ',\n'; output += value + ',\n';
} }
else if ( isUnwalkable(object) ) { else if ( isUnwalkable(object) ) {
output += '<Object>,\n' output += '<Object>,\n';
} }
else if ( isRegExp(object) ) { else if ( isRegExp(object) ) {
output += '<RegExp ' + object + '>,\n' output += '<RegExp ' + object + '>,\n';
} }
else if ( isDate(object) ) { else if ( isDate(object) ) {
output += '<Date ' + object.toUTCString() + '>,\n' output += '<Date ' + object.toUTCString() + '>,\n';
} }
else if ( isFunction(object) ) { else if ( isFunction(object) ) {
output += '<Function' + (object.name? ' '+ object.name : '') + '>,\n'; output += '<Function' + (object.name? ' '+ object.name : '') + '>,\n';
@ -153,4 +153,4 @@ exports.dump = function(object) {
walk(object); walk(object);
outdent(false); outdent(false);
return output; return output;
} };

View File

@ -61,7 +61,7 @@ var linkMap = {
exports.registerLink = function(longname, url) { exports.registerLink = function(longname, url) {
linkMap.longnameToUrl[longname] = url; linkMap.longnameToUrl[longname] = url;
linkMap.urlToLongname[url] = longname; linkMap.urlToLongname[url] = longname;
} };
function toLink(longname, content) { function toLink(longname, content) {
if (!longname) { if (!longname) {
@ -108,7 +108,7 @@ var toTutorial = exports.toTutorial = function(tutorial, content) {
content = content || node.title; content = content || node.title;
return '<a href="'+exports.tutorialToUrl(tutorial)+'">'+content+'</a>'; return '<a href="'+exports.tutorialToUrl(tutorial)+'">'+content+'</a>';
} };
/** Find symbol {@link ...} and {@tutorial ...} strings in text and turn into html links */ /** Find symbol {@link ...} and {@tutorial ...} strings in text and turn into html links */
exports.resolveLinks = function(str) { exports.resolveLinks = function(str) {
@ -125,7 +125,7 @@ exports.resolveLinks = function(str) {
); );
return str; return str;
} };
/** Turn a doclet into a URL. */ /** Turn a doclet into a URL. */
exports.createLink = function(doclet) { exports.createLink = function(doclet) {
@ -145,7 +145,7 @@ exports.createLink = function(doclet) {
} }
return url; return url;
} };
exports.longnameToUrl = linkMap.longnameToUrl; exports.longnameToUrl = linkMap.longnameToUrl;

View File

@ -222,7 +222,7 @@
addSignatureReturns(doclet); addSignatureReturns(doclet);
addAttribs(doclet); addAttribs(doclet);
} }
}) });
// do this after the urls have all been generated // do this after the urls have all been generated
data.forEach(function(doclet) { data.forEach(function(doclet) {
@ -232,12 +232,12 @@
if (doclet.kind === 'member') { if (doclet.kind === 'member') {
addSignatureType(doclet); addSignatureType(doclet);
addAttribs(doclet) addAttribs(doclet);
} }
if (doclet.kind === 'constant') { if (doclet.kind === 'constant') {
addSignatureType(doclet); addSignatureType(doclet);
addAttribs(doclet) addAttribs(doclet);
} }
}); });
@ -392,7 +392,7 @@
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a> html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
fs.writeFileSync(path, html) fs.writeFileSync(path, html);
} }
for (var longname in helper.longnameToUrl) { for (var longname in helper.longnameToUrl) {
@ -444,7 +444,7 @@
// yes, you can use {@link} in tutorials too! // yes, you can use {@link} in tutorials too!
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a> html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
fs.writeFileSync(path, html) fs.writeFileSync(path, html);
} }
// tutorials can have only one parent so there is no risk for loops // tutorials can have only one parent so there is no risk for loops
@ -455,7 +455,7 @@
}); });
} }
saveChildren(tutorials); saveChildren(tutorials);
} };
function hashToLink(doclet, hash) { function hashToLink(doclet, hash) {
if ( !/^(#.+)/.test(hash) ) { return hash; } if ( !/^(#.+)/.test(hash) ) { return hash; }

View File

@ -36,7 +36,7 @@
console.log('The only -d destination option currently supported is "console"!'); console.log('The only -d destination option currently supported is "console"!');
} }
} };
function graft(parentNode, childNodes, parentLongname, parentName) { function graft(parentNode, childNodes, parentLongname, parentName) {
childNodes childNodes