build: Update linters and fix

Change-Id: Iec16f3330f94d38bb50492b7dcc9207786b964a4
This commit is contained in:
Ed Sanders 2023-11-28 16:10:47 +00:00
parent 8ab8831db7
commit f2f0ec2f65
8 changed files with 2144 additions and 945 deletions

View file

@ -297,6 +297,8 @@ Parser.prototype.getTimestampParser = function ( contLangVariant, format, digits
*/
function untransformDigits( text ) {
return Number( digits ? text.replace(
// digits list comes from site config so is trusted
// eslint-disable-next-line security/detect-non-literal-regexp
new RegExp( '[' + digits.join( '' ) + ']', 'g' ),
( m ) => digits.indexOf( m )
) : text );

View file

@ -9,7 +9,7 @@ span[ data-mw-comment-start ] {
margin-top: -1em;
}
// stylelint-disable-next-line selector-list-comma-newline-after
// stylelint-disable-next-line stylistic/selector-list-comma-newline-after
h1, h2, h3, h4, h5, h6 {
span[ data-mw-comment-end ] {
// Support: Safari

View file

@ -744,7 +744,7 @@ ReplyWidget.prototype.onWatchToggle = function ( isWatched ) {
* Handle key down events anywhere in the reply widget
*
* @param {jQuery.Event} e Key down event
* @return {boolean} Return false to prevent default event
* @return {boolean|undefined} Return false to prevent default event
*/
ReplyWidget.prototype.onKeyDown = function ( e ) {
if ( e.which === OO.ui.Keys.ESCAPE ) {

View file

@ -397,6 +397,8 @@ function getTitleFromUrl( url ) {
return parsedUrl.searchParams.get( 'title' );
}
// wgArticlePath is site config so is trusted
// eslint-disable-next-line security/detect-non-literal-regexp
var articlePathRegexp = new RegExp(
mw.util.escapeRegExp( mw.config.get( 'wgArticlePath' ) )
.replace( '\\$1', '(.*)' )
@ -542,7 +544,6 @@ function compareRanges( a, b ) {
) {
endToEnd = 0;
}
/* eslint-enable no-use-before-define */
if ( startToStart === 0 && endToEnd === 0 ) {
return 'equal';

3063
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,11 +6,11 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.25.1",
"eslint-config-wikimedia": "0.26.0",
"grunt": "1.6.1",
"grunt-banana-checker": "0.11.0",
"grunt-eslint": "24.1.0",
"grunt-stylelint": "0.18.0",
"stylelint-config-wikimedia": "0.15.0"
"grunt-banana-checker": "0.11.1",
"grunt-eslint": "24.3.0",
"grunt-stylelint": "0.19.0",
"stylelint-config-wikimedia": "0.16.1"
}
}

View file

@ -6,6 +6,7 @@
],
"rules": {
"no-implicit-globals": "off",
"max-len": "off"
"max-len": "off",
"security/detect-non-literal-require": "off"
}
}

View file

@ -32,7 +32,9 @@ QUnit.test( '#getAuthorsBelow/#getThreadItemsBelow', function ( assert ) {
);
assert.deepEqual(
threadItem.getThreadItemsBelow().map( function ( item ) { return item.id; } ),
threadItem.getThreadItemsBelow().map( function ( item ) {
return item.id;
} ),
caseItem.expectedThreadItemIdsBelow
);
} );