ESLint: Manually enforce prefer-const

Change-Id: Id35fb62915e8067deaa1eb412ab3cb9d9353b9e8
This commit is contained in:
Ed Sanders 2024-11-15 12:43:46 +00:00 committed by Bartosz Dziewoński
parent c125751148
commit c1d97fe834
4 changed files with 10 additions and 13 deletions

View file

@ -4,8 +4,5 @@
"wikimedia/client", "wikimedia/client",
"wikimedia/jquery", "wikimedia/jquery",
"wikimedia/mediawiki" "wikimedia/mediawiki"
], ]
"rules": {
"prefer-const": "warn"
}
} }

View file

@ -1,9 +1,9 @@
/* eslint-disable no-jquery/no-global-selector */ /* eslint-disable no-jquery/no-global-selector */
module.exports = function () { module.exports = function () {
let mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ), const mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ),
echoHacked = false, notifications = $( '#pt-notifications-alert a' ).data( 'counter-num' ) + $( '#pt-notifications-notice a' ).data( 'counter-num' );
let echoHacked = false,
echoHackActive = false, echoHackActive = false,
notifications = $( '#pt-notifications-alert a' ).data( 'counter-num' ) + $( '#pt-notifications-notice a' ).data( 'counter-num' ),
notificationsString; notificationsString;
// When the icons are clicked for the first time, they are replaced with a JS interface, // When the icons are clicked for the first time, they are replaced with a JS interface,

View file

@ -1,9 +1,9 @@
/* eslint-disable no-jquery/no-global-selector */ /* eslint-disable no-jquery/no-global-selector */
module.exports = function () { module.exports = function () {
mw.loader.using( [ 'ext.uls.interface' ] ).then( () => { mw.loader.using( [ 'ext.uls.interface' ] ).then( () => {
let mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ), const mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ),
$ULSTrigger = $( '#pt-uls' ), $ULSTrigger = $( '#pt-uls' );
ULSMoved = false; let ULSMoved = false;
function moveULS() { function moveULS() {
if ( $ULSTrigger.length ) { if ( $ULSTrigger.length ) {

View file

@ -1,11 +1,9 @@
/* eslint-disable no-jquery/no-global-selector */ /* eslint-disable no-jquery/no-global-selector */
$( () => { $( () => {
let mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ), const mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ),
isResponsive = document.body.classList.contains( 'skin--responsive' ), isResponsive = document.body.classList.contains( 'skin--responsive' ),
echo = require( './mobile-echo.js' ), echo = require( './mobile-echo.js' ),
uls = require( './mobile-uls.js' ), uls = require( './mobile-uls.js' ),
// Track if DOM has been set up for mobile fanciness yet
monobookMobileElements = false,
// Toggles and targets for popouts // Toggles and targets for popouts
toggles = { toggles = {
'#sidebar-toggle': '#sidebar-mobilejs', '#sidebar-toggle': '#sidebar-mobilejs',
@ -14,6 +12,8 @@ $( () => {
'#ca-languages a': '#p-lang', '#ca-languages a': '#p-lang',
'#ca-tools a': '#p-tb' '#ca-tools a': '#p-tb'
}; };
// Track if DOM has been set up for mobile fanciness yet
let monobookMobileElements = false;
// Close menus // Close menus
function closeMenus() { function closeMenus() {