From 44998a759aaec102a327a6be4a2c1c906222b710 Mon Sep 17 00:00:00 2001 From: libraryupgrader Date: Thu, 29 Oct 2020 06:41:31 +0000 Subject: [PATCH] build: Updating mediawiki/mediawiki-codesniffer to 32.0.0 The following sniffs are failing and were disabled: * MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic * MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage Additional changes: * Dropped .inc files from .phpcs.xml (T200956). * Added the `wikimedia/mediawiki` profile in .eslintrc.json (T262222). * Added the `wikimedia/jquery` profile in .eslintrc.json (T262222). * Removed global `$`, included in the `wikimedia/jquery` profile (T262222). * Removed global `mw`, included via `wikimedia/mediawiki` profile (T262222). * Dropped the emtpy global definition in .eslintrc.json. Change-Id: Ib5a3697712078a4ed22195c274eae9c82ddd7227 --- .eslintrc.json | 10 +++++----- .phpcs.xml | 7 +++++-- composer.json | 2 +- includes/CategoryTreeHooks.php | 2 ++ modules/ext.categoryTree/ext.categoryTree.js | 8 +++++--- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 17f8508b..e67d292b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,14 +1,14 @@ { "root": true, - "extends": "wikimedia", + "extends": [ + "wikimedia", + "wikimedia/mediawiki", + "wikimedia/jquery" + ], "env": { "browser": true, "commonjs": true }, - "globals": { - "mw": false, - "$": false - }, "rules": { "no-shadow": "warn" } diff --git a/.phpcs.xml b/.phpcs.xml index 5b7a5681..ca97268f 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,7 +1,10 @@ - + + + + . - + diff --git a/composer.json b/composer.json index 0971aa84..467bfdb8 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "require-dev": { - "mediawiki/mediawiki-codesniffer": "31.0.0", + "mediawiki/mediawiki-codesniffer": "32.0.0", "mediawiki/mediawiki-phan-config": "0.10.3", "mediawiki/minus-x": "1.1.0", "php-parallel-lint/php-console-highlighter": "0.5.0", diff --git a/includes/CategoryTreeHooks.php b/includes/CategoryTreeHooks.php index e9927230..e8a5f398 100644 --- a/includes/CategoryTreeHooks.php +++ b/includes/CategoryTreeHooks.php @@ -154,6 +154,7 @@ class CategoryTreeHooks { ) { if ( $parser ) { # flag for use by CategoryTreeHooks::parserOutput + // @phan-suppress-next-line PhanUndeclaredProperty $parser->mOutput->mCategoryTreeTag = true; } @@ -187,6 +188,7 @@ class CategoryTreeHooks { // Skip, we've already set the headers unconditionally return; } + // @phan-suppress-next-line PhanUndeclaredProperty if ( !empty( $parserOutput->mCategoryTreeTag ) ) { CategoryTree::setHeaders( $outputPage ); } diff --git a/modules/ext.categoryTree/ext.categoryTree.js b/modules/ext.categoryTree/ext.categoryTree.js index 537c5804..496a6eab 100644 --- a/modules/ext.categoryTree/ext.categoryTree.js +++ b/modules/ext.categoryTree/ext.categoryTree.js @@ -85,7 +85,7 @@ */ function attachHandler( $content ) { $content.find( '.CategoryTreeToggle' ) - .click( handleNode ) + .on( 'click', handleNode ) .attr( 'title', function () { return mw.msg( $( this ).data( 'ct-state' ) === 'collapsed' ? @@ -134,7 +134,8 @@ $link.data( 'ct-loaded', true ); $children.empty().append( - $( '' ) + $( '' ) + .addClass( 'CategoryTreeNotice' ) .text( mw.msg( 'categorytree-loading' ) ) ); @@ -184,7 +185,7 @@ data = mw.msg( 'categorytree-nothing-found' ); } - $data = $( '' ).text( data ); + $data = $( '' ).addClass( 'CategoryTreeNotice' ).text( data ); } else { $data = $( $.parseHTML( data ) ); attachHandler( $data ); @@ -204,6 +205,7 @@ $( function () { // Attach click handler for sidebar + // eslint-disable-next-line no-jquery/no-global-selector attachHandler( $( '#p-categorytree-portlet' ) ); } );