build: Update eslint-config-wikimedia to 0.17.0

Remove variable shadowing, and fix some documentation.

Change-Id: I08a7cbbdc0a1a409f9c4415b36c62c89535e12eb
This commit is contained in:
Ed Sanders 2020-08-26 23:46:34 +01:00
parent f167bfc5b1
commit d36ffeaa3d
11 changed files with 4695 additions and 5138 deletions

View file

@ -297,7 +297,7 @@ CommentController.prototype.save = function ( comment, pageName ) {
// result in duplicate messages when the user retries. (T249071)
api: new mw.Api( { ajax: { timeout: 0 }, parameters: { formatversion: 2 } } )
}
).catch( function ( code, data ) {
).catch( function ( code, responseData ) {
// Better user-facing error message
if ( code === 'discussiontools-commentid-notfound' ) {
return $.Deferred().reject( 'discussiontools-commentid-notfound', { errors: [ {
@ -305,9 +305,9 @@ CommentController.prototype.save = function ( comment, pageName ) {
html: mw.message( 'discussiontools-error-comment-disappeared' ).parse()
} ] } ).promise();
}
return $.Deferred().reject( code, data ).promise();
} ).then( function ( data ) {
controller.update( data, comment, pageName, replyWidget );
return $.Deferred().reject( code, responseData ).promise();
} ).then( function ( responseData ) {
controller.update( responseData, comment, pageName, replyWidget );
} );
} );
};

View file

@ -9,7 +9,7 @@ var ThreadItem = require( './ThreadItem.js' );
* A comment item
*
* @class CommentItem
* @extends {ThreadItem}
* @extends ThreadItem
* @constructor
* @param {number} level
* @param {Object} range

View file

@ -4,7 +4,7 @@ var ThreadItem = require( './ThreadItem.js' );
* A heading item
*
* @class HeadingItem
* @extends {ThreadItem}
* @extends ThreadItem
* @constructor
* @param {Object} range
* @param {boolean} [placeholderHeading] Item doesn't correspond to a real heading (e.g. 0th section)

View file

@ -61,8 +61,8 @@ function getMessages( messages ) {
Parser.prototype.getTimestampRegexp = function ( format, digitsRegexp, tzAbbrs ) {
var s, p, num, code, endQuote, tzRegexp, regexp;
function regexpGroup( regexp ) {
return '(' + regexp + ')';
function regexpGroup( r ) {
return '(' + r + ')';
}
function regexpAlternateGroup( array ) {
@ -271,13 +271,13 @@ Parser.prototype.getTimestampParser = function ( format, digits, localTimezone,
hour = 0,
minute = 0,
tzAbbr,
i, code, text,
i, code2, text,
date;
for ( i = 0; i < matchingGroups.length; i++ ) {
code = matchingGroups[ i ];
code2 = matchingGroups[ i ];
text = match[ i + 1 ];
switch ( code ) {
switch ( code2 ) {
case 'xg':
monthIdx = getMessages( [
'january-gen', 'february-gen', 'march-gen', 'april-gen', 'may-gen', 'june-gen',
@ -505,10 +505,10 @@ function getTitleFromUrl( url ) {
* @private
* @param {Text} timestampNode Text node
* @param {Node} [until] Node to stop searching at
* @return {[Node[], string|null]} Result, a tuple contaning:
* - Sibling nodes comprising the signature, in reverse order (with
* @return {Array} Result, a tuple contaning:
* - {Node[]} Sibling nodes comprising the signature, in reverse order (with
* `timestampNode` or its parent node as the first element)
* - Username, null for unsigned comments
* - {string|null} Username, null for unsigned comments
*/
Parser.prototype.findSignature = function ( timestampNode, until ) {
var node, sigNodes, sigUsername, length, lastLinkNode, links, nodes;

View file

@ -14,7 +14,7 @@
*
* @class
* @extends ve.ce.LeafNode
* @mixins ve.ce.FocusableNode
* @mixes ve.ce.FocusableNode
*
* @constructor
* @param {DmMWPingNode} model Model to observe

View file

@ -11,7 +11,7 @@
*
* @class
* @extends ve.dm.LeafNode
* @mixins ve.dm.FocusableNode
* @mixes ve.dm.FocusableNode
*
* @constructor
* @param {Object} [element] Reference to element in linear model

View file

@ -8,7 +8,7 @@ function importRegistry( parent, child ) {
child.register( parent.registry[ name ] );
}
// Copy any new items when they're added
parent.on( 'register', function ( name, data ) {
parent.on( 'register', function ( n, data ) {
child.register( data );
} );
}

View file

@ -162,10 +162,10 @@ function ReplyWidget( commentController, comment, pageName, oldId, config ) {
this.checkboxesPromise = controller.getCheckboxesPromise( this.pageName, this.oldId );
this.checkboxesPromise.then( function ( checkboxes ) {
var name;
function trackCheckbox( name ) {
function trackCheckbox( n ) {
mw.track( 'dt.schemaVisualEditorFeatureUse', {
feature: 'dtReply',
action: 'checkbox-' + name
action: 'checkbox-' + n
} );
}
if ( checkboxes.checkboxFields ) {

View file

@ -163,26 +163,26 @@ function getFullyCoveredSiblings( item ) {
siblings = getCoveredSiblings( item );
function isIgnored( node ) {
function isIgnored( n ) {
// Ignore empty text nodes, and our own reply buttons
return ( node.nodeType === Node.TEXT_NODE && htmlTrim( node.textContent ) === '' ) ||
( node.className && node.className.indexOf( 'dt-init-replylink-buttons' ) !== -1 );
return ( n.nodeType === Node.TEXT_NODE && htmlTrim( n.textContent ) === '' ) ||
( n.className && n.className.indexOf( 'dt-init-replylink-buttons' ) !== -1 );
}
function firstNonemptyChild( node ) {
node = node.firstChild;
while ( node && isIgnored( node ) ) {
node = node.nextSibling;
function firstNonemptyChild( n ) {
n = n.firstChild;
while ( n && isIgnored( n ) ) {
n = n.nextSibling;
}
return node;
return n;
}
function lastNonemptyChild( node ) {
node = node.lastChild;
while ( node && isIgnored( node ) ) {
node = node.previousSibling;
function lastNonemptyChild( n ) {
n = n.lastChild;
while ( n && isIgnored( n ) ) {
n = n.previousSibling;
}
return node;
return n;
}
startMatches = false;

2299
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,8 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.16.2",
"grunt": "1.2.1",
"eslint-config-wikimedia": "0.17.0",
"grunt": "1.3.0",
"grunt-banana-checker": "0.9.0",
"grunt-eslint": "23.0.0",
"grunt-stylelint": "0.15.0",