build: Update eslint-config-wikimedia to 0.28.0 and autofix

Change-Id: I02045047af1f392ae6d6f08e422024b0e9386ccf
This commit is contained in:
Ed Sanders 2024-06-07 15:24:08 +01:00
parent cc7b93a447
commit 39c15f76f9
8 changed files with 607 additions and 742 deletions

View file

@ -1,12 +1,11 @@
{
"root": true,
"extends": [
"wikimedia/client-es6",
"wikimedia/client",
"wikimedia/jquery",
"wikimedia/mediawiki"
],
"rules": {
"max-len": "off",
"no-var": "warn"
"max-len": "off"
}
}

View file

@ -18,7 +18,7 @@
return deferred.reject();
}
qidstr = qidstr.slice( 1 );
fetch( qidstr ).then( function ( body ) {
fetch( qidstr ).then( ( body ) => {
const model = {
title: body.title,
url: body.canonicalurl,
@ -36,7 +36,7 @@
// popups require title attributes
[].forEach.call(
document.querySelectorAll( '.mwe-math-element[data-qid] img' ),
function ( node ) {
( node ) => {
if ( isValidId( node.parentNode.parentNode.dataset.qid ) ) {
node.dataset.title = 'math-unique-identifier';
}

View file

@ -59,9 +59,7 @@
* @inheritdoc OO.ui.mixin.LookupElement
*/
mw.widgets.MathWbEntitySelector.prototype.getLookupMenuOptionsFromData = function ( response ) {
return response.map( function ( res ) {
return new OO.ui.MenuOptionWidget( { data: res.id, label: res.label, title: res.description } );
} );
return response.map( ( res ) => new OO.ui.MenuOptionWidget( { data: res.id, label: res.label, title: res.description } ) );
};
/**

View file

@ -1,6 +1,6 @@
QUnit.module( 've.dm.Autocomplete (Math)', ve.test.utils.newMwEnvironment() );
QUnit.test( 'Autocomplete list', function ( assert ) {
QUnit.test( 'Autocomplete list', ( assert ) => {
assert.notStrictEqual(
ve.ui.MWMathDialog.static.autocompleteWordList,
undefined,

View file

@ -135,21 +135,19 @@ ve.ui.MWLatexDialog.prototype.initialize = function () {
classes: [ 've-ui-mwLatexDialog-symbols' ]
} );
this.pages = [];
this.symbolsPromise = mw.loader.using( this.constructor.static.symbolsModule ).done( function ( require ) {
this.symbolsPromise = mw.loader.using( this.constructor.static.symbolsModule ).done( ( require ) => {
// eslint-disable-next-line security/detect-non-literal-require
const symbols = require( dialog.constructor.static.symbolsModule );
const symbolData = {};
for ( const category in symbols ) {
const symbolList = symbols[ category ].filter( function ( symbol ) {
const symbolList = symbols[ category ].filter( ( symbol ) => {
if ( symbol.notWorking || symbol.duplicate ) {
return false;
}
const tex = symbol.tex || symbol.insert;
const classes = [ 've-ui-mwLatexDialog-symbol' ];
classes.push(
've-ui-mwLatexSymbol-' + tex.replace( /[^\w]/g, function ( c ) {
return '_' + c.charCodeAt( 0 ) + '_';
} )
've-ui-mwLatexSymbol-' + tex.replace( /[^\w]/g, ( c ) => '_' + c.charCodeAt( 0 ) + '_' )
);
if ( symbol.width ) {
// The following classes are used here:
@ -295,7 +293,7 @@ ve.ui.MWLatexDialog.prototype.getBodyHeight = function () {
*/
ve.ui.MWLatexDialog.prototype.onWindowManagerResize = function () {
const dialog = this;
this.input.loadingPromise.always( function () {
this.input.loadingPromise.always( () => {
// Toggle short mode as necessary
// NB a change of mode triggers a transition...
dialog.menuLayout.$element.toggleClass(
@ -303,7 +301,7 @@ ve.ui.MWLatexDialog.prototype.onWindowManagerResize = function () {
);
// ...So wait for the possible menuLayout transition to finish
setTimeout( function () {
setTimeout( () => {
// Give the input the right number of rows to fit the space
const availableSpace = dialog.menuLayout.$content.height() - dialog.input.$element.position().top;
// TODO: Compute this line height from the skin
@ -313,9 +311,9 @@ ve.ui.MWLatexDialog.prototype.onWindowManagerResize = function () {
const borderAndPadding = 2 * ( border + padding );
const maxInputHeight = availableSpace - borderAndPadding;
const minRows = Math.floor( maxInputHeight / singleLineHeight );
dialog.input.loadingPromise.done( function () {
dialog.input.loadingPromise.done( () => {
dialog.input.setMinRows( minRows );
} ).fail( function () {
} ).fail( () => {
dialog.input.$input.attr( 'rows', minRows );
} );
}, OO.ui.theme.getDialogTransitionDuration() );

1312
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,7 @@
"@wdio/spec-reporter": "7.16.13",
"api-testing": "1.6.0",
"commander": "^9.4.1",
"eslint-config-wikimedia": "0.27.0",
"eslint-config-wikimedia": "0.28.0",
"grunt": "1.6.1",
"grunt-banana-checker": "0.13.0",
"grunt-contrib-watch": "1.1.0",

View file

@ -4,14 +4,14 @@ const assert = require( 'assert' ),
Api = require( 'wdio-mediawiki/Api' ),
MathPage = require( '../pageobjects/math.page' );
describe( 'Math', function () {
describe( 'Math', () => {
let bot;
before( async () => {
bot = await Api.bot();
} );
it( 'should work for addition', async function () {
it( 'should work for addition', async () => {
// page should have random name
const pageName = Math.random().toString();