From ecff9058dc89aefe0d1671cc52075f77e1a800e4 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Wed, 3 Sep 2025 21:23:40 +0200 Subject: [PATCH] chore: format node folder with biomejs --- src/node/db/API.ts | 4 ++-- src/node/db/AuthorManager.ts | 2 +- src/node/db/DB.ts | 4 ++-- src/node/db/GroupManager.ts | 2 +- src/node/db/Pad.ts | 8 ++++---- src/node/db/PadManager.ts | 6 +++--- src/node/db/ReadOnlyManager.ts | 2 +- src/node/db/SecurityManager.ts | 4 ++-- src/node/db/SessionManager.ts | 2 +- src/node/eejs/index.ts | 2 +- src/node/handler/APIHandler.ts | 8 ++++---- src/node/handler/ExportHandler.ts | 2 +- src/node/handler/ImportHandler.ts | 2 +- src/node/handler/PadMessageHandler.ts | 12 ++++++------ src/node/handler/RestAPI.ts | 8 ++++---- src/node/handler/SocketIORouter.ts | 6 +++--- src/node/hooks/express.ts | 6 +++--- src/node/hooks/express/admin.ts | 12 ++++++------ src/node/hooks/express/adminplugins.ts | 12 ++++++------ src/node/hooks/express/adminsettings.ts | 20 ++++++++++---------- src/node/hooks/express/apicalls.ts | 4 ++-- src/node/hooks/express/errorhandling.ts | 6 +++--- src/node/hooks/express/importexport.ts | 4 ++-- src/node/hooks/express/openapi.ts | 8 ++++---- src/node/hooks/express/padurlsanitize.ts | 4 ++-- src/node/hooks/express/pwa.ts | 2 +- src/node/hooks/express/socketio.ts | 6 +++--- src/node/hooks/express/specialpages.ts | 6 +++--- src/node/hooks/express/static.ts | 8 ++++---- src/node/hooks/express/webaccess.ts | 8 ++++---- src/node/hooks/i18n.ts | 6 +++--- src/node/padaccess.ts | 2 +- src/node/prometheus.ts | 2 +- src/node/security/OAuth2Provider.ts | 12 ++++++------ src/node/security/SecretRotator.ts | 4 ++-- src/node/security/crypto.ts | 2 +- src/node/server.ts | 4 ++-- src/node/stats.ts | 2 +- src/node/types/ArgsExpressType.ts | 4 ++-- src/node/types/PadType.ts | 4 ++-- src/node/types/Plugin.ts | 2 +- src/node/types/Revision.ts | 2 +- src/node/types/WebAccessTypes.ts | 2 +- src/node/utils/Abiword.ts | 6 +++--- src/node/utils/AbsolutePaths.ts | 2 +- src/node/utils/Cleanup.ts | 16 ++++++++-------- src/node/utils/Cli.ts | 2 +- src/node/utils/ExportEtherpad.ts | 2 +- src/node/utils/ExportHelper.ts | 4 ++-- src/node/utils/ExportHtml.ts | 6 +++--- src/node/utils/ExportTxt.ts | 6 +++--- src/node/utils/ImportEtherpad.ts | 2 +- src/node/utils/ImportHtml.ts | 4 ++-- src/node/utils/LibreOffice.ts | 2 +- src/node/utils/Minify.ts | 6 +++--- src/node/utils/MinifyWorker.ts | 2 +- src/node/utils/NodeVersion.ts | 2 +- src/node/utils/Settings.ts | 14 +++++++------- src/node/utils/SettingsTree.ts | 4 ++-- src/node/utils/Stream.ts | 2 +- src/node/utils/UpdateCheck.ts | 2 +- src/node/utils/checkValidRev.ts | 2 +- src/node/utils/customError.ts | 2 +- src/node/utils/padDiff.ts | 8 ++++---- src/node/utils/path_exists.ts | 2 +- src/node/utils/promises.ts | 2 +- src/node/utils/run_cmd.ts | 10 +++++----- src/node/utils/toolbar.ts | 4 ++-- 68 files changed, 171 insertions(+), 171 deletions(-) diff --git a/src/node/db/API.ts b/src/node/db/API.ts index 9ca5ca03c..6a7eea280 100644 --- a/src/node/db/API.ts +++ b/src/node/db/API.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * This module provides all API functions */ @@ -22,7 +22,7 @@ import {deserializeOps} from '../../static/js/Changeset'; import ChatMessage from '../../static/js/ChatMessage'; import {Builder} from "../../static/js/Builder"; -import {Attribute} from "../../static/js/types/Attribute"; +import type {Attribute} from "../../static/js/types/Attribute"; const CustomError = require('../utils/customError'); const padManager = require('./PadManager'); const padMessageHandler = require('../handler/PadMessageHandler'); diff --git a/src/node/db/AuthorManager.ts b/src/node/db/AuthorManager.ts index 4bcfa2c0d..a36269c3f 100644 --- a/src/node/db/AuthorManager.ts +++ b/src/node/db/AuthorManager.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The AuthorManager controlls all information about the Pad authors */ diff --git a/src/node/db/DB.ts b/src/node/db/DB.ts index 4b4899fac..51bf4d4d8 100644 --- a/src/node/db/DB.ts +++ b/src/node/db/DB.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The DB Module provides a database initialized with the settings @@ -21,7 +21,7 @@ * limitations under the License. */ -import {Database, DatabaseType} from 'ueberdb2'; +import {Database, type DatabaseType} from 'ueberdb2'; import settings from '../utils/Settings'; import log4js from 'log4js'; const stats = require('../stats') diff --git a/src/node/db/GroupManager.ts b/src/node/db/GroupManager.ts index b8cb6db02..c2e2a22f5 100644 --- a/src/node/db/GroupManager.ts +++ b/src/node/db/GroupManager.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The Group Manager provides functions to manage groups in the database */ diff --git a/src/node/db/Pad.ts b/src/node/db/Pad.ts index 003ec0831..78b990eca 100644 --- a/src/node/db/Pad.ts +++ b/src/node/db/Pad.ts @@ -1,7 +1,7 @@ -'use strict'; -import {Database} from "ueberdb2"; -import {AChangeSet, APool, AText} from "../types/PadType"; -import {MapArrayType} from "../types/MapType"; + +import type {Database} from "ueberdb2"; +import {AChangeSet, APool, type AText} from "../types/PadType"; +import type {MapArrayType} from "../types/MapType"; /** * The pad object, defined with joose diff --git a/src/node/db/PadManager.ts b/src/node/db/PadManager.ts index 292261531..24023fa82 100644 --- a/src/node/db/PadManager.ts +++ b/src/node/db/PadManager.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The Pad Manager is a Factory for pad Objects */ @@ -19,8 +19,8 @@ * limitations under the License. */ -import {MapArrayType} from "../types/MapType"; -import {PadType} from "../types/PadType"; +import type {MapArrayType} from "../types/MapType"; +import type {PadType} from "../types/PadType"; const CustomError = require('../utils/customError'); const Pad = require('../db/Pad'); diff --git a/src/node/db/ReadOnlyManager.ts b/src/node/db/ReadOnlyManager.ts index b341dfbe4..a32ac811a 100644 --- a/src/node/db/ReadOnlyManager.ts +++ b/src/node/db/ReadOnlyManager.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The ReadOnlyManager manages the database and rendering releated to read only pads */ diff --git a/src/node/db/SecurityManager.ts b/src/node/db/SecurityManager.ts index 219d3f2be..7314b8547 100644 --- a/src/node/db/SecurityManager.ts +++ b/src/node/db/SecurityManager.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Controls the security of pad access */ @@ -19,7 +19,7 @@ * limitations under the License. */ -import {UserSettingsObject} from "../types/UserSettingsObject"; +import type {UserSettingsObject} from "../types/UserSettingsObject"; const authorManager = require('./AuthorManager'); const hooks = require('../../static/js/pluginfw/hooks'); diff --git a/src/node/db/SessionManager.ts b/src/node/db/SessionManager.ts index b8b1b2562..017ee9178 100644 --- a/src/node/db/SessionManager.ts +++ b/src/node/db/SessionManager.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The Session Manager provides functions to manage session in the database, * it only provides session management for sessions created by the API diff --git a/src/node/eejs/index.ts b/src/node/eejs/index.ts index 85de034b0..e1dc0ccec 100644 --- a/src/node/eejs/index.ts +++ b/src/node/eejs/index.ts @@ -1,4 +1,4 @@ -'use strict'; + /* * Copyright (c) 2011 RedHog (Egil Möller) * diff --git a/src/node/handler/APIHandler.ts b/src/node/handler/APIHandler.ts index 32ce9d118..1ef6226fb 100644 --- a/src/node/handler/APIHandler.ts +++ b/src/node/handler/APIHandler.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The API Handler handles all API http requests */ @@ -19,16 +19,16 @@ * limitations under the License. */ -import {MapArrayType} from "../types/MapType"; +import type {MapArrayType} from "../types/MapType"; import { jwtDecode } from "jwt-decode"; const api = require('../db/API'); const padManager = require('../db/PadManager'); import settings from '../utils/Settings'; import createHTTPError from 'http-errors'; -import {Http2ServerRequest} from "node:http2"; +import type {Http2ServerRequest} from "node:http2"; import {publicKeyExported} from "../security/OAuth2Provider"; import {jwtVerify} from "jose"; -import {APIFields, apikey} from './APIKeyHandler' +import {type APIFields, apikey} from './APIKeyHandler' // a list of all functions const version:MapArrayType = {}; diff --git a/src/node/handler/ExportHandler.ts b/src/node/handler/ExportHandler.ts index e1294171a..9eab5a97a 100644 --- a/src/node/handler/ExportHandler.ts +++ b/src/node/handler/ExportHandler.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Handles the export requests */ diff --git a/src/node/handler/ImportHandler.ts b/src/node/handler/ImportHandler.ts index e569c12fa..1c25ac2a9 100644 --- a/src/node/handler/ImportHandler.ts +++ b/src/node/handler/ImportHandler.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Handles the import requests */ diff --git a/src/node/handler/PadMessageHandler.ts b/src/node/handler/PadMessageHandler.ts index 115d69a23..4da9c041a 100644 --- a/src/node/handler/PadMessageHandler.ts +++ b/src/node/handler/PadMessageHandler.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The MessageHandler handles all Messages that comes from Socket.IO and controls the sessions */ @@ -19,7 +19,7 @@ * limitations under the License. */ -import {MapArrayType} from "../types/MapType"; +import type {MapArrayType} from "../types/MapType"; import AttributeMap from '../../static/js/AttributeMap'; const padManager = require('../db/PadManager'); @@ -44,10 +44,10 @@ const hooks = require('../../static/js/pluginfw/hooks'); const stats = require('../stats') const assert = require('assert').strict; import {RateLimiterMemory} from 'rate-limiter-flexible'; -import {ChangesetRequest, PadUserInfo, SocketClientRequest} from "../types/SocketClientRequest"; -import {APool, AText, PadAuthor, PadType} from "../types/PadType"; -import {ChangeSet} from "../types/ChangeSet"; -import {ChatMessageMessage, ClientReadyMessage, ClientSaveRevisionMessage, ClientSuggestUserName, ClientUserChangesMessage, ClientVarMessage, CustomMessage, PadDeleteMessage, UserNewInfoMessage} from "../../static/js/types/SocketIOMessage"; +import {type ChangesetRequest, PadUserInfo, type SocketClientRequest} from "../types/SocketClientRequest"; +import {APool, type AText, type PadAuthor, type PadType} from "../types/PadType"; +import type {ChangeSet} from "../types/ChangeSet"; +import type {ChatMessageMessage, ClientReadyMessage, ClientSaveRevisionMessage, ClientSuggestUserName, ClientUserChangesMessage, ClientVarMessage, CustomMessage, PadDeleteMessage, UserNewInfoMessage} from "../../static/js/types/SocketIOMessage"; import {Builder} from "../../static/js/Builder"; const webaccess = require('../hooks/express/webaccess'); const { checkValidRev } = require('../utils/checkValidRev'); diff --git a/src/node/handler/RestAPI.ts b/src/node/handler/RestAPI.ts index 1b0d1d09d..350d95275 100644 --- a/src/node/handler/RestAPI.ts +++ b/src/node/handler/RestAPI.ts @@ -1,7 +1,7 @@ -import {ArgsExpressType} from "../types/ArgsExpressType"; -import {MapArrayType} from "../types/MapType"; +import type {ArgsExpressType} from "../types/ArgsExpressType"; +import type {MapArrayType} from "../types/MapType"; import {IncomingForm} from "formidable"; -import {ErrorCaused} from "../types/ErrorCaused"; +import type {ErrorCaused} from "../types/ErrorCaused"; import createHTTPError from "http-errors"; const apiHandler = require('./APIHandler') @@ -1462,7 +1462,7 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy let response; try { try { - let data = await apiHandler.handle(apiVersion, functionName, fields, req, res); + const data = await apiHandler.handle(apiVersion, functionName, fields, req, res); // return in common format response = {code: 0, message: 'ok', data: data || null}; diff --git a/src/node/handler/SocketIORouter.ts b/src/node/handler/SocketIORouter.ts index 9e5f4e5cd..191fb2ce1 100644 --- a/src/node/handler/SocketIORouter.ts +++ b/src/node/handler/SocketIORouter.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * This is the Socket.IO Router. It routes the Messages between the * components of the Server. The components are at the moment: pad and timeslider @@ -20,8 +20,8 @@ * limitations under the License. */ -import {MapArrayType} from "../types/MapType"; -import {SocketModule} from "../types/SocketModule"; +import type {MapArrayType} from "../types/MapType"; +import type {SocketModule} from "../types/SocketModule"; import log4js from 'log4js'; import settings from '../utils/Settings'; const stats = require('../../node/stats') diff --git a/src/node/hooks/express.ts b/src/node/hooks/express.ts index fb24cbfe6..bb861fa15 100644 --- a/src/node/hooks/express.ts +++ b/src/node/hooks/express.ts @@ -1,13 +1,13 @@ -'use strict'; -import {Socket} from "node:net"; + +import type {Socket} from "node:net"; import type {MapArrayType} from "../types/MapType"; import _ from 'underscore'; import cookieParser from 'cookie-parser'; import events from 'events'; import express from 'express'; -import expressSession, {Store} from 'express-session'; +import expressSession, {type Store} from 'express-session'; import fs from 'fs'; const hooks = require('../../static/js/pluginfw/hooks'); import log4js from 'log4js'; diff --git a/src/node/hooks/express/admin.ts b/src/node/hooks/express/admin.ts index ca0f48668..957b7273f 100644 --- a/src/node/hooks/express/admin.ts +++ b/src/node/hooks/express/admin.ts @@ -1,8 +1,8 @@ -'use strict'; -import {ArgsExpressType} from "../../types/ArgsExpressType"; + +import type {ArgsExpressType} from "../../types/ArgsExpressType"; import path from "path"; import fs from "fs"; -import {MapArrayType} from "../../types/MapType"; +import type {MapArrayType} from "../../types/MapType"; import settings from 'ep_etherpad-lite/node/utils/Settings'; @@ -48,7 +48,7 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func '.doc': 'application/msword' }; - fs.exists(pathname, function (exist) { + fs.exists(pathname, (exist) => { if (!exist) { // if the file is not found, return 404 res.statusCode = 200; @@ -63,7 +63,7 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func } // read file from file system - fs.readFile(pathname, function (err, data) { + fs.readFile(pathname, (err, data) => { if (err) { res.statusCode = 500; res.end(`Error getting the file: ${err}.`); @@ -73,7 +73,7 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func res.setHeader('Content-type', map[ext] || 'text/plain'); if (ext === ".html" || ext === ".js" || ext === ".css") { if (req.header(PROXY_HEADER)) { - let string = data.toString() + const string = data.toString() dataToSend = string.replaceAll("/admin", req.header(PROXY_HEADER) + "/admin") dataToSend = dataToSend.replaceAll("/socket.io", req.header(PROXY_HEADER) + "/socket.io") } diff --git a/src/node/hooks/express/adminplugins.ts b/src/node/hooks/express/adminplugins.ts index 47f06c513..f6d8fc77d 100644 --- a/src/node/hooks/express/adminplugins.ts +++ b/src/node/hooks/express/adminplugins.ts @@ -1,14 +1,14 @@ -'use strict'; -import {ArgsExpressType} from "../../types/ArgsExpressType"; -import {ErrorCaused} from "../../types/ErrorCaused"; -import {QueryType} from "../../types/QueryType"; + +import type {ArgsExpressType} from "../../types/ArgsExpressType"; +import type {ErrorCaused} from "../../types/ErrorCaused"; +import type {QueryType} from "../../types/QueryType"; import {getAvailablePlugins, install, search, uninstall} from "../../../static/js/pluginfw/installer"; -import {PackageData, PackageInfo} from "../../types/PackageInfo"; +import type {PackageData, PackageInfo} from "../../types/PackageInfo"; import semver from 'semver'; import log4js from 'log4js'; -import {MapArrayType} from "../../types/MapType"; +import type {MapArrayType} from "../../types/MapType"; const pluginDefs = require('../../../static/js/pluginfw/plugin_defs'); const logger = log4js.getLogger('adminPlugins'); diff --git a/src/node/hooks/express/adminsettings.ts b/src/node/hooks/express/adminsettings.ts index a782c6d40..4a590a2b3 100644 --- a/src/node/hooks/express/adminsettings.ts +++ b/src/node/hooks/express/adminsettings.ts @@ -1,7 +1,7 @@ -'use strict'; -import {PadQueryResult, PadSearchQuery} from "../../types/PadSearchQuery"; + +import type {PadQueryResult, PadSearchQuery} from "../../types/PadSearchQuery"; import log4js from 'log4js'; const fsp = require('fs').promises; @@ -80,8 +80,8 @@ exports.socketio = (hookName: string, {io}: any) => { const clientHooks: Map> = plugins.getHooks('client_hooks', false); function mapToObject(map: Map) { - let obj = Object.create(null); - for (let [k, v] of map) { + const obj = Object.create(null); + for (const [k, v] of map) { if (v instanceof Map) { obj[k] = mapToObject(v); } else { @@ -166,7 +166,7 @@ exports.socketio = (hookName: string, {io}: any) => { } else if (query.sortBy === "revisionNumber") { const currentWinners: PadQueryResult[] = [] const padMapping = [] as {padId: string, revisionNumber: number}[] - for (let res of result) { + for (const res of result) { const pad = await padManager.getPad(res); const revisionNumber = pad.getHeadRevisionNumber() padMapping.push({padId: res, revisionNumber}) @@ -178,7 +178,7 @@ exports.socketio = (hookName: string, {io}: any) => { }) for (const padRetrieval of padMapping.slice(query.offset, query.offset + query.limit)) { - let pad = await padManager.getPad(padRetrieval.padId); + const pad = await padManager.getPad(padRetrieval.padId); currentWinners.push({ padName: padRetrieval.padId, lastEdited: await pad.getLastEdit(), @@ -191,7 +191,7 @@ exports.socketio = (hookName: string, {io}: any) => { } else if (query.sortBy === "userCount") { const currentWinners: PadQueryResult[] = [] const padMapping = [] as {padId: string, userCount: number}[] - for (let res of result) { + for (const res of result) { const userCount = api.padUsersCount(res).padUsersCount padMapping.push({padId: res, userCount}) } @@ -202,7 +202,7 @@ exports.socketio = (hookName: string, {io}: any) => { }) for (const padRetrieval of padMapping.slice(query.offset, query.offset + query.limit)) { - let pad = await padManager.getPad(padRetrieval.padId); + const pad = await padManager.getPad(padRetrieval.padId); currentWinners.push({ padName: padRetrieval.padId, lastEdited: await pad.getLastEdit(), @@ -214,7 +214,7 @@ exports.socketio = (hookName: string, {io}: any) => { } else if (query.sortBy === "lastEdited") { const currentWinners: PadQueryResult[] = [] const padMapping = [] as {padId: string, lastEdited: string}[] - for (let res of result) { + for (const res of result) { const pad = await padManager.getPad(res); const lastEdited = await pad.getLastEdit(); padMapping.push({padId: res, lastEdited}) @@ -226,7 +226,7 @@ exports.socketio = (hookName: string, {io}: any) => { }) for (const padRetrieval of padMapping.slice(query.offset, query.offset + query.limit)) { - let pad = await padManager.getPad(padRetrieval.padId); + const pad = await padManager.getPad(padRetrieval.padId); currentWinners.push({ padName: padRetrieval.padId, lastEdited: padRetrieval.lastEdited, diff --git a/src/node/hooks/express/apicalls.ts b/src/node/hooks/express/apicalls.ts index 946e86549..1711a27f1 100644 --- a/src/node/hooks/express/apicalls.ts +++ b/src/node/hooks/express/apicalls.ts @@ -1,4 +1,4 @@ -'use strict'; + import express from "express"; @@ -12,7 +12,7 @@ const util = require('util'); function objectAsString(obj: any): string { let output = ''; for (const property in obj) { - if(obj.hasOwnProperty(property) && typeof obj[property] !== 'function') { + if(Object.hasOwn(obj, property) && typeof obj[property] !== 'function') { let value = obj[property]; if(typeof value === 'object' && !Array.isArray(value) && value !== null) { value = '{' + objectAsString(value) + '}'; diff --git a/src/node/hooks/express/errorhandling.ts b/src/node/hooks/express/errorhandling.ts index 2de819b0e..f2ee69432 100644 --- a/src/node/hooks/express/errorhandling.ts +++ b/src/node/hooks/express/errorhandling.ts @@ -1,7 +1,7 @@ -'use strict'; -import {ArgsExpressType} from "../../types/ArgsExpressType"; -import {ErrorCaused} from "../../types/ErrorCaused"; + +import type {ArgsExpressType} from "../../types/ArgsExpressType"; +import type {ErrorCaused} from "../../types/ErrorCaused"; const stats = require('../../stats') diff --git a/src/node/hooks/express/importexport.ts b/src/node/hooks/express/importexport.ts index 7f9356844..355a1beb3 100644 --- a/src/node/hooks/express/importexport.ts +++ b/src/node/hooks/express/importexport.ts @@ -1,6 +1,6 @@ -'use strict'; -import {ArgsExpressType} from "../../types/ArgsExpressType"; + +import type {ArgsExpressType} from "../../types/ArgsExpressType"; const hasPadAccess = require('../../padaccess'); import settings, {exportAvailable} from '../../utils/Settings'; diff --git a/src/node/hooks/express/openapi.ts b/src/node/hooks/express/openapi.ts index ddd557dc1..898f2d7b2 100644 --- a/src/node/hooks/express/openapi.ts +++ b/src/node/hooks/express/openapi.ts @@ -1,8 +1,8 @@ -'use strict'; -import {OpenAPIOperations, OpenAPISuccessResponse, SwaggerUIResource} from "../../types/SwaggerUIResource"; -import {MapArrayType} from "../../types/MapType"; -import {ErrorCaused} from "../../types/ErrorCaused"; + +import type {OpenAPIOperations, OpenAPISuccessResponse, SwaggerUIResource} from "../../types/SwaggerUIResource"; +import type {MapArrayType} from "../../types/MapType"; +import type {ErrorCaused} from "../../types/ErrorCaused"; /** * node/hooks/express/openapi.js diff --git a/src/node/hooks/express/padurlsanitize.ts b/src/node/hooks/express/padurlsanitize.ts index 8679bcfe3..2e1d329e2 100644 --- a/src/node/hooks/express/padurlsanitize.ts +++ b/src/node/hooks/express/padurlsanitize.ts @@ -1,6 +1,6 @@ -'use strict'; -import {ArgsExpressType} from "../../types/ArgsExpressType"; + +import type {ArgsExpressType} from "../../types/ArgsExpressType"; const padManager = require('../../db/PadManager'); diff --git a/src/node/hooks/express/pwa.ts b/src/node/hooks/express/pwa.ts index a763af5b4..dd064fc4a 100644 --- a/src/node/hooks/express/pwa.ts +++ b/src/node/hooks/express/pwa.ts @@ -1,4 +1,4 @@ -import {ArgsExpressType} from "../../types/ArgsExpressType"; +import type {ArgsExpressType} from "../../types/ArgsExpressType"; import settings from '../../utils/Settings'; const pwa = { diff --git a/src/node/hooks/express/socketio.ts b/src/node/hooks/express/socketio.ts index 9184eff88..28c69fb06 100644 --- a/src/node/hooks/express/socketio.ts +++ b/src/node/hooks/express/socketio.ts @@ -1,13 +1,13 @@ -'use strict'; -import {ArgsExpressType} from "../../types/ArgsExpressType"; + +import type {ArgsExpressType} from "../../types/ArgsExpressType"; import events from 'events'; const express = require('../express'); import log4js from 'log4js'; const proxyaddr = require('proxy-addr'); import settings from '../../utils/Settings'; -import {Server, Socket} from 'socket.io' +import {Server, type Socket} from 'socket.io' const socketIORouter = require('../../handler/SocketIORouter'); const hooks = require('../../../static/js/pluginfw/hooks'); const padMessageHandler = require('../../handler/PadMessageHandler'); diff --git a/src/node/hooks/express/specialpages.ts b/src/node/hooks/express/specialpages.ts index 1f4ce3302..23901db8a 100644 --- a/src/node/hooks/express/specialpages.ts +++ b/src/node/hooks/express/specialpages.ts @@ -1,4 +1,4 @@ -'use strict'; + import path from 'node:path'; const eejs = require('../../eejs') @@ -12,7 +12,7 @@ const webaccess = require('./webaccess'); const plugins = require('../../../static/js/pluginfw/plugin_defs'); import {build, buildSync} from 'esbuild' -import {ArgsExpressType} from "../../types/ArgsExpressType"; +import type {ArgsExpressType} from "../../types/ArgsExpressType"; import prometheus from "../../prometheus"; let ioI: { sockets: { sockets: any[]; }; } | null = null @@ -131,7 +131,7 @@ const convertTypescript = (content: string) => { const handleLiveReload = async (args: ArgsExpressType, padString: string, timeSliderString: string, indexString: any) => { const chokidar = await import('chokidar') const watcher = chokidar.watch(path.join(settings.root, 'src', 'static', 'js'), {}); - let routeHandlers: { [key: string]: Function } = {}; + const routeHandlers: { [key: string]: Function } = {}; const setRouteHandler = (path: string, newHandler: Function) => { routeHandlers[path] = newHandler; diff --git a/src/node/hooks/express/static.ts b/src/node/hooks/express/static.ts index 9a8adfa4a..404e4921a 100644 --- a/src/node/hooks/express/static.ts +++ b/src/node/hooks/express/static.ts @@ -1,12 +1,12 @@ -'use strict'; -import {MapArrayType} from "../../types/MapType"; -import {PartType} from "../../types/PartType"; + +import type {MapArrayType} from "../../types/MapType"; +import type {PartType} from "../../types/PartType"; const fs = require('fs').promises; import {minify} from '../../utils/Minify'; import path from 'node:path'; -import {ArgsExpressType} from "../../types/ArgsExpressType"; +import type {ArgsExpressType} from "../../types/ArgsExpressType"; const plugins = require('../../../static/js/pluginfw/plugin_defs'); import settings from '../../utils/Settings'; diff --git a/src/node/hooks/express/webaccess.ts b/src/node/hooks/express/webaccess.ts index 031224f68..ea10d7547 100644 --- a/src/node/hooks/express/webaccess.ts +++ b/src/node/hooks/express/webaccess.ts @@ -1,10 +1,10 @@ -'use strict'; + import {strict as assert} from "assert"; import log4js from 'log4js'; -import {SocketClientRequest} from "../../types/SocketClientRequest"; -import {WebAccessTypes} from "../../types/WebAccessTypes"; -import {SettingsUser} from "../../types/SettingsUser"; +import type {SocketClientRequest} from "../../types/SocketClientRequest"; +import type {WebAccessTypes} from "../../types/WebAccessTypes"; +import type {SettingsUser} from "../../types/SettingsUser"; const httpLogger = log4js.getLogger('http'); import settings from '../../utils/Settings'; const hooks = require('../../../static/js/pluginfw/hooks'); diff --git a/src/node/hooks/i18n.ts b/src/node/hooks/i18n.ts index a59de913f..b4c97517d 100644 --- a/src/node/hooks/i18n.ts +++ b/src/node/hooks/i18n.ts @@ -1,7 +1,7 @@ -'use strict'; + import type {MapArrayType} from "../types/MapType"; -import {I18nPluginDefs} from "../types/I18nPluginDefs"; +import type {I18nPluginDefs} from "../types/I18nPluginDefs"; const languages = require('languages4translatewiki'); import fs from 'fs'; @@ -132,7 +132,7 @@ exports.expressPreSession = async (hookName:string, {app}:any) => { app.get('/locales/:locale', (req:any, res:any) => { // works with /locale/en and /locale/en.json requests const locale = req.params.locale.split('.')[0]; - if (Object.prototype.hasOwnProperty.call(exports.availableLangs, locale)) { + if (Object.hasOwn(exports.availableLangs, locale)) { res.setHeader('Cache-Control', `public, max-age=${settings.maxAge}`); res.setHeader('Content-Type', 'application/json; charset=utf-8'); res.send(`{"${locale}":${JSON.stringify(locales[locale])}}`); diff --git a/src/node/padaccess.ts b/src/node/padaccess.ts index ce3cf9ddd..f1c9751ff 100644 --- a/src/node/padaccess.ts +++ b/src/node/padaccess.ts @@ -1,4 +1,4 @@ -'use strict'; + const securityManager = require('./db/SecurityManager'); // checks for padAccess diff --git a/src/node/prometheus.ts b/src/node/prometheus.ts index 2fad567f4..da66f24c8 100644 --- a/src/node/prometheus.ts +++ b/src/node/prometheus.ts @@ -1,7 +1,7 @@ import client from 'prom-client' const db = require('./db/DB').db -const monitor = function () { +const monitor = () => { const collectDefaultMetrics = client.collectDefaultMetrics; const Registry = client.Registry; const register = new Registry(); diff --git a/src/node/security/OAuth2Provider.ts b/src/node/security/OAuth2Provider.ts index 6c069359d..e21445563 100644 --- a/src/node/security/OAuth2Provider.ts +++ b/src/node/security/OAuth2Provider.ts @@ -1,14 +1,14 @@ -import {ArgsExpressType} from "../types/ArgsExpressType"; -import Provider, {Account, Configuration} from 'oidc-provider'; -import {generateKeyPair, exportJWK, CryptoKey} from 'jose' +import type {ArgsExpressType} from "../types/ArgsExpressType"; +import Provider, {type Account, type Configuration} from 'oidc-provider'; +import {generateKeyPair, exportJWK, type CryptoKey} from 'jose' import MemoryAdapter from "./OIDCAdapter"; import path from "path"; import settings from '../utils/Settings'; import {IncomingForm} from 'formidable' import express from 'express'; import {format} from 'url' -import {ParsedUrlQuery} from "node:querystring"; -import {MapArrayType} from "../types/MapType"; +import type {ParsedUrlQuery} from "node:querystring"; +import type {MapArrayType} from "../types/MapType"; const configuration: Configuration = { scopes: ['openid', 'profile', 'email'], @@ -136,7 +136,7 @@ export const expressCreateServer = async (hookName: string, args: ArgsExpressTyp admin: account?.is_admin }; } else if (token.kind === "ClientCredentials") { - let extraParams: MapArrayType = {} + const extraParams: MapArrayType = {} settings.sso.clients && settings.sso.clients .filter((client:any) => client.client_id === token.clientId) diff --git a/src/node/security/SecretRotator.ts b/src/node/security/SecretRotator.ts index ee5bec772..f833a7dfe 100644 --- a/src/node/security/SecretRotator.ts +++ b/src/node/security/SecretRotator.ts @@ -1,7 +1,7 @@ -import {DeriveModel} from "../types/DeriveModel"; -import {LegacyParams} from "../types/LegacyParams"; +import type {DeriveModel} from "../types/DeriveModel"; +import type {LegacyParams} from "../types/LegacyParams"; const {Buffer} = require('buffer'); const crypto = require('./crypto'); diff --git a/src/node/security/crypto.ts b/src/node/security/crypto.ts index 9cf0a95a0..96eb68b37 100644 --- a/src/node/security/crypto.ts +++ b/src/node/security/crypto.ts @@ -1,4 +1,4 @@ -'use strict'; + const crypto = require('crypto'); const util = require('util'); diff --git a/src/node/server.ts b/src/node/server.ts index 5ed8d3073..c024d338e 100755 --- a/src/node/server.ts +++ b/src/node/server.ts @@ -22,8 +22,8 @@ * limitations under the License. */ -import {PluginType} from "./types/Plugin"; -import {ErrorCaused} from "./types/ErrorCaused"; +import type {PluginType} from "./types/Plugin"; +import type {ErrorCaused} from "./types/ErrorCaused"; import log4js from 'log4js'; import pkg from '../package.json'; import {checkForMigration} from "../static/js/pluginfw/installer"; diff --git a/src/node/stats.ts b/src/node/stats.ts index f1fc0cccf..6c2034605 100644 --- a/src/node/stats.ts +++ b/src/node/stats.ts @@ -1,4 +1,4 @@ -'use strict'; + const measured = require('measured-core'); diff --git a/src/node/types/ArgsExpressType.ts b/src/node/types/ArgsExpressType.ts index 996aee757..8b21b24aa 100644 --- a/src/node/types/ArgsExpressType.ts +++ b/src/node/types/ArgsExpressType.ts @@ -1,6 +1,6 @@ -import {Express} from "express"; +import type {Express} from "express"; import {MapArrayType} from "./MapType"; -import {SettingsType} from "../utils/Settings"; +import type {SettingsType} from "../utils/Settings"; export type ArgsExpressType = { app:Express, diff --git a/src/node/types/PadType.ts b/src/node/types/PadType.ts index f35b51361..e754eda9c 100644 --- a/src/node/types/PadType.ts +++ b/src/node/types/PadType.ts @@ -1,5 +1,5 @@ -import {MapArrayType} from "./MapType"; -import AttributePool from "../../static/js/AttributePool"; +import type {MapArrayType} from "./MapType"; +import type AttributePool from "../../static/js/AttributePool"; export type PadType = { id: string, diff --git a/src/node/types/Plugin.ts b/src/node/types/Plugin.ts index 44b97922c..749723400 100644 --- a/src/node/types/Plugin.ts +++ b/src/node/types/Plugin.ts @@ -1,4 +1,4 @@ -'use strict'; + export type PluginType = { diff --git a/src/node/types/Revision.ts b/src/node/types/Revision.ts index 8a9d65e29..2727f54e2 100644 --- a/src/node/types/Revision.ts +++ b/src/node/types/Revision.ts @@ -1,4 +1,4 @@ -import {AChangeSet} from "./PadType"; +import type {AChangeSet} from "./PadType"; export type Revision = { changeset: AChangeSet, diff --git a/src/node/types/WebAccessTypes.ts b/src/node/types/WebAccessTypes.ts index b351f059f..0c9aea07b 100644 --- a/src/node/types/WebAccessTypes.ts +++ b/src/node/types/WebAccessTypes.ts @@ -1,4 +1,4 @@ -import {SettingsUser} from "./SettingsUser"; +import type {SettingsUser} from "./SettingsUser"; export type WebAccessTypes = { username?: string|null; diff --git a/src/node/utils/Abiword.ts b/src/node/utils/Abiword.ts index fd17497ed..c0d6b5e78 100644 --- a/src/node/utils/Abiword.ts +++ b/src/node/utils/Abiword.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Controls the communication with the Abiword application */ @@ -19,8 +19,8 @@ * limitations under the License. */ -import {ChildProcess} from "node:child_process"; -import {AsyncQueueTask} from "../types/AsyncQueueTask"; +import type {ChildProcess} from "node:child_process"; +import type {AsyncQueueTask} from "../types/AsyncQueueTask"; const spawn = require('child_process').spawn; const async = require('async'); diff --git a/src/node/utils/AbsolutePaths.ts b/src/node/utils/AbsolutePaths.ts index 6423ae4d7..e021222c4 100644 --- a/src/node/utils/AbsolutePaths.ts +++ b/src/node/utils/AbsolutePaths.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Library for deterministic relative filename expansion for Etherpad. */ diff --git a/src/node/utils/Cleanup.ts b/src/node/utils/Cleanup.ts index 30967654f..06367f5dd 100644 --- a/src/node/utils/Cleanup.ts +++ b/src/node/utils/Cleanup.ts @@ -1,7 +1,7 @@ -'use strict' -import {AChangeSet} from "../types/PadType"; -import {Revision} from "../types/Revision"; + +import type {AChangeSet} from "../types/PadType"; +import type {Revision} from "../types/Revision"; import {timesLimit, firstSatisfies} from './promises'; const padManager = require('ep_etherpad-lite/node/db/PadManager'); @@ -44,7 +44,7 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro logger.debug('Start cleanup revisions', padId) - let pad = await padManager.getPad(padId); + const pad = await padManager.getPad(padId); await pad.check() logger.debug('Initial pad is valid') @@ -73,10 +73,10 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro await db.remove(`pad:${padId}:revs:${i}`, null); }); - let padContent = await db.get(`pad:${padId}`) + const padContent = await db.get(`pad:${padId}`) padContent.head = keepRevisions if (padContent.savedRevisions) { - let newSavedRevisions = [] + const newSavedRevisions = [] for (let i = 0; i < padContent.savedRevisions.length; i++) { if (padContent.savedRevisions[i].revNum > cleanupUntilRevision) { @@ -89,7 +89,7 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro await db.set(`pad:${padId}`, padContent); let newAText = Changeset.makeAText('\n'); - let pool = pad.apool() + const pool = pad.apool() newAText = Changeset.applyToAText(changeset, newAText, pool); @@ -130,7 +130,7 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro padManager.unloadPad(padId); - let newPad = await padManager.getPad(padId); + const newPad = await padManager.getPad(padId); await newPad.check(); return true diff --git a/src/node/utils/Cli.ts b/src/node/utils/Cli.ts index a441c4db3..df5e8f8bd 100644 --- a/src/node/utils/Cli.ts +++ b/src/node/utils/Cli.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The CLI module handles command line parameters */ diff --git a/src/node/utils/ExportEtherpad.ts b/src/node/utils/ExportEtherpad.ts index 292fbcec4..c860cb7e6 100644 --- a/src/node/utils/ExportEtherpad.ts +++ b/src/node/utils/ExportEtherpad.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * 2014 John McLear (Etherpad Foundation / McLear Ltd) * diff --git a/src/node/utils/ExportHelper.ts b/src/node/utils/ExportHelper.ts index 4c29534f4..27831a524 100644 --- a/src/node/utils/ExportHelper.ts +++ b/src/node/utils/ExportHelper.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Helpers for export requests */ @@ -20,7 +20,7 @@ */ import AttributeMap from '../../static/js/AttributeMap'; -import AttributePool from "../../static/js/AttributePool"; +import type AttributePool from "../../static/js/AttributePool"; import {deserializeOps, splitAttributionLines, subattribution} from '../../static/js/Changeset'; const { checkValidRev } = require('./checkValidRev'); diff --git a/src/node/utils/ExportHtml.ts b/src/node/utils/ExportHtml.ts index 29b171c8f..a9b16846c 100644 --- a/src/node/utils/ExportHtml.ts +++ b/src/node/utils/ExportHtml.ts @@ -1,6 +1,6 @@ -'use strict'; -import {AText, PadType} from "../types/PadType"; -import {MapArrayType} from "../types/MapType"; + +import type {AText, PadType} from "../types/PadType"; +import type {MapArrayType} from "../types/MapType"; /** * Copyright 2009 Google Inc. diff --git a/src/node/utils/ExportTxt.ts b/src/node/utils/ExportTxt.ts index ba4d9e19f..6396d3936 100644 --- a/src/node/utils/ExportTxt.ts +++ b/src/node/utils/ExportTxt.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * TXT export */ @@ -19,8 +19,8 @@ * limitations under the License. */ -import {AText, PadType} from "../types/PadType"; -import {MapType} from "../types/MapType"; +import type {AText, PadType} from "../types/PadType"; +import type {MapType} from "../types/MapType"; import {deserializeOps, splitAttributionLines, subattribution} from '../../static/js/Changeset'; import {StringIterator} from "../../static/js/StringIterator"; diff --git a/src/node/utils/ImportEtherpad.ts b/src/node/utils/ImportEtherpad.ts index cf34107c7..50832c8ca 100644 --- a/src/node/utils/ImportEtherpad.ts +++ b/src/node/utils/ImportEtherpad.ts @@ -1,4 +1,4 @@ -'use strict'; + import {APool} from "../types/PadType"; diff --git a/src/node/utils/ImportHtml.ts b/src/node/utils/ImportHtml.ts index 941aa767a..3aa72e30b 100644 --- a/src/node/utils/ImportHtml.ts +++ b/src/node/utils/ImportHtml.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Copyright Yaco Sistemas S.L. 2011. * @@ -19,7 +19,7 @@ import log4js from 'log4js'; import {deserializeOps} from '../../static/js/Changeset'; const contentcollector = require('../../static/js/contentcollector'); import jsdom from 'jsdom'; -import {PadType} from "../types/PadType"; +import type {PadType} from "../types/PadType"; import {Builder} from "../../static/js/Builder"; const apiLogger = log4js.getLogger('ImportHtml'); diff --git a/src/node/utils/LibreOffice.ts b/src/node/utils/LibreOffice.ts index e73fd144c..62f20be9b 100644 --- a/src/node/utils/LibreOffice.ts +++ b/src/node/utils/LibreOffice.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Controls the communication with LibreOffice */ diff --git a/src/node/utils/Minify.ts b/src/node/utils/Minify.ts index 8747ff04b..a12a2f159 100644 --- a/src/node/utils/Minify.ts +++ b/src/node/utils/Minify.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * This Module manages all /minified/* requests. It controls the @@ -21,7 +21,7 @@ * limitations under the License. */ -import {TransformResult} from "esbuild"; +import type {TransformResult} from "esbuild"; import mime from 'mime-types'; import log4js from 'log4js'; import {compressCSS, compressJS} from './MinifyWorker' @@ -64,7 +64,7 @@ const requestURI = async (url: string | URL, method: any, headers: { [x: string] writeHead: (_status: number, _headers: { [x: string]: any; }) => { status = _status; for (const header in _headers) { - if (Object.prototype.hasOwnProperty.call(_headers, header)) { + if (Object.hasOwn(_headers, header)) { headers[header] = _headers[header]; } } diff --git a/src/node/utils/MinifyWorker.ts b/src/node/utils/MinifyWorker.ts index cb278313c..55ce2b269 100644 --- a/src/node/utils/MinifyWorker.ts +++ b/src/node/utils/MinifyWorker.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Worker thread to minify JS & CSS files out of the main NodeJS thread */ diff --git a/src/node/utils/NodeVersion.ts b/src/node/utils/NodeVersion.ts index f24bf1831..bddb7c7fe 100644 --- a/src/node/utils/NodeVersion.ts +++ b/src/node/utils/NodeVersion.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Checks related to Node runtime version */ diff --git a/src/node/utils/Settings.ts b/src/node/utils/Settings.ts index 886350c59..76c368a94 100644 --- a/src/node/utils/Settings.ts +++ b/src/node/utils/Settings.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The Settings module reads the settings out of settings.json and provides * this information to the other modules @@ -27,7 +27,7 @@ * limitations under the License. */ -import {MapArrayType} from "../types/MapType"; +import type {MapArrayType} from "../types/MapType"; import {SettingsNode} from "./SettingsTree"; import * as absolutePaths from './AbsolutePaths'; @@ -807,7 +807,7 @@ const coerceValue = (stringValue: string) => { */ const lookupEnvironmentVariables = (obj: MapArrayType) => { const replaceEnvs = (obj: MapArrayType) => { - for (let [key, value] of Object.entries(obj)) { + for (const [key, value] of Object.entries(obj)) { /* * the first invocation of replacer() is with an empty key. Just go on, or * we would zap the entire object. @@ -907,16 +907,16 @@ const lookupEnvironmentVariables = (obj: MapArrayType) => { * If the key contains a double underscore, it's a plugin variable * E.g. */ - let treeEntries = new Map + const treeEntries = new Map const root = new SettingsNode("EP") - for (let [env, envVal] of Object.entries(process.env)) { + for (const [env, envVal] of Object.entries(process.env)) { if (!env.startsWith("EP")) continue treeEntries.set(env, envVal) } treeEntries.forEach((value, key) => { - let pathToKey = key.split("__") - let currentNode = root + const pathToKey = key.split("__") + const currentNode = root let depth = 0 depth++ currentNode.addChild(pathToKey, value!) diff --git a/src/node/utils/SettingsTree.ts b/src/node/utils/SettingsTree.ts index c505f2ebb..4ff786fdd 100644 --- a/src/node/utils/SettingsTree.ts +++ b/src/node/utils/SettingsTree.ts @@ -1,4 +1,4 @@ -import {MapArrayType} from "../types/MapType"; +import type {MapArrayType} from "../types/MapType"; export class SettingsTree { private children: Map; @@ -61,7 +61,7 @@ export class SettingsNode { public collectFromLeafsUpwards() { - let collected:MapArrayType = {}; + const collected:MapArrayType = {}; for (const key in this.children) { const child = this.children[key]; if (child.hasChildren()) { diff --git a/src/node/utils/Stream.ts b/src/node/utils/Stream.ts index 36fde1ac7..4e1696c3c 100644 --- a/src/node/utils/Stream.ts +++ b/src/node/utils/Stream.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Wrapper around any iterable that adds convenience methods that standard JavaScript iterable diff --git a/src/node/utils/UpdateCheck.ts b/src/node/utils/UpdateCheck.ts index da292e373..f21570daf 100644 --- a/src/node/utils/UpdateCheck.ts +++ b/src/node/utils/UpdateCheck.ts @@ -1,4 +1,4 @@ -'use strict'; + import semver from 'semver'; import settings, {getEpVersion} from './Settings'; import axios from 'axios'; diff --git a/src/node/utils/checkValidRev.ts b/src/node/utils/checkValidRev.ts index 5367ddf99..e734eaf1d 100644 --- a/src/node/utils/checkValidRev.ts +++ b/src/node/utils/checkValidRev.ts @@ -1,4 +1,4 @@ -'use strict'; + const CustomError = require('../utils/customError'); diff --git a/src/node/utils/customError.ts b/src/node/utils/customError.ts index c58360269..8d4e00dbc 100644 --- a/src/node/utils/customError.ts +++ b/src/node/utils/customError.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * CustomError * diff --git a/src/node/utils/padDiff.ts b/src/node/utils/padDiff.ts index 53f79fa56..fef688196 100644 --- a/src/node/utils/padDiff.ts +++ b/src/node/utils/padDiff.ts @@ -1,7 +1,7 @@ -'use strict'; -import {PadAuthor, PadType} from "../types/PadType"; -import {MapArrayType} from "../types/MapType"; + +import type {PadAuthor, PadType} from "../types/PadType"; +import type {MapArrayType} from "../types/MapType"; import AttributeMap from '../../static/js/AttributeMap'; import {applyToAText, checkRep, compose, deserializeOps, pack, splitAttributionLines, splitTextLines, unpack} from '../../static/js/Changeset'; @@ -461,7 +461,7 @@ class PadDiff { // this method is 80% like Changeset.inverse. I just changed so instead of reverting, // it adds deletions and attribute changes to the atext. // @ts-ignore -PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) { +PadDiff.prototype._createDeletionChangeset = (cs, startAText, apool) => { }; diff --git a/src/node/utils/path_exists.ts b/src/node/utils/path_exists.ts index cb48f2fa9..e17f9ddb0 100644 --- a/src/node/utils/path_exists.ts +++ b/src/node/utils/path_exists.ts @@ -1,4 +1,4 @@ -'use strict'; + import fs from 'node:fs'; const check = (path:string) => { diff --git a/src/node/utils/promises.ts b/src/node/utils/promises.ts index 9d07ed00b..5ad0d1873 100644 --- a/src/node/utils/promises.ts +++ b/src/node/utils/promises.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * Helpers to manipulate promises (like async but for promises). */ diff --git a/src/node/utils/run_cmd.ts b/src/node/utils/run_cmd.ts index c7e37b78c..d1c31ee37 100644 --- a/src/node/utils/run_cmd.ts +++ b/src/node/utils/run_cmd.ts @@ -1,9 +1,9 @@ -'use strict'; -import {ErrorExtended, RunCMDOptions, RunCMDPromise} from "../types/RunCMDOptions"; -import {ChildProcess} from "node:child_process"; -import {PromiseWithStd} from "../types/PromiseWithStd"; -import {Readable} from "node:stream"; + +import {type ErrorExtended, type RunCMDOptions, RunCMDPromise} from "../types/RunCMDOptions"; +import type {ChildProcess} from "node:child_process"; +import type {PromiseWithStd} from "../types/PromiseWithStd"; +import type {Readable} from "node:stream"; import spawn from 'cross-spawn'; import log4js from 'log4js'; diff --git a/src/node/utils/toolbar.ts b/src/node/utils/toolbar.ts index 461ede049..41926f6bf 100644 --- a/src/node/utils/toolbar.ts +++ b/src/node/utils/toolbar.ts @@ -1,4 +1,4 @@ -'use strict'; + /** * The Toolbar Module creates and renders the toolbars and buttons */ @@ -56,7 +56,7 @@ class ButtonGroup { this.buttons = [] } - public static fromArray = function (array: string[]) { + public static fromArray = (array: string[]) => { const btnGroup = new ButtonGroup(); each(array, (btnName: string) => { const button = Button.load(btnName) as Button