From c43c183aaaa740e97dfd6e026ce83174d87b3c2c Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Fri, 6 Jul 2012 07:40:24 -0700 Subject: [PATCH 01/15] disable JSHint's "asi" relaxing option --- .jshintrc | 2 +- jsdoc.js | 4 +-- plugins/markdown.js | 2 +- rhino_modules/jsdoc/augment.js | 2 +- rhino_modules/jsdoc/borrow.js | 2 +- rhino_modules/jsdoc/config.js | 3 +- rhino_modules/jsdoc/doclet.js | 20 ++++++------- rhino_modules/jsdoc/name.js | 10 +++---- rhino_modules/jsdoc/opts/parser.js | 6 ++-- rhino_modules/jsdoc/package.js | 3 +- rhino_modules/jsdoc/readme.js | 2 +- rhino_modules/jsdoc/src/filter.js | 4 +-- rhino_modules/jsdoc/src/parser.js | 30 +++++++++---------- rhino_modules/jsdoc/src/scanner.js | 5 ++-- rhino_modules/jsdoc/tag.js | 2 +- rhino_modules/jsdoc/tag/dictionary.js | 2 +- .../jsdoc/tag/dictionary/definitions.js | 8 ++--- rhino_modules/jsdoc/tag/type.js | 2 +- rhino_modules/jsdoc/tag/validator.js | 2 +- rhino_modules/jsdoc/tutorial/resolver.js | 2 +- rhino_modules/jsdoc/util/dumper.js | 10 +++---- rhino_modules/jsdoc/util/templateHelper.js | 8 ++--- templates/default/publish.js | 12 ++++---- templates/haruki/publish.js | 2 +- 24 files changed, 71 insertions(+), 74 deletions(-) diff --git a/.jshintrc b/.jshintrc index 8d076fa4..db546a74 100644 --- a/.jshintrc +++ b/.jshintrc @@ -15,7 +15,7 @@ "strict": false, "trailing": true, - "asi": true, + "asi": false, "boss": true, "debug": true, "eqnull": true, diff --git a/jsdoc.js b/jsdoc.js index b5408f33..21eaa02c 100644 --- a/jsdoc.js +++ b/jsdoc.js @@ -89,7 +89,7 @@ include.resolve = function(filepath) { } return env.dirname + '/' + filepath; -} +}; /** Print string/s out to the console. @param {string} ... String/s to print out to console. @@ -172,7 +172,7 @@ app = { parser: new (require('jsdoc/src/parser').Parser)(), name: require('jsdoc/name') } -} +}; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// diff --git a/plugins/markdown.js b/plugins/markdown.js index a4736628..20eab22f 100644 --- a/plugins/markdown.js +++ b/plugins/markdown.js @@ -39,7 +39,7 @@ function getParser(parser, conf) { return function(source) { return parser.renderJsonML(parser.toHTMLTree(source, conf.dialect)); - } + }; } else { throw "unknown Markdown parser: '" + parser + "'"; } diff --git a/rhino_modules/jsdoc/augment.js b/rhino_modules/jsdoc/augment.js index bff28a1e..ee476fcf 100644 --- a/rhino_modules/jsdoc/augment.js +++ b/rhino_modules/jsdoc/augment.js @@ -18,7 +18,7 @@ var doop = require("jsdoc/util/doop").doop; docs.push(doc); }); }); - } + }; function mapDependencies(index) { var doclets, doc, len, dependencies = {}; diff --git a/rhino_modules/jsdoc/borrow.js b/rhino_modules/jsdoc/borrow.js index 44dba578..b8674486 100644 --- a/rhino_modules/jsdoc/borrow.js +++ b/rhino_modules/jsdoc/borrow.js @@ -48,4 +48,4 @@ exports.resolveBorrows = function(docs) { delete doc.borrowed; } }); -} +}; diff --git a/rhino_modules/jsdoc/config.js b/rhino_modules/jsdoc/config.js index 9b5bcb0d..df09691e 100644 --- a/rhino_modules/jsdoc/config.js +++ b/rhino_modules/jsdoc/config.js @@ -39,5 +39,4 @@ module.exports = Config; */ Config.prototype.get = function() { return this._config; -} - +}; diff --git a/rhino_modules/jsdoc/doclet.js b/rhino_modules/jsdoc/doclet.js index 66711e54..af97491f 100644 --- a/rhino_modules/jsdoc/doclet.js +++ b/rhino_modules/jsdoc/doclet.js @@ -144,7 +144,7 @@ exports.Doclet = function(docletSrc, meta) { } this.postProcess(); -} +}; /** Called once after all tags have been added. */ exports.Doclet.prototype.postProcess = function() { @@ -172,7 +172,7 @@ exports.Doclet.prototype.postProcess = function() { } } } -} +}; /** Add a tag to this doclet. @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); if (tagDef && tagDef.onTagged) { - tagDef.onTagged(this, newTag) + tagDef.onTagged(this, newTag); } if (!tagDef) { @@ -192,7 +192,7 @@ exports.Doclet.prototype.addTag = function(title, text) { } applyTag.call(this, newTag); -} +}; /** Set the `memberof` property of this doclet. @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 */ this.memberof = sid.replace(/\.prototype/g, '#'); -} +}; /** Set the `longname` property of this doclet. @param {string} name @@ -220,7 +220,7 @@ exports.Doclet.prototype.setLongname = function(name) { if (jsdoc.tag.dictionary.isNamespace(this.kind)) { this.longname = jsdoc.name.applyNamespace(this.longname, this.kind); } -} +}; /** Add a symbol to this doclet's `borrowed` array. @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.push(about); -} +}; exports.Doclet.prototype.mix = function(source) { if (!this.mixes) { @@ -249,7 +249,7 @@ exports.Doclet.prototype.mix = function(source) { this.mixes = []; } this.mixes.push(source); -} +}; /** Add a symbol to this doclet's `augments` array. @param {string} base - The longname of the base symbol. @@ -263,7 +263,7 @@ exports.Doclet.prototype.augment = function(base) { this.augments = []; } this.augments.push(base); -} +}; /** 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([]); } } -} +}; diff --git a/rhino_modules/jsdoc/name.js b/rhino_modules/jsdoc/name.js index c5dc8b38..5c8f2dc7 100644 --- a/rhino_modules/jsdoc/name.js +++ b/rhino_modules/jsdoc/name.js @@ -91,7 +91,7 @@ exports.resolve = function(doclet) { if (about.variation) { doclet.variation = about.variation; } -} +}; /** @inner @@ -113,7 +113,7 @@ function quoteUnsafe(name, kind) { // docspaced names may have unsafe characters RegExp.escape = RegExp.escape || function(str) { var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ return str.replace(specials, "\\$&"); -} +}; /** @method module:jsdoc/name.applyNamespace @@ -131,7 +131,7 @@ exports.applyNamespace = function(longname, ns) { } return longname; -} +}; /** 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}; -} +}; /** 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 }; -} \ No newline at end of file +}; diff --git a/rhino_modules/jsdoc/opts/parser.js b/rhino_modules/jsdoc/opts/parser.js index c1cbefc4..b261d911 100644 --- a/rhino_modules/jsdoc/opts/parser.js +++ b/rhino_modules/jsdoc/opts/parser.js @@ -51,14 +51,14 @@ exports.parse = function(args) { ourOptions = argParser.parse(args, defaults); return ourOptions; -} +}; /** Display help message for options. */ exports.help = function() { return argParser.help(); -} +}; /** Get a named option. @@ -75,4 +75,4 @@ exports.get = function(name) { else { return ourOptions[name]; } -} +}; diff --git a/rhino_modules/jsdoc/package.js b/rhino_modules/jsdoc/package.js index 3c645817..9b9cf99d 100644 --- a/rhino_modules/jsdoc/package.js +++ b/rhino_modules/jsdoc/package.js @@ -66,5 +66,4 @@ exports.Package = function(json) { * ] */ this.licenses = json.licenses; -} - +}; diff --git a/rhino_modules/jsdoc/readme.js b/rhino_modules/jsdoc/readme.js index ee09395a..aba292d9 100644 --- a/rhino_modules/jsdoc/readme.js +++ b/rhino_modules/jsdoc/readme.js @@ -33,7 +33,7 @@ function getParser(parser, conf) { return function(source) { return parser.renderJsonML(parser.toHTMLTree(source, conf.dialect)); - } + }; } else { throw 'unknown Markdown parser: "' + parser + '"'; diff --git a/rhino_modules/jsdoc/src/filter.js b/rhino_modules/jsdoc/src/filter.js index 573d9a54..091b37c8 100644 --- a/rhino_modules/jsdoc/src/filter.js +++ b/rhino_modules/jsdoc/src/filter.js @@ -20,7 +20,7 @@ exports.Filter = function(opts) { this.excludePattern = opts.excludePattern? typeof opts.excludePattern === 'string'? new RegExp(opts.excludePattern) : opts.excludePattern : null; -} +}; /** @param {string} filepath - The filepath to check. @@ -40,4 +40,4 @@ exports.Filter.prototype.isIncluded = function(filepath) { } return true; -} \ No newline at end of file +}; diff --git a/rhino_modules/jsdoc/src/parser.js b/rhino_modules/jsdoc/src/parser.js index c128c9c8..a87278b0 100644 --- a/rhino_modules/jsdoc/src/parser.js +++ b/rhino_modules/jsdoc/src/parser.js @@ -83,14 +83,14 @@ exports.Parser.prototype.parse = function(sourceFiles, encoding) { */ exports.Parser.prototype.results = function() { return this._resultBuffer; -} +}; /** * @param {Object} o The parse result to add to the result buffer. */ exports.Parser.prototype.addResult = function(o) { this._resultBuffer.push(o); -} +}; /** * Empty any accumulated results of calls to parse. @@ -99,21 +99,21 @@ exports.Parser.prototype.clear = function() { currentParser = null; currentSourceName = ''; this._resultBuffer = []; -} +}; /** * Adds a node visitor to use in parsing */ exports.Parser.prototype.addNodeVisitor = function(visitor) { this._visitors.push(visitor); -} +}; /** * Get the node visitors used in parsing */ exports.Parser.prototype.getVisitors = function() { return this._visitors; -} +}; function pretreat(code) { return code @@ -168,7 +168,7 @@ function nodeToString(node) { str = [nodeToString(node.target), node.property.string].join('.'); } else if (node.type === Token.VAR) { - str = nodeToString(node.target) + str = nodeToString(node.target); } else if (node.type === Token.NAME) { str = node.string; @@ -281,7 +281,7 @@ function makeVarsFinisher(funcDoc) { if (funcDoc && e.doclet && e.doclet.alias) { funcDoc.meta.vars[e.code.name] = e.doclet.longname; } - } + }; return func; } @@ -425,7 +425,7 @@ function visitNode(node) { e.finishers.push(makeVarsFinisher(funcDoc)); } - var basename = getBasename(e.code.name) + var basename = getBasename(e.code.name); e.code.funcscope = currentParser.resolveVar(node, basename); } @@ -470,7 +470,7 @@ exports.Parser.prototype._parseSourceCode = function(sourceCode, sourceName) { this.fire('fileComplete', e); currentSourceName = ''; -} +}; /** * 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; } -} +}; /** * Resolve what "this" refers too, relative to a node. @@ -579,7 +579,7 @@ exports.Parser.prototype.resolveThis = function(node) { else { return ''; // global? } -} +}; /** Given: foo = { x:1 }, find foo from x. @@ -598,7 +598,7 @@ exports.Parser.prototype.resolvePropertyParent = function(node) { if (memberof.doclet) { return memberof; } } -} +}; /** * Resolve what function a var is limited to. @@ -617,7 +617,7 @@ exports.Parser.prototype.resolveVar = function(node, basename) { } return this.resolveVar(enclosingFunction, basename); -} +}; exports.Parser.prototype.addDocletRef = function(e) { var node = e.code.node; @@ -630,7 +630,7 @@ exports.Parser.prototype.addDocletRef = function(e) { meta: { code: e.code } }; } -} +}; exports.Parser.prototype.resolveEnum = function(e) { 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 parent.doclet.properties.push( doop(e.doclet) ); } -} +}; /** Fired whenever the parser encounters a JSDoc comment in the current source code. diff --git a/rhino_modules/jsdoc/src/scanner.js b/rhino_modules/jsdoc/src/scanner.js index 2c5ad30a..3b73e94a 100644 --- a/rhino_modules/jsdoc/src/scanner.js +++ b/rhino_modules/jsdoc/src/scanner.js @@ -19,7 +19,7 @@ var fs = require('fs'); @mixes module:common.events */ exports.Scanner = function() { -} +}; common.mixin(exports.Scanner.prototype, common.events); /** @@ -56,5 +56,4 @@ exports.Scanner.prototype.scan = function(searchPaths, depth, filter) { }); return filePaths; -} - +}; diff --git a/rhino_modules/jsdoc/tag.js b/rhino_modules/jsdoc/tag.js index f4a83c50..56caa3a7 100644 --- a/rhino_modules/jsdoc/tag.js +++ b/rhino_modules/jsdoc/tag.js @@ -137,4 +137,4 @@ exports.Tag = function(tagTitle, tagBody, meta) { throw e; } } -} +}; diff --git a/rhino_modules/jsdoc/tag/dictionary.js b/rhino_modules/jsdoc/tag/dictionary.js index a93b9dba..033e6134 100644 --- a/rhino_modules/jsdoc/tag/dictionary.js +++ b/rhino_modules/jsdoc/tag/dictionary.js @@ -27,7 +27,7 @@ function TagDefinition(title, etc) { TagDefinition.prototype.synonym = function(synonymName) { _synonyms[synonymName.toLowerCase()] = this.title; return this; // chainable -} +}; /** @exports jsdoc/tag/dictionary */ dictionary = { diff --git a/rhino_modules/jsdoc/tag/dictionary/definitions.js b/rhino_modules/jsdoc/tag/dictionary/definitions.js index e19e52d6..5eee47fd 100644 --- a/rhino_modules/jsdoc/tag/dictionary/definitions.js +++ b/rhino_modules/jsdoc/tag/dictionary/definitions.js @@ -66,7 +66,7 @@ function setDocletNameToFilename(doclet, tag) { for (var i = 0, len = env.opts._.length; i < len; i++) { if (name.indexOf(env.opts._[i]) === 0) { name = name.replace(env.opts._[0], ''); - break + break; } } doclet.name = name; @@ -234,7 +234,7 @@ exports.defineTags = function(dictionary) { doclet.defaultvalue = doclet.meta.code.value; if (doclet.meta.code.type === 'STRING') { // 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') { @@ -243,7 +243,7 @@ exports.defineTags = function(dictionary) { } else if (doclet.meta.code.type === 'NULL') { // TODO: handle escaped quotes in values - doclet.defaultvalue = 'null' + doclet.defaultvalue = 'null'; } } } @@ -644,4 +644,4 @@ exports.defineTags = function(dictionary) { doclet.version = tag.value; } }); -} +}; diff --git a/rhino_modules/jsdoc/tag/type.js b/rhino_modules/jsdoc/tag/type.js index 2c73a098..02d78bdf 100644 --- a/rhino_modules/jsdoc/tag/type.js +++ b/rhino_modules/jsdoc/tag/type.js @@ -130,4 +130,4 @@ exports.parse = function(tagValue) { nullable: nullable.nullable, variable: variable.variable }; -} +}; diff --git a/rhino_modules/jsdoc/tag/validator.js b/rhino_modules/jsdoc/tag/validator.js index 13dfb326..928bfdd7 100644 --- a/rhino_modules/jsdoc/tag/validator.js +++ b/rhino_modules/jsdoc/tag/validator.js @@ -48,4 +48,4 @@ exports.validate = function(tag, meta) { throw new TagValueNotPermittedError(tag.title, meta); } } -} +}; diff --git a/rhino_modules/jsdoc/tutorial/resolver.js b/rhino_modules/jsdoc/tutorial/resolver.js index e587e64f..3cbc05d3 100644 --- a/rhino_modules/jsdoc/tutorial/resolver.js +++ b/rhino_modules/jsdoc/tutorial/resolver.js @@ -108,7 +108,7 @@ exports.resolve = function() { } item = conf[name]; - current = tutorials[name] + current = tutorials[name]; // set title if (item.title) { diff --git a/rhino_modules/jsdoc/util/dumper.js b/rhino_modules/jsdoc/util/dumper.js index 230fecae..91baeb12 100644 --- a/rhino_modules/jsdoc/util/dumper.js +++ b/rhino_modules/jsdoc/util/dumper.js @@ -48,7 +48,7 @@ seen.has = function(object) { if (seen[i] === object) { return true; } } return false; -} +}; function stringify(o) { return JSON.stringify(o); @@ -96,13 +96,13 @@ function walk(object) { output += value + ',\n'; } else if ( isUnwalkable(object) ) { - output += ',\n' + output += ',\n'; } else if ( isRegExp(object) ) { - output += ',\n' + output += ',\n'; } else if ( isDate(object) ) { - output += ',\n' + output += ',\n'; } else if ( isFunction(object) ) { output += ',\n'; @@ -153,4 +153,4 @@ exports.dump = function(object) { walk(object); outdent(false); return output; -} +}; diff --git a/rhino_modules/jsdoc/util/templateHelper.js b/rhino_modules/jsdoc/util/templateHelper.js index 036a50d8..0a1447f6 100644 --- a/rhino_modules/jsdoc/util/templateHelper.js +++ b/rhino_modules/jsdoc/util/templateHelper.js @@ -61,7 +61,7 @@ var linkMap = { exports.registerLink = function(longname, url) { linkMap.longnameToUrl[longname] = url; linkMap.urlToLongname[url] = longname; -} +}; function toLink(longname, content) { if (!longname) { @@ -108,7 +108,7 @@ var toTutorial = exports.toTutorial = function(tutorial, content) { content = content || node.title; return ''+content+''; -} +}; /** Find symbol {@link ...} and {@tutorial ...} strings in text and turn into html links */ exports.resolveLinks = function(str) { @@ -125,7 +125,7 @@ exports.resolveLinks = function(str) { ); return str; -} +}; /** Turn a doclet into a URL. */ exports.createLink = function(doclet) { @@ -145,7 +145,7 @@ exports.createLink = function(doclet) { } return url; -} +}; exports.longnameToUrl = linkMap.longnameToUrl; diff --git a/templates/default/publish.js b/templates/default/publish.js index 58a0ba12..c9e97bc2 100644 --- a/templates/default/publish.js +++ b/templates/default/publish.js @@ -222,7 +222,7 @@ addSignatureReturns(doclet); addAttribs(doclet); } - }) + }); // do this after the urls have all been generated data.forEach(function(doclet) { @@ -232,12 +232,12 @@ if (doclet.kind === 'member') { addSignatureType(doclet); - addAttribs(doclet) + addAttribs(doclet); } if (doclet.kind === 'constant') { addSignatureType(doclet); - addAttribs(doclet) + addAttribs(doclet); } }); @@ -392,7 +392,7 @@ html = helper.resolveLinks(html); // turn {@link foo} into foo - fs.writeFileSync(path, html) + fs.writeFileSync(path, html); } for (var longname in helper.longnameToUrl) { @@ -444,7 +444,7 @@ // yes, you can use {@link} in tutorials too! html = helper.resolveLinks(html); // turn {@link foo} into foo - fs.writeFileSync(path, html) + fs.writeFileSync(path, html); } // tutorials can have only one parent so there is no risk for loops @@ -455,7 +455,7 @@ }); } saveChildren(tutorials); - } + }; function hashToLink(doclet, hash) { if ( !/^(#.+)/.test(hash) ) { return hash; } diff --git a/templates/haruki/publish.js b/templates/haruki/publish.js index fcfc8e1a..706eae75 100644 --- a/templates/haruki/publish.js +++ b/templates/haruki/publish.js @@ -36,7 +36,7 @@ console.log('The only -d destination option currently supported is "console"!'); } - } + }; function graft(parentNode, childNodes, parentLongname, parentName) { childNodes From f09b5f402fb24f5e5ab230a8908d525c8f162299 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:34:00 -0700 Subject: [PATCH 02/15] disable JSHint's "boss" relaxing option --- .jshintrc | 2 +- rhino_modules/jsdoc/src/parser.js | 7 +++---- rhino_modules/jsdoc/util/dumper.js | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.jshintrc b/.jshintrc index db546a74..b8a30152 100644 --- a/.jshintrc +++ b/.jshintrc @@ -16,7 +16,7 @@ "trailing": true, "asi": false, - "boss": true, + "boss": false, "debug": true, "eqnull": true, "es5": true, diff --git a/rhino_modules/jsdoc/src/parser.js b/rhino_modules/jsdoc/src/parser.js index a87278b0..4c553553 100644 --- a/rhino_modules/jsdoc/src/parser.js +++ b/rhino_modules/jsdoc/src/parser.js @@ -316,17 +316,16 @@ function visitNode(node) { continue; } - if (commentSrc = ''+comment.toSource()) { + commentSrc = '' + comment.toSource(); + if ( commentSrc && isValidJsdoc(commentSrc) ) { e = { comment: commentSrc, lineno: comment.getLineno(), filename: currentSourceName }; - if ( isValidJsdoc(commentSrc) ) { - currentParser.fire('jsdocCommentFound', e, currentParser); - } + currentParser.fire('jsdocCommentFound', e, currentParser); } } e = null; diff --git a/rhino_modules/jsdoc/util/dumper.js b/rhino_modules/jsdoc/util/dumper.js index 91baeb12..bb8287cd 100644 --- a/rhino_modules/jsdoc/util/dumper.js +++ b/rhino_modules/jsdoc/util/dumper.js @@ -90,9 +90,8 @@ function isObject(o) { } function walk(object) { - var value; - - if ( value = getValue(object) ) { + var value = getValue(object); + if (value) { output += value + ',\n'; } else if ( isUnwalkable(object) ) { From b417ad9bf757e5cc2df6b4f85e805be0d748e5cf Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:35:45 -0700 Subject: [PATCH 03/15] disable JSHint's "debug" relaxing option (no fixes required) --- .jshintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index b8a30152..6b25db22 100644 --- a/.jshintrc +++ b/.jshintrc @@ -17,7 +17,7 @@ "asi": false, "boss": false, - "debug": true, + "debug": false, "eqnull": true, "es5": true, "esnext": true, From 80c832aac0ccc079b667e6dc2c28d9107cee2c06 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:36:42 -0700 Subject: [PATCH 04/15] disable JSHint's "evil" relaxing option (no fixes required) --- .jshintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index 6b25db22..1b2c49b9 100644 --- a/.jshintrc +++ b/.jshintrc @@ -21,7 +21,7 @@ "eqnull": true, "es5": true, "esnext": true, - "evil": true, + "evil": false, "expr": true, "funcscope": true, "globalstrict": true, From 64c9565e587dca7d3749853ae67820cc5ee92bff Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:39:07 -0700 Subject: [PATCH 05/15] disable JSHint's "expr" relaxing option --- .jshintrc | 2 +- rhino_modules/jsdoc/tag/dictionary/definitions.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.jshintrc b/.jshintrc index 1b2c49b9..16e950f4 100644 --- a/.jshintrc +++ b/.jshintrc @@ -22,7 +22,7 @@ "es5": true, "esnext": true, "evil": false, - "expr": true, + "expr": false, "funcscope": true, "globalstrict": true, "iterator": true, diff --git a/rhino_modules/jsdoc/tag/dictionary/definitions.js b/rhino_modules/jsdoc/tag/dictionary/definitions.js index 6dee4747..e7060184 100644 --- a/rhino_modules/jsdoc/tag/dictionary/definitions.js +++ b/rhino_modules/jsdoc/tag/dictionary/definitions.js @@ -440,7 +440,9 @@ exports.defineTags = function(dictionary) { onTagged: function(doclet, tag) { setDocletKindToTitle(doclet, tag); setDocletNameToValue(doclet, tag); - doclet.name || setDocletNameToFilename(doclet, tag); + if (!doclet.name) { + setDocletNameToFilename(doclet, tag); + } if (tag.value && tag.value.type) { doclet.type = tag.value.type; } From 382710bbef7865a5b620c5f33aaab1a1f10ce5cb Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:40:00 -0700 Subject: [PATCH 06/15] disables JSHint's "funcscope" relaxing option (no fixes required) --- .jshintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index 16e950f4..87e721a4 100644 --- a/.jshintrc +++ b/.jshintrc @@ -23,7 +23,7 @@ "esnext": true, "evil": false, "expr": false, - "funcscope": true, + "funcscope": false, "globalstrict": true, "iterator": true, "lastsemic": true, From 25c7afc263eb365de55866b1940f4866e9de11ef Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:41:02 -0700 Subject: [PATCH 07/15] disable JSHint's "globalstrict" relaxing option (no fixes required) --- .jshintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index 87e721a4..0ae7d27b 100644 --- a/.jshintrc +++ b/.jshintrc @@ -24,7 +24,7 @@ "evil": false, "expr": false, "funcscope": false, - "globalstrict": true, + "globalstrict": false, "iterator": true, "lastsemic": true, "laxbreak": true, From b557345f617b5d9dab345602049bcfa69aa66712 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:41:52 -0700 Subject: [PATCH 08/15] disable JSHint's "iterator" relaxing option (no fixes required) --- .jshintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index 0ae7d27b..a52eff17 100644 --- a/.jshintrc +++ b/.jshintrc @@ -25,7 +25,7 @@ "expr": false, "funcscope": false, "globalstrict": false, - "iterator": true, + "iterator": false, "lastsemic": true, "laxbreak": true, "laxcomma": true, From 58a5f2e50fc87ed646d687b085a64bf1c9a9f3d3 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 8 Jul 2012 21:46:44 -0700 Subject: [PATCH 09/15] disable JSHint's "lastsemic", "laxbreak", lax comma", "multistr", and "proto" relaxing options (no fixes required) --- .jshintrc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.jshintrc b/.jshintrc index a52eff17..f91e6f72 100644 --- a/.jshintrc +++ b/.jshintrc @@ -26,14 +26,14 @@ "funcscope": false, "globalstrict": false, "iterator": false, - "lastsemic": true, - "laxbreak": true, - "laxcomma": true, + "lastsemic": false, + "laxbreak": false, + "laxcomma": false, "loopfunc": true, - "multistr": true, + "multistr": false, "onecase": true, - "proto": true, "regexdash": true, + "proto": false, "scripturl": true, "shadow": true, "smarttabs": true, From 6c5ad30c7903930209c293a2ce6dc15507ee3a44 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Tue, 10 Jul 2012 06:09:11 -0700 Subject: [PATCH 10/15] disable JSHint's "regexdash" relaxing option --- .jshintrc | 2 +- rhino_modules/jsdoc/util/templateHelper.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.jshintrc b/.jshintrc index f91e6f72..4021e2cf 100644 --- a/.jshintrc +++ b/.jshintrc @@ -32,8 +32,8 @@ "loopfunc": true, "multistr": false, "onecase": true, - "regexdash": true, "proto": false, + "regexdash": false, "scripturl": true, "shadow": true, "smarttabs": true, diff --git a/rhino_modules/jsdoc/util/templateHelper.js b/rhino_modules/jsdoc/util/templateHelper.js index 0a1447f6..fe5e3106 100644 --- a/rhino_modules/jsdoc/util/templateHelper.js +++ b/rhino_modules/jsdoc/util/templateHelper.js @@ -46,7 +46,7 @@ function strToFilename(str) { // allow for namespace prefix var basename = str.replace(nsprefix, '$1-'); - if ( /[^$a-z0-9._-]/i.test(basename) ) { + if ( /[^$a-z0-9._\-]/i.test(basename) ) { return hash.hex_md5(str).substr(0, 10); } return makeFilenameUnique(basename, str); From ff62a9099ddf959b84c911d913db321faadaf66b Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Tue, 10 Jul 2012 06:43:19 -0700 Subject: [PATCH 11/15] disable JSHint's "shadow" relaxing option --- .jshintrc | 2 +- rhino_modules/fs.js | 2 +- rhino_modules/jsdoc/config.js | 2 +- rhino_modules/jsdoc/name.js | 13 ++++++----- rhino_modules/jsdoc/src/parser.js | 26 +++++++++++++--------- rhino_modules/jsdoc/tag.js | 4 ++-- rhino_modules/jsdoc/util/templateHelper.js | 12 +++++----- 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/.jshintrc b/.jshintrc index 4021e2cf..15cec50d 100644 --- a/.jshintrc +++ b/.jshintrc @@ -35,7 +35,7 @@ "proto": false, "regexdash": false, "scripturl": true, - "shadow": true, + "shadow": false, "smarttabs": true, "sub": true, "supernew": true, diff --git a/rhino_modules/fs.js b/rhino_modules/fs.js index 2dec03be..a32eff3b 100644 --- a/rhino_modules/fs.js +++ b/rhino_modules/fs.js @@ -131,7 +131,7 @@ exports.copyFile = function(inFile, outDir, fileName) { outDir = toDir(outDir); - var inFile = new java.io.File(inFile); + inFile = new java.io.File(inFile); var outFile = new java.io.File(outDir+'/'+fileName); var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096); diff --git a/rhino_modules/jsdoc/config.js b/rhino_modules/jsdoc/config.js index df09691e..61b39253 100644 --- a/rhino_modules/jsdoc/config.js +++ b/rhino_modules/jsdoc/config.js @@ -27,7 +27,7 @@ const defaults = { @param {string} [json] - The contents of config.json. */ function Config(json) { - var json = JSON.parse( (json || "{}") ); + json = JSON.parse( (json || "{}") ); this._config = util.mergeRecurse(defaults, json); } diff --git a/rhino_modules/jsdoc/name.js b/rhino_modules/jsdoc/name.js index 5c8f2dc7..d3d73b40 100644 --- a/rhino_modules/jsdoc/name.js +++ b/rhino_modules/jsdoc/name.js @@ -123,8 +123,8 @@ RegExp.escape = RegExp.escape || function(str) { */ exports.applyNamespace = function(longname, ns) { var nameParts = exports.shorten(longname), - name = nameParts.name, - longname = nameParts.longname; + name = nameParts.name; + longname = nameParts.longname; if ( !/^[a-zA-Z]+?:.+$/i.test(name) ) { longname = longname.replace( new RegExp(RegExp.escape(name)+'$'), ns + ':' + name ); @@ -161,21 +161,22 @@ exports.shorten = function(longname, forcedMemberof) { var name = '', scope = '', // ., ~, or # memberof = '', + parts, variation; longname = longname.replace( /\.prototype\.?/g, '#' ); if (typeof forcedMemberof !== 'undefined') { name = longname.substr(forcedMemberof.length); - var parts = forcedMemberof.match(/^(.*?)([#.~]?)$/); + parts = forcedMemberof.match(/^(.*?)([#.~]?)$/); if (parts[1]) { memberof = parts[1] || forcedMemberof; } if (parts[2]) { scope = parts[2]; } } else { - var parts = longname? - (longname.match( /^(:?(.+)([#.~]))?(.+?)$/ ) || []).reverse() - : ['']; + parts = longname? + (longname.match( /^(:?(.+)([#.~]))?(.+?)$/ ) || []).reverse() + : ['']; name = parts[0] || ''; // ensure name is always initialised to avoid error being thrown when calling replace on undefined [gh-24] scope = parts[1] || ''; // ., ~, or # diff --git a/rhino_modules/jsdoc/src/parser.js b/rhino_modules/jsdoc/src/parser.js index 4c553553..c6db6a43 100644 --- a/rhino_modules/jsdoc/src/parser.js +++ b/rhino_modules/jsdoc/src/parser.js @@ -303,6 +303,9 @@ function visitNode(node) { nodeComments, comment, commentSrc, + basename, + func, + funcDoc, i, l; @@ -342,7 +345,7 @@ function visitNode(node) { finishers: [currentParser.addDocletRef] }; - var basename = getBasename(e.code.name); + basename = getBasename(e.code.name); if (basename !== 'this') { e.code.funcscope = currentParser.resolveVar(node, basename); @@ -384,8 +387,8 @@ function visitNode(node) { }; // keep track of vars in a function or global scope - var func = "__global__", - funcDoc = null; + func = "__global__"; + funcDoc = null; if (node.enclosingFunction) { func = 'astnode'+node.enclosingFunction.hashCode(); } @@ -412,8 +415,8 @@ function visitNode(node) { //console.log(':: e.code.name is', e.code.name); // keep track of vars in a function or global scope - var func = "__global__", - funcDoc = null; + func = "__global__"; + funcDoc = null; if (node.enclosingFunction) { func = 'astnode'+node.enclosingFunction.hashCode(); } @@ -424,12 +427,12 @@ function visitNode(node) { e.finishers.push(makeVarsFinisher(funcDoc)); } - var basename = getBasename(e.code.name); + basename = getBasename(e.code.name); e.code.funcscope = currentParser.resolveVar(node, basename); } if (!e) { e = {finishers: []}; } - for(var i = 0, l = currentParser._visitors.length; i < l; i++) { + for(i = 0, l = currentParser._visitors.length; i < l; i++) { currentParser._visitors[i].visitNode(node, e, currentParser, currentSourceName); if (e.stopPropagation) { break; } } @@ -438,7 +441,7 @@ function visitNode(node) { currentParser.fire(e.event, e, currentParser); } - for (var i = 0, l = e.finishers.length; i < l; i++) { + for (i = 0, l = e.finishers.length; i < l; i++) { e.finishers[i].call(currentParser, e); } @@ -478,7 +481,8 @@ exports.Parser.prototype._parseSourceCode = function(sourceCode, sourceName) { */ exports.Parser.prototype.astnodeToMemberof = function(node) { var id, - doclet; + doclet, + alias; if (node.type === Token.VAR || node.type === Token.FUNCTION || node.type == tkn.NAMEDFUNCTIONSTATEMENT) { if (node.enclosingFunction) { // an inner var or func @@ -498,7 +502,7 @@ exports.Parser.prototype.astnodeToMemberof = function(node) { id = 'astnode'+scope.enclosingFunction.hashCode(); doclet = this.refs[id]; if (doclet && doclet.meta.vars && basename in doclet.meta.vars) { - var alias = hasOwnProp.call(doclet.meta.vars, basename)? doclet.meta.vars[basename] : false; + alias = hasOwnProp.call(doclet.meta.vars, basename)? doclet.meta.vars[basename] : false; if (alias !== false) { return [alias, basename]; } @@ -509,7 +513,7 @@ exports.Parser.prototype.astnodeToMemberof = function(node) { //First check to see if we have a global scope alias doclet = this.refs["__global__"]; if (doclet && doclet.meta.vars && hasOwnProp.call(doclet.meta.vars, basename)) { - var alias = doclet.meta.vars[basename]; + alias = doclet.meta.vars[basename]; if (alias !== false) { return [alias, basename]; } diff --git a/rhino_modules/jsdoc/tag.js b/rhino_modules/jsdoc/tag.js index 56caa3a7..d404b2e8 100644 --- a/rhino_modules/jsdoc/tag.js +++ b/rhino_modules/jsdoc/tag.js @@ -70,8 +70,8 @@ function parseParamText(tagText) { @param {object=} meta */ exports.Tag = function(tagTitle, tagBody, meta) { - var tagDef = jsdoc.tag.dictionary.lookUp(tagTitle), - meta = meta || {}; + var tagDef = jsdoc.tag.dictionary.lookUp(tagTitle); + meta = meta || {}; this.originalTitle = trim(tagTitle); diff --git a/rhino_modules/jsdoc/util/templateHelper.js b/rhino_modules/jsdoc/util/templateHelper.js index fe5e3106..f30edaf0 100644 --- a/rhino_modules/jsdoc/util/templateHelper.js +++ b/rhino_modules/jsdoc/util/templateHelper.js @@ -129,17 +129,19 @@ exports.resolveLinks = function(str) { /** Turn a doclet into a URL. */ exports.createLink = function(doclet) { - var url = ''; + var url = '', + longname, + filename; if (containers.indexOf(doclet.kind) < 0) { - var longname = doclet.longname, - filename = strToFilename(doclet.memberof || exports.globalName); + longname = doclet.longname; + filename = strToFilename(doclet.memberof || exports.globalName); url = filename + exports.fileExtension + '#' + getNamespace(doclet.kind) + doclet.name; } else { - var longname = doclet.longname, - filename = strToFilename(longname); + longname = doclet.longname; + filename = strToFilename(longname); url = filename + exports.fileExtension; } From 0dcb756ede7adfe5ce4131e9841471d999478eee Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Tue, 10 Jul 2012 06:54:26 -0700 Subject: [PATCH 12/15] disable JSHint's "smarttabs" relaxing option and completely detab all files that have mixed spaces/tabs --- .jshintrc | 2 +- rhino_modules/jsdoc/doclet.js | 58 +++--- rhino_modules/jsdoc/src/scanner.js | 60 +++---- .../jsdoc/tag/dictionary/definitions.js | 50 +++--- rhino_modules/jsdoc/tag/type.js | 166 +++++++++--------- rhino_modules/jsdoc/util/templateHelper.js | 4 +- 6 files changed, 170 insertions(+), 170 deletions(-) diff --git a/.jshintrc b/.jshintrc index 15cec50d..e7f544ef 100644 --- a/.jshintrc +++ b/.jshintrc @@ -36,7 +36,7 @@ "regexdash": false, "scripturl": true, "shadow": false, - "smarttabs": true, + "smarttabs": false, "sub": true, "supernew": true, "validthis": true, diff --git a/rhino_modules/jsdoc/doclet.js b/rhino_modules/jsdoc/doclet.js index af97491f..49c69814 100644 --- a/rhino_modules/jsdoc/doclet.js +++ b/rhino_modules/jsdoc/doclet.js @@ -1,14 +1,14 @@ /** @overview @author Michael Mathews - @license Apache License 2.0 - See file 'LICENSE.md' in this project. + @license Apache License 2.0 - See file 'LICENSE.md' in this project. */ /** - @module jsdoc/doclet - @requires jsdoc/tag - @requires jsdoc/name - @requires jsdoc/tag/dictionary + @module jsdoc/doclet + @requires jsdoc/tag + @requires jsdoc/name + @requires jsdoc/tag/dictionary */ var jsdoc = { @@ -51,17 +51,17 @@ function codetypeToKind(type) { function unwrap(docletSrc) { if (!docletSrc) { return ''; } - // note: keep trailing whitespace for @examples - // extra opening/closing stars are ignored - // left margin is considered a star and a space - // use the /m flag on regex to avoid having to guess what this platform's newline is - docletSrc = - docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars - .replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker - .replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker - .replace(/\s*\\Z$/g, ''); // remove end-marker + // note: keep trailing whitespace for @examples + // extra opening/closing stars are ignored + // left margin is considered a star and a space + // use the /m flag on regex to avoid having to guess what this platform's newline is + docletSrc = + docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars + .replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker + .replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker + .replace(/\s*\\Z$/g, ''); // remove end-marker - return docletSrc; + return docletSrc; } function split(docletSrc) { @@ -69,14 +69,14 @@ function split(docletSrc) { tagText, tagTitle; - // split out the basic tags, keep surrounding whitespace - // like: @tagTitle tagBody - docletSrc - .replace(/^(\s*)@(\S)/gm, '$1\\@$2') // replace splitter ats with an arbitrary sequence - .split('\\@') // then split on that arbitrary sequence - .forEach(function($) { - if ($) { - var parsedTag = $.match(/^(\S+)(:?\s+(\S[\s\S]*))?/); + // split out the basic tags, keep surrounding whitespace + // like: @tagTitle tagBody + docletSrc + .replace(/^(\s*)@(\S)/gm, '$1\\@$2') // replace splitter ats with an arbitrary sequence + .split('\\@') // then split on that arbitrary sequence + .forEach(function($) { + if ($) { + var parsedTag = $.match(/^(\S+)(:?\s+(\S[\s\S]*))?/); if (parsedTag) { // we don't need parsedTag[0] @@ -91,9 +91,9 @@ function split(docletSrc) { } } } - }); - - return tagSrcs; + }); + + return tagSrcs; } /** @@ -116,9 +116,9 @@ function toTags(docletSrc) { function fixDescription(docletSrc) { if (!/^\s*@/.test(docletSrc)) { - docletSrc = '@description ' + docletSrc; - } - return docletSrc; + docletSrc = '@description ' + docletSrc; + } + return docletSrc; } /** diff --git a/rhino_modules/jsdoc/src/scanner.js b/rhino_modules/jsdoc/src/scanner.js index 5ea22403..ea47ce89 100644 --- a/rhino_modules/jsdoc/src/scanner.js +++ b/rhino_modules/jsdoc/src/scanner.js @@ -1,15 +1,15 @@ /** - @module jsdoc/src/scanner - @requires module:common/fs - - @author Michael Mathews - @license Apache License 2.0 - See file 'LICENSE.md' in this project. + @module jsdoc/src/scanner + @requires module:common/fs + + @author Michael Mathews + @license Apache License 2.0 - See file 'LICENSE.md' in this project. */ var common = { - mixin: require('common/util').mixin, - events: require('common/events') + mixin: require('common/util').mixin, + events: require('common/events') }; var fs = require('fs'); @@ -23,38 +23,38 @@ exports.Scanner = function() { common.mixin(exports.Scanner.prototype, common.events); /** - Recursively searches the given searchPaths for js files. - @param {Array.} searchPaths - @param {number} [depth=1] - @fires sourceFileFound + Recursively searches the given searchPaths for js files. + @param {Array.} searchPaths + @param {number} [depth=1] + @fires sourceFileFound */ exports.Scanner.prototype.scan = function(searchPaths, depth, filter) { - var filePaths = [], - that = this; + var filePaths = [], + that = this; - searchPaths = searchPaths || []; - depth = depth || 1; + searchPaths = searchPaths || []; + depth = depth || 1; - searchPaths.forEach(function($) { - var filepath = decodeURIComponent($); + searchPaths.forEach(function($) { + var filepath = decodeURIComponent($); if ( fs.stat(filepath).isFile() ) { filePaths.push(filepath); } else { filePaths = filePaths.concat(fs.ls(filepath, depth)); - } - }); - - filePaths = filePaths.filter(function($) { - return filter.isIncluded($); - }); - - filePaths = filePaths.filter(function($) { - var e = { fileName: $ }; + } + }); + + filePaths = filePaths.filter(function($) { + return filter.isIncluded($); + }); + + filePaths = filePaths.filter(function($) { + var e = { fileName: $ }; that.fire('sourceFileFound', e); - - return !e.defaultPrevented; - }); + + return !e.defaultPrevented; + }); - return filePaths; + return filePaths; }; diff --git a/rhino_modules/jsdoc/tag/dictionary/definitions.js b/rhino_modules/jsdoc/tag/dictionary/definitions.js index e7060184..ffe749df 100644 --- a/rhino_modules/jsdoc/tag/dictionary/definitions.js +++ b/rhino_modules/jsdoc/tag/dictionary/definitions.js @@ -1,10 +1,10 @@ /*global app: true, env: true */ /** - Define tags that are known in JSDoc. - @module jsdoc/tag/dictionary/definitions + Define tags that are known in JSDoc. + @module jsdoc/tag/dictionary/definitions - @author Michael Mathews - @license Apache License 2.0 - See file 'LICENSE.md' in this project. + @author Michael Mathews + @license Apache License 2.0 - See file 'LICENSE.md' in this project. */ /** @private */ @@ -224,31 +224,31 @@ exports.defineTags = function(dictionary) { } }); - dictionary.defineTag('default', { + dictionary.defineTag('default', { onTagged: function(doclet, tag) { if (tag.value) { - doclet.defaultvalue = tag.value; - } - else if (doclet.meta && doclet.meta.code && typeof doclet.meta.code.value !== 'undefined') { - if (doclet.meta.code.type && /STRING|NUMBER|NAME|TRUE|FALSE/.test(doclet.meta.code.type)) { - doclet.defaultvalue = doclet.meta.code.value; - if (doclet.meta.code.type === 'STRING') { - // TODO: handle escaped quotes in values - doclet.defaultvalue = '"'+doclet.defaultvalue.replace(/"/g, '\\"')+'"'; - } - - if (doclet.defaultvalue === 'TRUE' || doclet.defaultvalue == 'FALSE') { - doclet.defaultvalue = doclet.defaultvalue.toLowerCase(); - } - } - else if (doclet.meta.code.type === 'NULL') { - // TODO: handle escaped quotes in values - doclet.defaultvalue = 'null'; - } - } + doclet.defaultvalue = tag.value; + } + else if (doclet.meta && doclet.meta.code && typeof doclet.meta.code.value !== 'undefined') { + if (doclet.meta.code.type && /STRING|NUMBER|NAME|TRUE|FALSE/.test(doclet.meta.code.type)) { + doclet.defaultvalue = doclet.meta.code.value; + if (doclet.meta.code.type === 'STRING') { + // TODO: handle escaped quotes in values + doclet.defaultvalue = '"'+doclet.defaultvalue.replace(/"/g, '\\"')+'"'; + } + + if (doclet.defaultvalue === 'TRUE' || doclet.defaultvalue == 'FALSE') { + doclet.defaultvalue = doclet.defaultvalue.toLowerCase(); + } + } + else if (doclet.meta.code.type === 'NULL') { + // TODO: handle escaped quotes in values + doclet.defaultvalue = 'null'; + } + } } }) - .synonym('defaultvalue'); + .synonym('defaultvalue'); dictionary.defineTag('deprecated', { // value is optional diff --git a/rhino_modules/jsdoc/tag/type.js b/rhino_modules/jsdoc/tag/type.js index 02d78bdf..62562a1d 100644 --- a/rhino_modules/jsdoc/tag/type.js +++ b/rhino_modules/jsdoc/tag/type.js @@ -1,133 +1,133 @@ /** - @module jsdoc/tag/type + @module jsdoc/tag/type - @author Michael Mathews - @license Apache License 2.0 - See file 'LICENSE.md' in this project. + @author Michael Mathews + @license Apache License 2.0 - See file 'LICENSE.md' in this project. */ function parseOptional(type) { - var optional = null; + var optional = null; - // {sometype=} means optional - if ( /(.+)=$/.test(type) ) { - type = RegExp.$1; - optional = true; - } + // {sometype=} means optional + if ( /(.+)=$/.test(type) ) { + type = RegExp.$1; + optional = true; + } - return { type: type, optional: optional }; + return { type: type, optional: optional }; } function parseNullable(type) { - var nullable = null; + var nullable = null; - // {?sometype} means nullable, {!sometype} means not-nullable - if ( /^([\?\!])(.+)$/.test(type) ) { - type = RegExp.$2; - nullable = (RegExp.$1 === '?')? true : false; - } + // {?sometype} means nullable, {!sometype} means not-nullable + if ( /^([\?\!])(.+)$/.test(type) ) { + type = RegExp.$2; + nullable = (RegExp.$1 === '?')? true : false; + } - return { type: type, nullable: nullable }; + return { type: type, nullable: nullable }; } function parseVariable(type) { - var variable = null; + var variable = null; - // {...sometype} means variable number of that type - if ( /^(\.\.\.)(.+)$/.test(type) ) { - type = RegExp.$2; - variable = true; - } + // {...sometype} means variable number of that type + if ( /^(\.\.\.)(.+)$/.test(type) ) { + type = RegExp.$2; + variable = true; + } - return { type: type, variable: variable }; + return { type: type, variable: variable }; } function parseTypes(type) { - var types = []; + var types = []; - if ( type.indexOf('|') !== -1 ) { - // remove optional parens, like: { ( string | number ) } - // see: http://code.google.com/closure/compiler/docs/js-for-compiler.html#types - if ( /^\s*\(\s*(.+)\s*\)\s*$/.test(type) ) { - type = RegExp.$1; - } - types = type.split(/\s*\|\s*/g); - } - else if (type) { - types = [type]; - } + if ( type.indexOf('|') !== -1 ) { + // remove optional parens, like: { ( string | number ) } + // see: http://code.google.com/closure/compiler/docs/js-for-compiler.html#types + if ( /^\s*\(\s*(.+)\s*\)\s*$/.test(type) ) { + type = RegExp.$1; + } + types = type.split(/\s*\|\s*/g); + } + else if (type) { + types = [type]; + } - return types; + return types; } /** @private */ function trim(text) { - return text.trim(); + return text.trim(); } function getTagType(tagValue) { - var type = '', - text = '', - count = 0; + var type = '', + text = '', + count = 0; - // type expressions start with '{' - if (tagValue[0] === '{') { - count++; + // type expressions start with '{' + if (tagValue[0] === '{') { + count++; - // find matching closer '}' - for (var i = 1, leni = tagValue.length; i < leni; i++) { - if (tagValue[i] === '\\') { i++; continue; } // backslash escapes the next character + // find matching closer '}' + for (var i = 1, leni = tagValue.length; i < leni; i++) { + if (tagValue[i] === '\\') { i++; continue; } // backslash escapes the next character - if (tagValue[i] === '{') { count++; } - else if (tagValue[i] === '}') { count--; } + if (tagValue[i] === '{') { count++; } + else if (tagValue[i] === '}') { count--; } - if (count === 0) { - type = trim(tagValue.slice(1, i)) - .replace(/\\\{/g, '{') // unescape escaped curly braces - .replace(/\\\}/g, '}'); - text = trim(tagValue.slice(i+1)); - break; - } - } - } - return { type: type, text: text }; + if (count === 0) { + type = trim(tagValue.slice(1, i)) + .replace(/\\\{/g, '{') // unescape escaped curly braces + .replace(/\\\}/g, '}'); + text = trim(tagValue.slice(i+1)); + break; + } + } + } + return { type: type, text: text }; } exports.getTagType = getTagType; /** - @param {string} tagValue - @returns {object} Hash with type, text, optional, nullable, and variable properties + @param {string} tagValue + @returns {object} Hash with type, text, optional, nullable, and variable properties */ exports.parse = function(tagValue) { - if (typeof tagValue !== 'string') { tagValue = ''; } - var type = '', - text = '', - tagType, - optional, - nullable, - variable; - - tagType = getTagType(tagValue); + if (typeof tagValue !== 'string') { tagValue = ''; } + var type = '', + text = '', + tagType, + optional, + nullable, + variable; + + tagType = getTagType(tagValue); type = tagType.type; if (tagType.type === '') { text = tagValue; } else { text = tagType.text; } - - optional = parseOptional(type); - nullable = parseNullable(type); - variable = parseVariable(type); - type = variable.type || nullable.type || optional.type; + + optional = parseOptional(type); + nullable = parseNullable(type); + variable = parseVariable(type); + type = variable.type || nullable.type || optional.type; - type = parseTypes(type); // make it into an array + type = parseTypes(type); // make it into an array - return { - type: type, - text: text, - optional: optional.optional, - nullable: nullable.nullable, - variable: variable.variable - }; + return { + type: type, + text: text, + optional: optional.optional, + nullable: nullable.nullable, + variable: variable.variable + }; }; diff --git a/rhino_modules/jsdoc/util/templateHelper.js b/rhino_modules/jsdoc/util/templateHelper.js index f30edaf0..2589b171 100644 --- a/rhino_modules/jsdoc/util/templateHelper.js +++ b/rhino_modules/jsdoc/util/templateHelper.js @@ -81,8 +81,8 @@ function toLink(longname, content) { } } else { - url = linkMap.longnameToUrl[longname]; - } + url = linkMap.longnameToUrl[longname]; + } content = content || longname; From 40871349be44ed07801c4b37ea1723b270f25277 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Tue, 10 Jul 2012 06:56:35 -0700 Subject: [PATCH 13/15] disable JSHint's "sub" relaxing option --- .jshintrc | 2 +- rhino_modules/jsdoc/borrow.js | 2 +- rhino_modules/jsdoc/src/parser.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.jshintrc b/.jshintrc index e7f544ef..bd0fa285 100644 --- a/.jshintrc +++ b/.jshintrc @@ -37,7 +37,7 @@ "scripturl": true, "shadow": false, "smarttabs": false, - "sub": true, + "sub": false, "supernew": true, "validthis": true, diff --git a/rhino_modules/jsdoc/borrow.js b/rhino_modules/jsdoc/borrow.js index b8674486..dd19dd59 100644 --- a/rhino_modules/jsdoc/borrow.js +++ b/rhino_modules/jsdoc/borrow.js @@ -23,7 +23,7 @@ exports.resolveBorrows = function(docs) { if (doc.borrowed) { doc.borrowed.forEach(function(b, i) { var lent = docs.index[b.from], // lent is an array - asName = b['as'] || b.from; + asName = b.as || b.from; if (lent) { var cloned = doop(lent); diff --git a/rhino_modules/jsdoc/src/parser.js b/rhino_modules/jsdoc/src/parser.js index c6db6a43..49a019bf 100644 --- a/rhino_modules/jsdoc/src/parser.js +++ b/rhino_modules/jsdoc/src/parser.js @@ -511,7 +511,7 @@ exports.Parser.prototype.astnodeToMemberof = function(node) { scope = scope.enclosingFunction; } //First check to see if we have a global scope alias - doclet = this.refs["__global__"]; + doclet = this.refs.__global__; if (doclet && doclet.meta.vars && hasOwnProp.call(doclet.meta.vars, basename)) { alias = doclet.meta.vars[basename]; if (alias !== false) { From 36143ca386ad8df346e3cf5f6b58f8da81cc149b Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Tue, 10 Jul 2012 06:58:25 -0700 Subject: [PATCH 14/15] disable JSHint's "super new" and valid this" relaxing options (no fixes required) --- .jshintrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.jshintrc b/.jshintrc index bd0fa285..3569e85e 100644 --- a/.jshintrc +++ b/.jshintrc @@ -38,8 +38,8 @@ "shadow": false, "smarttabs": false, "sub": false, - "supernew": true, - "validthis": true, + "supernew": false, + "validthis": false, "browser": false, "couch": false, From 3be03568868aa4e3abc109b825f79d0f740d0c7a Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Tue, 10 Jul 2012 07:11:06 -0700 Subject: [PATCH 15/15] add self to contributors --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index a105a3e7..128f8e2a 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,10 @@ { "name": "Jannon Frank", "email": "jannon@jannon.net" + }, + { + "name": "Jeff Williams", + "email": "jeffrey.l.williams@gmail.com" } ], "maintainers": [