eslint: Enforce prefer-const

Change-Id: I505dca84d0e864a4ac96c71747f08a062ddc1865
This commit is contained in:
Ed Sanders 2024-09-16 14:28:41 +01:00
parent 8f75c66cb0
commit cceb09abe8
2 changed files with 4 additions and 7 deletions

View file

@ -6,9 +6,7 @@
"wikimedia/mediawiki" "wikimedia/mediawiki"
], ],
"rules": { "rules": {
"no-var": "warn",
"max-len": "off", "max-len": "off",
"no-jquery/no-global-selector": "off", "no-jquery/no-global-selector": "off"
"prefer-const": "warn"
} }
} }

View file

@ -43,12 +43,11 @@
* @see jQuery#findWithParent * @see jQuery#findWithParent
*/ */
$.fn.findWithParent = function ( selector ) { $.fn.findWithParent = function ( selector ) {
let selectors = selector.split( ',' ), const selectors = selector.split( ',' );
$elements = $(), let $elements = $();
self = this;
selectors.forEach( ( sel ) => { selectors.forEach( ( sel ) => {
$elements = $elements.add( jQueryFindWithParent( self, sel ) ); $elements = $elements.add( jQueryFindWithParent( this, sel ) );
} ); } );
return $elements; return $elements;