jenkins-bot has submitted this change and it was merged.
Change subject: Update to jscs 2.1; check jsduck annotations.
......................................................................
Update to jscs 2.1; check jsduck annotations.
The latest version of jscs does not run on node 0.8. Skip the lint
step when running `npm test` on node 0.8.
Change-Id: If67f8a429ae1463f2cd5ba1bfe7bf11be43a39f5
---
M .jscsrc
M lib/dom.t.TableFixups.js
M lib/ext.core.LinkHandler.js
M lib/ext.util.TokenCollector.js
M lib/jsapi.js
M lib/mediawiki.DOMUtils.js
M lib/mediawiki.Diff.js
M lib/mediawiki.SelectiveSerializer.js
M lib/mediawiki.Title.js
M lib/mediawiki.TokenTransformManager.js
M lib/mediawiki.Util.js
M lib/mediawiki.WikiConfig.js
M lib/mediawiki.parser.defines.js
M lib/mediawiki.parser.environment.js
M package.json
M tests/parserTests.js
16 files changed, 157 insertions(+), 132 deletions(-)
Approvals:
Arlolra: Looks good to me, approved
Jforrester: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/.jscsrc b/.jscsrc
index ba5d099..f47eded 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -1,5 +1,10 @@
{
"preset": "node-style-guide",
+ "jsDoc": {
+ "checkAnnotations": {
+ "preset": "jsduck5"
+ }
+ },
"requireCurlyBraces": [
"if",
"else",
diff --git a/lib/dom.t.TableFixups.js b/lib/dom.t.TableFixups.js
index 6859b51..55dc996 100644
--- a/lib/dom.t.TableFixups.js
+++ b/lib/dom.t.TableFixups.js
@@ -40,8 +40,6 @@
* DOM visitor that strips the double td for this test case:
* |{{echo|{{!}} Foo}}
*
- * @public
- *
* See https://phabricator.wikimedia.org/T52603
*/
TableFixups.prototype.stripDoubleTDs = function(node, env) {
@@ -246,8 +244,6 @@
/**
* T46498, second part of T52603
- *
- * @public
*
* Handle wikitext like
*
diff --git a/lib/ext.core.LinkHandler.js b/lib/ext.core.LinkHandler.js
index a9130e3..b531048 100644
--- a/lib/ext.core.LinkHandler.js
+++ b/lib/ext.core.LinkHandler.js
@@ -56,7 +56,7 @@
* - prefix: the original namespace or language/interwiki prefix without a
* colon escape
*
- * @returns {Object} The target info
+ * @return {Object} The target info
*/
WikiLinkHandler.prototype.getWikiLinkTargetInfo = function(token) {
var hrefInfo = Util.lookupKV(token.attribs, 'href');
@@ -352,7 +352,7 @@
* wikilink token and target. As a side effect, this method also extracts the
* link content tokens and returns them.
*
- * @returns {Array} Content tokens
+ * @return {Array} Content tokens
*/
WikiLinkHandler.prototype.addLinkAttributesAndGetContent = function(newTk,
token, target, buildDOMFragment) {
var title = target.title;
@@ -633,11 +633,11 @@
* @param {Object} opts The option hash from renderFile
* @param {boolean} isInline Whether the image is inline
* @param {boolean} isFloat Whether the image is floated
- * @returns {Object}
- * @returns {boolean} return.isInline Whether the image is inline after
handling options
- * @returns {boolean} return.isFloat Whether the image is floated after
handling options
- * @returns {Array} return.classes The list of classes for the wrapper
- * @returns {Array} return.styles The list of styles for the wrapper
+ * @return {Object}
+ * @return {boolean} return.isInline Whether the image is inline after
handling options
+ * @return {boolean} return.isFloat Whether the image is floated after
handling options
+ * @return {Array} return.classes The list of classes for the wrapper
+ * @return {Array} return.styles The list of styles for the wrapper
*/
function getWrapperInfo(opts) {
var format = getFormat(opts);
@@ -847,7 +847,7 @@
*
* @param {Array} tstream
* @param {string} prefix Anything that came before this part of the recursive
call stack
- * @returns {string}
+ * @return {string}
*/
function stringifyOptionTokens(tstream, prefix, env) {
var tokenType, tkHref, nextResult, optInfo, skipToEndOf;
diff --git a/lib/ext.util.TokenCollector.js b/lib/ext.util.TokenCollector.js
index d55cd51..65692e9 100644
--- a/lib/ext.util.TokenCollector.js
+++ b/lib/ext.util.TokenCollector.js
@@ -43,22 +43,20 @@
}
/**
- * @private
- *
* Register any collector with slightly lower priority than the start/end
token type
* XXX: This feels a bit hackish, a list-of-registrations per rank might be
* better.
*
* Don't make this delta much larger- could lead to conflicts in the
* ExtensionContentCollector for example.
+ * @private
*/
TokenCollector.prototype._anyDelta = 0.00000001;
/**
- * @private
- *
* Handle the delimiter token.
* XXX: Adjust to sync phase callback when that is modified!
+ * @private
*/
TokenCollector.prototype._onDelimiterToken = function(token, frame, cb) {
var haveOpenTag = this.scopeStack.length > 0;
@@ -133,11 +131,10 @@
};
/**
- * @private
- *
* Handle 'any' token in between delimiter tokens. Activated when
* encountering the delimiter token, and collects all tokens until the end
* token is reached.
+ * @private
*/
TokenCollector.prototype._onAnyToken = function(token, frame, cb) {
// Simply collect anything ordinary in between
diff --git a/lib/jsapi.js b/lib/jsapi.js
index 610bee5..d0f9add 100644
--- a/lib/jsapi.js
+++ b/lib/jsapi.js
@@ -576,7 +576,11 @@
},
},
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PComment._selector = 'COMMENT'; // non-standard selector
/**
@@ -617,7 +621,11 @@
// XXX include this.url, once it is a PNodeList
_children: { value: function() { return [this.title]; }, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PExtLink._selector = 'a[rel="mw:ExtLink"]';
/**
@@ -669,7 +677,11 @@
_children: { value: function() { return [this.title]; }, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PHeading._selector = 'h1,h2,h3,h4,h5,h6';
/**
@@ -711,7 +723,11 @@
this.normalized === target;
}, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PHtmlEntity._selector = '[typeof="mw:Entity"]';
/**
@@ -812,7 +828,11 @@
return c ? [ c ] : [];
}, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PMedia._selector = 'figure,[typeof~="mw:Image"]';
@@ -849,7 +869,11 @@
_children: { value: function() { return [this.contents]; }, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PTag._selector = '*'; // any otherwise-unmatched element
/**
@@ -1034,7 +1058,11 @@
return result;
}, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PTemplate._selector = '[typeof~="mw:Transclusion"]';
/**
@@ -1178,7 +1206,11 @@
this.value === target;
}, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PText._selector = 'TEXT'; // non-standard selector
/**
@@ -1221,7 +1253,11 @@
_children: { value: function() { return [this.text]; }, },
});
-/** @private @static @ignore */
+/**
+ * @ignore
+ * @static
+ * @private
+ */
PWikiLink._selector = 'a[rel="mw:WikiLink"]';
/**
diff --git a/lib/mediawiki.DOMUtils.js b/lib/mediawiki.DOMUtils.js
index 9b5880a..c0cf98c 100644
--- a/lib/mediawiki.DOMUtils.js
+++ b/lib/mediawiki.DOMUtils.js
@@ -21,8 +21,8 @@
/**
* @class DOMUtils
- * @singleton
* General DOM utilities
+ * @singleton
*/
var DU, DOMUtils;
DOMUtils = DU = {
@@ -401,10 +401,10 @@
*
* @param {Node} node
* @param {string} name
- * @returns {Object}
- * @returns {Mixed} return.value
- * @returns {boolean} return.modified If the value of the attribute
changed since we parsed the wikitext
- * @returns {boolean} return.fromsrc Whether we got the value from
source-based roundtripping
+ * @return {Object}
+ * @return {Mixed} return.value
+ * @return {boolean} return.modified If the value of the attribute
changed since we parsed the wikitext
+ * @return {boolean} return.fromsrc Whether we got the value from
source-based roundtripping
*/
getAttributeShadowInfo: function(node, name) {
var curVal = node.getAttribute(name);
@@ -442,7 +442,7 @@
/**
* Get the attributes on a node in an array of KV objects.
*
- * @returns {KV[]}
+ * @return {KV[]}
*/
getAttributeKVArray: function(node) {
var attribs = node.attributes;
@@ -459,7 +459,7 @@
* Doesn't include the ancestor in the returned path.
*
* @param {Node} ancestor Should be an ancestor of `node`
- * @returns {Node[]}
+ * @return {Node[]}
*/
pathToAncestor: function(node, ancestor) {
var path = [];
@@ -474,7 +474,7 @@
/**
* Build path from a node to the root of the document.
*
- * @returns {Node[]}
+ * @return {Node[]}
*/
pathToRoot: function(node) {
return this.pathToAncestor(node, null);
@@ -485,7 +485,7 @@
*
* @param {Node} sibling
* @param {boolean} left Whether to go backwards, i.e., use
previousSibling instead of nextSibling.
- * @returns {Node[]} Will not include the passed-in sibling.
+ * @return {Node[]} Will not include the passed-in sibling.
*/
pathToSibling: function(node, sibling, left) {
var path = [];
@@ -797,7 +797,7 @@
* indent-originated pre tag.
*
* @param {TextNode} textNode
- * @returns {number}
+ * @return {number}
*/
indentPreDSRCorrection: function(textNode) {
// NOTE: This assumes a text-node and doesn't check that it is
one.
@@ -1277,7 +1277,7 @@
*
* @param {TextNode} node
* @param {string} type The type for the wrapper span
- * @returns {Element} The wrapper span
+ * @return {Element} The wrapper span
*/
wrapTextInTypedSpan: function(node, type) {
var wrapperSpanNode = node.ownerDocument.createElement('span');
@@ -1294,7 +1294,7 @@
*
* @param {Node} node
* @param {string} type
- * @returns {Element} The new meta.
+ * @return {Element} The new meta.
*/
prependTypedMeta: function(node, type) {
var meta = node.ownerDocument.createElement('meta');
@@ -2258,7 +2258,7 @@
*
* @param {Node} doc
* @param {Object} options: flags smartQuote, innerXML, captureOffsets
- * @returns {Object}
+ * @return {Object}
*/
DOMUtils.serializeNode = function(doc, options) {
if (!options) { options = {}; }
@@ -2289,7 +2289,7 @@
*
* @param {Node} node
* @param {Object} options: flags smartQuote, innerHTML
- * @returns {string}
+ * @return {string}
*/
DOMUtils.serializeChildren = function(node, options) {
if (!options) {
@@ -2480,7 +2480,7 @@
*
* @param {String} out
* @param {Boolean} [parsoidOnly=false]
- * @returns {String}
+ * @return {String}
*/
DOMUtils.normalizeOut = function(out, parsoidOnly) {
if (typeof (out) === 'string') {
@@ -2553,7 +2553,7 @@
* Parse HTML, return the tree.
*
* @param {String} html
- * @returns {Node}
+ * @return {Node}
*/
DOMUtils.parseHTML = function(html) {
if (!html.match(/^<(?:!doctype|html|body)/i)) {
@@ -2592,7 +2592,7 @@
* Little helper function for encoding XML entities
*
* @param {string} string
- * @returns {string}
+ * @return {string}
*/
DOMUtils.encodeXml = function(string) {
return entities.encodeXML(string);
diff --git a/lib/mediawiki.Diff.js b/lib/mediawiki.Diff.js
index cc52b54..f2f2ab9 100644
--- a/lib/mediawiki.Diff.js
+++ b/lib/mediawiki.Diff.js
@@ -13,7 +13,7 @@
*
* @method
* @param {Array} diff The diff to refine
- * @returns {Array} The refined diff
+ * @return {Array} The refined diff
*/
// var refineDiff = function ( diff ) {
// // Attempt to accumulate consecutive add-delete pairs
diff --git a/lib/mediawiki.SelectiveSerializer.js
b/lib/mediawiki.SelectiveSerializer.js
index 9bc988e..f7d2eb7 100644
--- a/lib/mediawiki.SelectiveSerializer.js
+++ b/lib/mediawiki.SelectiveSerializer.js
@@ -14,12 +14,12 @@
/**
* @class
- * @constructor
*
* If we have the page source (this.env.page.src), we use the selective
* serialization method, only reporting the serialized wikitext for parts of
* the page that changed. Else, we fall back to serializing the whole DOM.
*
+ * @constructor
* @param {Object} options Options for the serializer.
* @param {MWParserEnvironment} options.env
*/
diff --git a/lib/mediawiki.Title.js b/lib/mediawiki.Title.js
index 15a5d84..6e6ceeb 100644
--- a/lib/mediawiki.Title.js
+++ b/lib/mediawiki.Title.js
@@ -39,15 +39,14 @@
}
/**
- * @method
- * @static
- *
* Take text, e.g. from a wikilink, and make a Title object from it.
* Somewhat superseded by WikiLinkHandler.getWikiLinkTargetInfo.
*
+ * @method
* @param {MWParserEnvironment} env
* @param {string} text The prefixed text.
- * @returns {Title}
+ * @return {Title}
+ * @static
*/
Title.fromPrefixedText = function(env, text) {
text = env.normalizeTitle(text);
@@ -72,7 +71,7 @@
*
* Make a full link out of a title.
*
- * @returns {string}
+ * @return {string}
*/
Title.prototype.makeLink = function() {
// XXX: links always point to the canonical namespace name.
@@ -94,7 +93,7 @@
*
* Get the text of the title, like you might see in a wikilink.
*
- * @returns {string}
+ * @return {string}
*/
Title.prototype.getPrefixedText = function() {
var text = this.key.split("#")[0]; // drop the fragment
@@ -124,7 +123,7 @@
*
* Determine whether the namespace is the File namespace.
*
- * @returns {boolean}
+ * @return {boolean}
*/
Namespace.prototype.isFile = function() {
return this.id === this.env.conf.wiki.canonicalNamespaces.file;
@@ -135,7 +134,7 @@
*
* Determine whether the namespace is the Category namespace.
*
- * @returns {boolean}
+ * @return {boolean}
*/
Namespace.prototype.isCategory = function() {
return this.id === this.env.conf.wiki.canonicalNamespaces.category;
@@ -146,7 +145,7 @@
*
* Determine the default name of the namespace.
*
- * @returns {string/undefined}
+ * @return {string|undefined}
*/
Namespace.prototype.getDefaultName = function() {
var ns = this.env.conf.wiki.namespaceNames[this.id.toString()];
diff --git a/lib/mediawiki.TokenTransformManager.js
b/lib/mediawiki.TokenTransformManager.js
index e5f26ba..bc7aad0 100644
--- a/lib/mediawiki.TokenTransformManager.js
+++ b/lib/mediawiki.TokenTransformManager.js
@@ -303,12 +303,11 @@
};
/**
- * @method
- * @private
- *
* Callback for async returns from head of TokenAccumulator chain
*
+ * @method
* @param {Object} ret The chunk we're returning from the transform.
+ * @private
*/
AsyncTokenTransformManager.prototype.emitChunk = function(ret) {
this.env.dp('AsyncTokenTransformManager.emitChunk', ret);
@@ -363,13 +362,12 @@
};
/**
- * @method
- * @private
- *
* Transform and expand tokens. Transformed token chunks will be emitted in
* the 'chunk' event.
*
+ * @method
* @param {Array} tokens
+ * @private
*/
AsyncTokenTransformManager.prototype.onChunk = function(tokens) {
@@ -398,12 +396,11 @@
};
/**
- * @private
- *
* Callback for the end event emitted from the tokenizer.
* Either signals the end of input to the tail of an ongoing asynchronous
* processing pipeline, or directly emits 'end' if the processing was fully
* synchronous.
+ * @private
*/
AsyncTokenTransformManager.prototype.onEndEvent = function() {
if (this.tailAccumulator) {
@@ -520,9 +517,9 @@
* associated with it.
* @param {Function} parentCB
* Callback for asynchronous results
- * @returns {Object}
- * @returns {Array} return.tokens
- * @returns {boolean|TokenAccumulator} return.async
+ * @return {Object}
+ * @return {Array} return.tokens
+ * @return {boolean|TokenAccumulator} return.async
* A falsy value or the tail TokenAccumulator
*/
AsyncTokenTransformManager.prototype.transformTokens = function(tokens,
parentCB) {
@@ -714,14 +711,14 @@
};
/**
- * @method
- * @private
- *
* Callback for async transforms
*
* Converts direct callbacks into a synchronous return by collecting the
* results in s.res. Re-start transformTokens for any async returns, and calls
* the provided asyncCB (TokenAccumulator._returnTokens normally).
+ *
+ * @method
+ * @private
*/
AsyncTokenTransformManager.prototype.maybeSyncReturn = function(s, cbs, ret) {
@@ -942,12 +939,11 @@
/**
- * @private
- *
* Callback for the end event emitted from the tokenizer.
* Either signals the end of input to the tail of an ongoing asynchronous
* processing pipeline, or directly emits 'end' if the processing was fully
* synchronous.
+ * @private
*/
SyncTokenTransformManager.prototype.onEndEvent = function() {
// This phase is fully synchronous, so just pass the end along and
prepare
@@ -1067,9 +1063,8 @@
};
/**
- * @private
- *
* Callback for async argument value expansions
+ * @private
*/
AttributeTransformManager.prototype._returnAttributeValue = function(ref,
tokens) {
this.manager.env.dp('check _returnAttributeValue: ', ref, tokens);
@@ -1081,9 +1076,8 @@
};
/**
- * @private
- *
* Callback for async argument key expansions
+ * @private
*/
AttributeTransformManager.prototype._returnAttributeKey = function(ref,
tokens) {
this.manager.env.dp('check _returnAttributeKey: ', ref, tokens);
@@ -1109,7 +1103,6 @@
* and pass them to whoever wanted them (another sibling or a parent).
*
* @class
- * @public
* @constructor
* @param {TokenTransformManager} manager
* @param {Function} parentCB The callback to call after we've finished
accumulating.
@@ -1187,7 +1180,7 @@
* @param {Object} ret
* @param {Array} ret.tokens
* @param {boolean} ret.async
- * @returns {Mixed} New parent callback for caller or falsy value
+ * @return {Mixed} New parent callback for caller or falsy value
*/
TokenAccumulator.prototype.receiveToksFromChild = function(ret) {
ret = verifyTokensIntegrity(this.manager.env, ret, false);
@@ -1230,7 +1223,7 @@
* @param {Object} ret
* @param {Array} ret.tokens
* @param {boolean} ret.async
- * @returns {Mixed} new parent callback for caller or falsy value
+ * @return {Mixed} new parent callback for caller or falsy value
*/
TokenAccumulator.prototype.receiveToksFromSibling = function(ret) {
ret = verifyTokensIntegrity(this.manager.env, ret, false);
@@ -1432,9 +1425,8 @@
Object.freeze(Frame.prototype._eofTkList[0]);
/**
- * @private
- *
* Event handler for chunk conversion pipelines
+ * @private
*/
Frame.prototype.onThunkEvent = function(state, notYetDone, ret) {
if (notYetDone) {
diff --git a/lib/mediawiki.Util.js b/lib/mediawiki.Util.js
index 80d90a7..9e5d5ab 100644
--- a/lib/mediawiki.Util.js
+++ b/lib/mediawiki.Util.js
@@ -37,7 +37,7 @@
*
* @param {Object} parsoidConfig The config to modify.
* @param {Object} opts The options object to use for setting the debug
flags.
- * @returns {Object} The modified object.
+ * @return {Object} The modified object.
*/
setDebuggingFlags: function(parsoidConfig, opts) {
// Handle the --help options
@@ -186,7 +186,7 @@
*
* @param {Object} parsoidConfig The config to modify.
* @param {Object} opts The options object to use for setting the debug
flags.
- * @returns {Object} The modified object.
+ * @return {Object} The modified object.
*/
setTemplatingAndProcessingFlags: function(parsoidConfig, opts) {
[
@@ -373,7 +373,7 @@
*
* @param {Object} tgt The object to modify.
* @param {Object} subject The object to extend tgt with. Add more
arguments to the function call to chain more extensions.
- * @returns {Object} The modified object.
+ * @return {Object} The modified object.
*/
extendProps: function() {
function internalExtend(target, obj) {
@@ -1319,7 +1319,7 @@
* Check whether some text is a valid link trail.
*
* @param {string} text
- * @returns {boolean}
+ * @return {boolean}
*/
Util.isLinkTrail = function(text) {
if (text && text.match && text.match(this.linkTrailRegex)) {
@@ -1339,7 +1339,7 @@
* Used by the LinkHandler and the WikitextSerializer.
*
* @param {string} target
- * @returns {string}
+ * @return {string}
*/
Util.stripPipeTrickChars = function(text) {
// TODO: get this from somewhere else, hard-coding is fun but
ultimately bad
@@ -1376,7 +1376,7 @@
* Used by WikiConfig.
*
* @param {string} non-normalized namespace name
- * @returns {string}
+ * @return {string}
*/
Util.normalizeNamespaceName = function(name) {
return name.toLowerCase().replace(' ', '_');
@@ -1389,7 +1389,7 @@
* Decode HTML5 entities in text.
*
* @param {string} text
- * @returns {string}
+ * @return {string}
*/
Util.decodeEntities = function(text) {
return entities.decodeHTML5(text);
@@ -1402,7 +1402,7 @@
* Entity-escape anything that would decode to a valid HTML entity
*
* @param {string} text
- * @returns {string}
+ * @return {string}
*/
Util.escapeEntities = function(text) {
// [CSA] replace with entities.encode( text, 2 )?
diff --git a/lib/mediawiki.WikiConfig.js b/lib/mediawiki.WikiConfig.js
index 15c9db1..ec39fc9 100644
--- a/lib/mediawiki.WikiConfig.js
+++ b/lib/mediawiki.WikiConfig.js
@@ -484,7 +484,7 @@
* Get the canonical name of a magic word alias.
*
* @param {string} alias
- * @returns {string}
+ * @return {string}
*/
WikiConfig.prototype.getMagicWordIdFromAlias = function(alias) {
if (this.magicWords.hasOwnProperty(alias)) {
@@ -498,7 +498,7 @@
* Get canonical magicword name for the input word
*
* @param {string} word
- * @returns {string}
+ * @return {string}
*/
WikiConfig.prototype.magicWordCanonicalName = function(word) {
return this.getMagicWordIdFromAlias(word) ||
this.getMagicWordIdFromAlias(word.toLowerCase());
@@ -545,7 +545,7 @@
* Get a matcher function for fetching values out of interpolated magic words,
i.e. those with $1 in their aliases.
*
* @param {Map} optionsMap The map of options you want to check for (e.g. the
map of all interpolated image options)
- * @returns {Function}
+ * @return {Function}
*/
WikiConfig.prototype.getMagicPatternMatcher = function(optionsMap) {
var aliases, regex;
@@ -603,7 +603,7 @@
*
* @param {string} alias
* @param {string} value
- * @returns {string}
+ * @return {string}
*/
WikiConfig.prototype.replaceInterpolatedMagicWord = function(alias, value) {
return alias.replace(/\$1/, value);
diff --git a/lib/mediawiki.parser.defines.js b/lib/mediawiki.parser.defines.js
index 8452fe2..e43a3e7 100644
--- a/lib/mediawiki.parser.defines.js
+++ b/lib/mediawiki.parser.defines.js
@@ -34,9 +34,9 @@
/**
* @class Token
- * @abstract
*
* Catch-all class for all token types.
+ * @abstract
*/
/**
@@ -145,10 +145,10 @@
* context to be set to a token.
*
* @param {string} name
- * @returns {Object} Information about the shadow info attached to this
attribute.
- * @returns {Mixed} return.value
- * @returns {boolean} return.modified Whether the attribute was changed
between parsing and now.
- * @returns {boolean} return.fromsrc Whether we needed to get the
source of the attribute to round-trip it.
+ * @return {Object} Information about the shadow info attached to this
attribute.
+ * @return {Mixed} return.value
+ * @return {boolean} return.modified Whether the attribute was changed
between parsing and now.
+ * @return {boolean} return.fromsrc Whether we needed to get the source
of the attribute to round-trip it.
*/
getAttributeShadowInfo: function(name) {
requireUtil();
@@ -263,7 +263,7 @@
*
* Determine whether the current token was an HTML tag in wikitext.
*
- * @returns {boolean}
+ * @return {boolean}
*/
isHTMLTag: function() {
return this.dataAttribs.stx === 'html';
@@ -275,7 +275,7 @@
* Clone a token.
*
* @param {boolean} cloneAttribs Whether to clone attributes too.
- * @returns {Token}
+ * @return {Token}
*/
clone: function(cloneAttribs) {
requireUtil();
@@ -303,7 +303,7 @@
* Get the wikitext source of a token.
*
* @param {MWParserEnvironment} env
- * @returns {string}
+ * @return {string}
*/
getWTSource: function(env) {
var tsr = this.dataAttribs.tsr;
@@ -334,7 +334,7 @@
/**
* @method
- * @returns {string}
+ * @return {string}
*/
TagTk.prototype.toJSON = function() {
return Object.assign({ type: 'TagTk' }, this);
@@ -342,7 +342,7 @@
/**
* @method
- * @returns {string}
+ * @return {string}
*/
TagTk.prototype.defaultToString = function(t) {
return "<" + this.name + ">";
@@ -372,7 +372,7 @@
/**
* @method
* @param {boolean} compact Whether to return the full HTML, or just the tag
name.
- * @returns {string}
+ * @return {string}
*/
TagTk.prototype.toString = function(compact) {
requireUtil();
@@ -419,7 +419,7 @@
/**
* @method
- * @returns {string}
+ * @return {string}
*/
EndTagTk.prototype.toJSON = function() {
return Object.assign({ type: 'EndTagTk' }, this);
@@ -427,7 +427,7 @@
/**
* @method
- * @returns {string}
+ * @return {string}
*/
EndTagTk.prototype.toString = function() {
if (this.isHTMLTag()) {
@@ -463,7 +463,7 @@
/**
* @method
- * @returns {string}
+ * @return {string}
*/
SelfclosingTagTk.prototype.toJSON = function() {
return Object.assign({ type: 'SelfclosingTagTk' }, this);
@@ -475,9 +475,9 @@
* @param {Object} arg
* @param {string} indent The string by which we should indent each new line.
* @param {string} indentIncrement The string we should add to each level of
indentation.
- * @returns {Object}
- * @returns {boolean} return.present Whether there is any non-empty string
representation of these tokens.
- * @returns {string} return.str
+ * @return {Object}
+ * @return {boolean} return.present Whether there is any non-empty string
representation of these tokens.
+ * @return {string} return.str
*/
SelfclosingTagTk.prototype.multiTokenArgToString = function(key, arg, indent,
indentIncrement) {
requireUtil();
@@ -503,7 +503,7 @@
* @param {string} indent The string by which to indent every line.
* @param {string} indentIncrement The string to add to every successive level
of indentation.
* @param {number} startAttrIndex Where to start converting attributes.
- * @returns {string}
+ * @return {string}
*/
SelfclosingTagTk.prototype.attrsToString = function(indent, indentIncrement,
startAttrIndex) {
var buf = [];
@@ -532,7 +532,7 @@
* @method
* @param {boolean} compact Whether to return the full HTML, or just the tag
name.
* @param {string} indent The string by which to indent each line.
- * @returns {string}
+ * @return {string}
*/
SelfclosingTagTk.prototype.defaultToString = function(compact, indent) {
requireUtil();
@@ -613,7 +613,7 @@
* @method
* @param {boolean} compact Whether to return the full HTML, or just the tag
name.
* @param {string} indent The string by which to indent each line.
- * @returns {string}
+ * @return {string}
*/
SelfclosingTagTk.prototype.toString = function(compact, indent) {
if (this.isHTMLTag()) {
@@ -650,7 +650,7 @@
*
* Convert the token to JSON.
*
- * @returns {string} JSON string.
+ * @return {string} JSON string.
*/
toJSON: function() {
return Object.assign({ type: 'NlTk' }, this);
@@ -661,7 +661,7 @@
*
* Convert the token to a simple string.
*
- * @returns {"\\n"}
+ * @return {"\\n"}
*/
toString: function() {
return "\\n";
@@ -672,7 +672,7 @@
*
* Tell the caller that this isn't an HTML tag.
*
- * @returns {boolean} Always false
+ * @return {boolean} Always false
*/
isHTMLTag: function() {
return false;
diff --git a/lib/mediawiki.parser.environment.js
b/lib/mediawiki.parser.environment.js
index c0c8e9a..e7fb009 100644
--- a/lib/mediawiki.parser.environment.js
+++ b/lib/mediawiki.parser.environment.js
@@ -228,17 +228,16 @@
};
/**
- * @method
- * @static
- *
* Alternate constructor for MWParserEnvironments
*
+ * @method
* @param {ParsoidConfig|null} parsoidConfig
* @param {WikiConfig|null} wikiConfig
* @param {Object} options
* @param {Function} cb
* @param {Error} cb.err
* @param {MWParserEnvironment} cb.env The finished environment object
+ * @static
*/
MWParserEnvironment.getParserEnv = function(parsoidConfig, wikiConfig,
options, cb) {
// Get that wiki's config
@@ -514,12 +513,11 @@
};
/**
- * @method
- * @private
- *
* Generate a UID
*
- * @returns {number}
+ * @method
+ * @return {number}
+ * @private
*/
MWParserEnvironment.prototype.generateUID = function() {
return this.uid++;
diff --git a/package.json b/package.json
index 894f601..26f9451 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"colors": "^1.1.2",
"coveralls": "^2.11.2",
"istanbul": "^0.3.17",
- "jscs": "^1.13.1",
+ "jscs": "^2.1.0",
"jshint": "^2.8.0",
"mocha": "^2.2.5",
"supertest": "^1.0.1"
@@ -40,6 +40,7 @@
},
"scripts": {
"lint": "npm run dump-tokenizer && npm run jscs && npm run jshint",
+ "lint-no-0.8": "node -e
'process.exit(/v0[.][0-8][.]/.test(process.version) ? 0 : 1)' || npm run lint",
"start": "node api/server.js",
"jshint": "jshint api lib tests",
"jscs": "jscs api lib tests",
@@ -47,7 +48,7 @@
"dump-tokenizer": "node lib/mediawiki.tokenizer.peg.js",
"mocha": "mocha --opts tests/mocha/mocha.opts tests/mocha",
"parserTests": "node tests/parserTests.js --wt2html --wt2wt --html2wt
--html2html --selser --no-color --quiet --blacklist",
- "test": "npm run lint && npm run parserTests && npm run mocha",
+ "test": "npm run lint-no-0.8 && npm run parserTests && npm run mocha",
"cover-mocha": "istanbul cover _mocha --dir ./coverage/mocha -- --opts
tests/mocha/mocha.opts tests/mocha",
"cover-parserTests": "istanbul cover tests/parserTests.js --dir
./coverage/parserTests -- --wt2html --wt2wt --html2wt --html2html --selser
--no-color --quiet --blacklist",
"coverage": "npm run cover-mocha && npm run cover-parserTests && istanbul
report",
diff --git a/tests/parserTests.js b/tests/parserTests.js
index fe8212a..72ca5b1 100755
--- a/tests/parserTests.js
+++ b/tests/parserTests.js
@@ -78,10 +78,11 @@
/**
* @class
- * @private
- * @singleton
*
* Main class for the test environment.
+ *
+ * @singleton
+ * @private
*/
function ParserTests() {
var i;
@@ -136,7 +137,7 @@
*
* Get the options from the command line.
*
- * @returns {Object}
+ * @return {Object}
*/
ParserTests.prototype.getOpts = function() {
@@ -295,7 +296,7 @@
* Get an object holding our tests cases. Eventually from a cache file
*
* @param {Object} argv
- * @returns {Object}
+ * @return {Object}
*/
ParserTests.prototype.getTests = function(argv) {
// double check that test file is up-to-date with upstream
@@ -369,7 +370,7 @@
* Parse content of tests case file given as plaintext
*
* @param {string} content
- * @returns {Array}
+ * @return {Array}
*/
ParserTests.prototype.parseTestCase = function(content) {
try {
@@ -448,7 +449,7 @@
*
* @param {Array} allChanges Already-tried changes
* @param {Array} change Candidate change
- * @returns {boolean}
+ * @return {boolean}
*/
ParserTests.prototype.isDuplicateChangeTree = function(allChanges, change) {
if (!Array.isArray(allChanges)) {
@@ -1263,7 +1264,7 @@
* @param {Function} getDiff Returns a string showing the diff(s) for the test.
* @param {Object} getDiff.actual
* @param {Object} getDiff.expected
- * @returns {string}
+ * @return {string}
*/
ParserTests.prototype.getActualExpected = function(actual, expected, getDiff) {
var returnStr = '';
@@ -2147,7 +2148,7 @@
*
* @inheritdoc ParserTests#getActualExpected.
*
- * @returns {string} The XML representation of the actual and expected
outputs
+ * @return {string} The XML representation of the actual and expected
outputs
*/
var getActualExpectedXML = function(actual, expected, getDiff) {
var returnStr = '';
--
To view, visit https://gerrit.wikimedia.org/r/232182
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If67f8a429ae1463f2cd5ba1bfe7bf11be43a39f5
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits