build: Updating npm dependencies

* eslint-config-wikimedia: 0.27.0 → 0.28.0
* grunt-stylelint: 0.19.0 → 0.20.0
* stylelint-config-wikimedia: 0.16.1 → 0.17.1

Change-Id: I0f57a77c738f26a0cda10af9f3891d4beee447d9
This commit is contained in:
libraryupgrader 2024-06-07 09:00:28 +00:00
parent 3e2df70e2e
commit 830bfffa5c
7 changed files with 1526 additions and 1902 deletions

View file

@ -4,7 +4,7 @@
const attrName = 'data-revision-id'; const attrName = 'data-revision-id';
function reloadThankedState() { function reloadThankedState() {
$( 'a.mw-thanks-thank-link' ).each( function ( idx, el ) { $( 'a.mw-thanks-thank-link' ).each( ( idx, el ) => {
const $thankLink = $( el ); const $thankLink = $( el );
if ( mw.thanks.thanked.contains( $thankLink.attr( attrName ) ) ) { if ( mw.thanks.thanked.contains( $thankLink.attr( attrName ) ) ) {
$thankLink.before( $thankLink.before(
@ -54,13 +54,13 @@
( new mw.Api() ).postWithToken( 'csrf', apiParams ) ( new mw.Api() ).postWithToken( 'csrf', apiParams )
.then( .then(
// Success // Success
function () { () => {
$thankElement.before( mw.message( 'thanks-thanked', mw.user, $thankLink.data( 'recipient-gender' ) ).escaped() ); $thankElement.before( mw.message( 'thanks-thanked', mw.user, $thankLink.data( 'recipient-gender' ) ).escaped() );
$thankElement.remove(); $thankElement.remove();
mw.thanks.thanked.push( $thankLink.attr( attrName ) ); mw.thanks.thanked.push( $thankLink.attr( attrName ) );
}, },
// Fail // Fail
function ( errorCode ) { ( errorCode ) => {
// If error occurred, enable attempting to thank again // If error occurred, enable attempting to thank again
$thankLink.data( 'clickDisabled', false ); $thankLink.data( 'clickDisabled', false );
let msg; let msg;
@ -123,11 +123,11 @@
$( reloadThankedState ); $( reloadThankedState );
} }
$( function () { $( () => {
addActionToLinks( $( 'body' ) ); addActionToLinks( $( 'body' ) );
} ); } );
mw.hook( 'wikipage.diff' ).add( function ( $content ) { mw.hook( 'wikipage.diff' ).add( ( $content ) => {
addActionToLinks( $content ); addActionToLinks( $content );
} ); } );
}() ); }() );

View file

@ -11,12 +11,12 @@
} }
function reloadThankedState() { function reloadThankedState() {
$( 'a.mw-thanks-flow-thank-link' ).each( function ( idx, el ) { $( 'a.mw-thanks-flow-thank-link' ).each( ( idx, el ) => {
const $thankLink = $( el ); const $thankLink = $( el );
if ( mw.thanks.thanked.contains( $thankLink.closest( '.flow-post' ).attr( attrName ), cookieName ) ) { if ( mw.thanks.thanked.contains( $thankLink.closest( '.flow-post' ).attr( attrName ), cookieName ) ) {
const author = findPostAuthorFromThankLink( $thankLink ); const author = findPostAuthorFromThankLink( $thankLink );
mw.thanks.getUserGender( author ) mw.thanks.getUserGender( author )
.done( function ( recipientGender ) { .done( ( recipientGender ) => {
$thankLink.before( $thankLink.before(
$thankedLabel $thankedLabel
.clone() .clone()
@ -37,13 +37,13 @@
} ) } )
.then( .then(
// Success // Success
function () { () => {
const author = findPostAuthorFromThankLink( $thankLink ); const author = findPostAuthorFromThankLink( $thankLink );
// Get the user who was thanked (for gender purposes) // Get the user who was thanked (for gender purposes)
return mw.thanks.getUserGender( author ); return mw.thanks.getUserGender( author );
}, },
// Failure // Failure
function ( errorCode ) { ( errorCode ) => {
switch ( errorCode ) { switch ( errorCode ) {
case 'ratelimited': case 'ratelimited':
OO.ui.alert( mw.msg( 'thanks-error-ratelimited', mw.user ) ); OO.ui.alert( mw.msg( 'thanks-error-ratelimited', mw.user ) );
@ -53,7 +53,7 @@
} }
} }
) )
.then( function ( recipientGender ) { .then( ( recipientGender ) => {
const $thankUserLabel = $thankedLabel.clone(); const $thankUserLabel = $thankedLabel.clone();
$thankUserLabel.append( $thankUserLabel.append(
mw.msg( 'thanks-button-thanked', mw.user, recipientGender ) mw.msg( 'thanks-button-thanked', mw.user, recipientGender )

View file

@ -60,15 +60,11 @@
usprop: 'gender' usprop: 'gender'
} ) } )
.then( .then(
function ( result ) { ( result ) => (
return ( result.query.users[ 0 ] &&
result.query.users[ 0 ] &&
result.query.users[ 0 ].gender result.query.users[ 0 ].gender
) || 'unknown'; ) || 'unknown',
}, () => 'unknown'
function () {
return 'unknown';
}
); );
} }
}; };

View file

@ -47,7 +47,7 @@
$elements = $(), $elements = $(),
self = this; self = this;
selectors.forEach( function ( sel ) { selectors.forEach( ( sel ) => {
$elements = $elements.add( jQueryFindWithParent( self, sel ) ); $elements = $elements.add( jQueryFindWithParent( self, sel ) );
} ); } );

3374
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,13 +6,13 @@
"test": "grunt test" "test": "grunt test"
}, },
"devDependencies": { "devDependencies": {
"eslint-config-wikimedia": "0.27.0", "eslint-config-wikimedia": "0.28.0",
"grunt": "1.6.1", "grunt": "1.6.1",
"grunt-banana-checker": "0.13.0", "grunt-banana-checker": "0.13.0",
"grunt-contrib-watch": "1.1.0", "grunt-contrib-watch": "1.1.0",
"grunt-eslint": "24.3.0", "grunt-eslint": "24.3.0",
"grunt-stylelint": "0.19.0", "grunt-stylelint": "0.20.0",
"stylelint-config-wikimedia": "0.16.1", "stylelint-config-wikimedia": "0.17.1",
"svgo": "3.2.0" "svgo": "3.2.0"
} }
} }

View file

@ -5,7 +5,7 @@ QUnit.module( 'Thanks thank', QUnit.newMwEnvironment( {
} }
} ) ); } ) );
QUnit.test( 'thanked cookie', function ( assert ) { QUnit.test( 'thanked cookie', ( assert ) => {
const thankId = '8'; const thankId = '8';
const thankIdNonExisting = '13'; const thankIdNonExisting = '13';
@ -26,17 +26,17 @@ QUnit.test( 'thanked cookie', function ( assert ) {
} ); } );
QUnit.test( 'gets user gender', function ( assert ) { QUnit.test( 'gets user gender', function ( assert ) {
this.server.respond( /user1/, function ( request ) { this.server.respond( /user1/, ( request ) => {
request.respond( 200, { 'Content-Type': 'application/json' }, request.respond( 200, { 'Content-Type': 'application/json' },
'{"batchcomplete":"","query":{"users":[{"userid":1,"name":"user1","gender":"male"}]}}' '{"batchcomplete":"","query":{"users":[{"userid":1,"name":"user1","gender":"male"}]}}'
); );
} ); } );
this.server.respond( /user2/, function ( request ) { this.server.respond( /user2/, ( request ) => {
request.respond( 200, { 'Content-Type': 'application/json' }, request.respond( 200, { 'Content-Type': 'application/json' },
'{"batchcomplete":"","query":{"users":[{"userid":2,"name":"user2","gender":"unknown"}]}}' '{"batchcomplete":"","query":{"users":[{"userid":2,"name":"user2","gender":"unknown"}]}}'
); );
} ); } );
this.server.respond( /user3/, function ( request ) { this.server.respond( /user3/, ( request ) => {
request.respond( 200, { 'Content-Type': 'application/json' }, request.respond( 200, { 'Content-Type': 'application/json' },
'{"batchcomplete":"","query":{"users":[{"name":"user3","missing":""}]}}' '{"batchcomplete":"","query":{"users":[{"name":"user3","missing":""}]}}'
); );
@ -47,15 +47,15 @@ QUnit.test( 'gets user gender', function ( assert ) {
const nonExistingUser = mw.thanks.getUserGender( 'user3' ); const nonExistingUser = mw.thanks.getUserGender( 'user3' );
const done = assert.async( 3 ); const done = assert.async( 3 );
maleUser.then( function ( recipientGender ) { maleUser.then( ( recipientGender ) => {
assert.strictEqual( recipientGender, 'male', 'gender for male user' ); assert.strictEqual( recipientGender, 'male', 'gender for male user' );
done(); done();
} ); } );
unknownGenderUser.then( function ( recipientGender ) { unknownGenderUser.then( ( recipientGender ) => {
assert.strictEqual( recipientGender, 'unknown', 'gender for unknown-gender user' ); assert.strictEqual( recipientGender, 'unknown', 'gender for unknown-gender user' );
done(); done();
} ); } );
nonExistingUser.then( function ( recipientGender ) { nonExistingUser.then( ( recipientGender ) => {
assert.strictEqual( recipientGender, 'unknown', 'gender for non-existing user' ); assert.strictEqual( recipientGender, 'unknown', 'gender for non-existing user' );
done(); done();
} ); } );