From 9c55a8a4aa94e0f870abf626360af7c72af3d280 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:43:31 -0700 Subject: [PATCH] chore: enable no-deprecated warning (#2762) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2762 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- .eslintrc | 3 ++- src/controllers/api/focusController.ts | 2 +- .../custom/getItemListsController.ts | 4 ++-- src/routes/cache.ts | 4 ++-- src/services/inventoryService.ts | 20 +++++++++---------- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.eslintrc b/.eslintrc index d21f4aa7..aa48d5e1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -31,7 +31,8 @@ "no-mixed-spaces-and-tabs": "error", "@typescript-eslint/require-await": "error", "import/no-named-as-default-member": "off", - "import/no-cycle": "warn" + "import/no-cycle": "warn", + "@typescript-eslint/no-deprecated": "warn" }, "parser": "@typescript-eslint/parser", "parserOptions": { diff --git a/src/controllers/api/focusController.ts b/src/controllers/api/focusController.ts index 415f84e0..f838a9f4 100644 --- a/src/controllers/api/focusController.ts +++ b/src/controllers/api/focusController.ts @@ -231,7 +231,7 @@ interface ILensInstallRequest { // Works for ways & upgrades const focusTypeToPolarity = (type: string): TFocusPolarity => { - return ("AP_" + type.substr(1).split("/")[3].toUpperCase()) as TFocusPolarity; + return ("AP_" + type.substring(1).split("/")[3].toUpperCase()) as TFocusPolarity; }; const shardValues = { diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 35189e60..ee90958d 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -70,7 +70,7 @@ const relicQualitySuffixes: Record = { }; /*const toTitleCase = (str: string): string => { - return str.replace(/[^\s-]+/g, word => word.charAt(0).toUpperCase() + word.substr(1).toLowerCase()); + return str.replace(/[^\s-]+/g, word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase()); };*/ const getItemListsController: RequestHandler = (req, response) => { @@ -221,7 +221,7 @@ const getItemListsController: RequestHandler = (req, response) => { } if ( name && - uniqueName.substr(0, 30) != "/Lotus/Types/Game/Projections/" && + uniqueName.substring(0, 30) != "/Lotus/Types/Game/Projections/" && uniqueName != "/Lotus/Types/Gameplay/EntratiLab/Resources/EntratiLanthornBundle" ) { res.miscitems.push({ diff --git a/src/routes/cache.ts b/src/routes/cache.ts index 7c450ac6..d9ca7c8a 100644 --- a/src/routes/cache.ts +++ b/src/routes/cache.ts @@ -14,8 +14,8 @@ cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/[0-9]+\/H\.Cache\.bin.*$/, (req, res) cacheRouter.get(/^\/0\/.+!.+$/, async (req, res) => { try { - const dir = req.path.substr(0, req.path.lastIndexOf("/")); - const file = req.path.substr(dir.length + 1); + const dir = req.path.substring(0, req.path.lastIndexOf("/")); + const file = req.path.substring(dir.length + 1); const filePath = `static/data${dir}/${file}`; // Return file if we have it diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index ddd855ca..b3c2d2c6 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -687,10 +687,10 @@ export const addItem = async ( } // Path-based duck typing - switch (typeName.substr(1).split("/")[1]) { + switch (typeName.substring(1).split("/")[1]) { case "Powersuits": if (typeName.endsWith("AugmentCard")) break; - switch (typeName.substr(1).split("/")[2]) { + switch (typeName.substring(1).split("/")[2]) { default: { return { ...(await addPowerSuit(inventory, typeName, { @@ -725,7 +725,7 @@ export const addItem = async ( } break; case "Upgrades": { - switch (typeName.substr(1).split("/")[2]) { + switch (typeName.substring(1).split("/")[2]) { case "Mods": // Legendary Core case "CosmeticEnhancers": // Traumatic Peculiar { @@ -782,12 +782,12 @@ export const addItem = async ( break; } case "Types": - switch (typeName.substr(1).split("/")[2]) { + switch (typeName.substring(1).split("/")[2]) { case "Sentinels": { return addSentinel(inventory, typeName, premiumPurchase); } case "Game": { - if (typeName.substr(1).split("/")[3] == "Projections") { + if (typeName.substring(1).split("/")[3] == "Projections") { // Void Relics, e.g. /Lotus/Types/Game/Projections/T2VoidProjectionGaussPrimeDBronze const miscItemChanges = [ { @@ -801,8 +801,8 @@ export const addItem = async ( MiscItems: miscItemChanges }; } else if ( - typeName.substr(1).split("/")[3] == "CatbrowPet" || - typeName.substr(1).split("/")[3] == "KubrowPet" + typeName.substring(1).split("/")[3] == "CatbrowPet" || + typeName.substring(1).split("/")[3] == "KubrowPet" ) { if ( typeName != "/Lotus/Types/Game/KubrowPet/Eggs/KubrowPetEggItem" && @@ -826,7 +826,7 @@ export const addItem = async ( break; } case "Items": { - if (typeName.substr(1).split("/")[3] == "Emotes") { + if (typeName.substring(1).split("/")[3] == "Emotes") { return addCustomization(inventory, typeName); } break; @@ -875,8 +875,8 @@ export const addItem = async ( } break; case "Weapons": { - if (typeName.substr(1).split("/")[4] == "MeleeTrees") break; - const productCategory = typeName.substr(1).split("/")[3]; + if (typeName.substring(1).split("/")[4] == "MeleeTrees") break; + const productCategory = typeName.substring(1).split("/")[3]; switch (productCategory) { case "Pistols": case "LongGuns":