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"
],
"rules": {
"no-var": "warn",
"max-len": "off",
"no-jquery/no-global-selector": "off",
"prefer-const": "warn"
"no-jquery/no-global-selector": "off"
}
}

View file

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