diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 7d832ed8..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - /* - 3urobeat's EsLint Config. Requires eslint & eslint-plugin-jsdoc to be installed as devDependencies. - https://github.com/3urobeat - */ - - "env": { - "commonjs": true, - "es6": true, - "node": true - }, - "extends": "eslint:recommended", - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly", - - "started": true, - "srcdir": true, - "botisloggedin": true, - "logger": true, - "extdata": true - }, - "parserOptions": { - "ecmaVersion": 11 - }, - "plugins": [ - "jsdoc" - ], - "rules": { - "no-var": "error", - "no-redeclare": "off", - "no-unreachable": "error", - "no-unexpected-multiline": "error", - - // Styling - "camelcase": "warn", - "capitalized-comments": ["warn", "always", { "ignoreConsecutiveComments": true }], - "comma-spacing": ["warn", { "before": false, "after": true }], - "func-call-spacing": ["error", "never"], - "indent": ["error", 4, { "ignoredNodes": ["IfStatement"], "SwitchCase": 1 }], // TODO: This also ignores if statements with wrong indentation but I couldn't get it to only ignore else in if-else one-liner - "no-tabs": "error", - "no-trailing-spaces": "error", - "no-extra-semi": "error", - "semi": ["error", "always"], - "semi-spacing": "error", - "semi-style": ["error", "last"], - "quotes": ["error", "double", { "avoidEscape": true }], - "spaced-comment": "warn", - - // JsDoc - https://github.com/gajus/eslint-plugin-jsdoc - "jsdoc/check-alignment": "warn", - "jsdoc/check-indentation": "warn", - "jsdoc/check-types": "warn", - "jsdoc/informative-docs": "warn", - "jsdoc/require-asterisk-prefix": "warn", - "jsdoc/require-description": "warn", - "jsdoc/require-jsdoc": "warn", - "jsdoc/require-param": "warn", - "jsdoc/require-param-name": "warn", - "jsdoc/valid-types": "warn", - //"jsdoc/require-returns": "warn", // Always requires @return, even when function does not return something - "jsdoc/require-returns-type": "warn", - //"jsdoc/require-returns-check": "warn", // Unnecessary when require-returns above is disabled - "jsdoc/require-returns-description": "warn" - }, - "ignorePatterns": ["src/libraryPatches/*"] -} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..ac9a12ce --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,90 @@ +/* + * File: eslint.config.mjs + * Project: steam-comment-service-bot + * Created Date: 2024-05-03 12:17:16 + * Author: 3urobeat + * + * Last Modified: 2024-05-03 12:58:49 + * Modified By: 3urobeat + * + * Copyright (c) 2024 3urobeat + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. If not, see . + */ + + +/* + 3urobeat's EsLint Config. Requires eslint, @eslint/js & eslint-plugin-jsdoc to be installed as devDependencies. + https://github.com/3urobeat +*/ + +import globals from "globals"; +import jsdoc from "eslint-plugin-jsdoc"; +import js from "@eslint/js"; + + +export default [ + { + ignores: ["src/libraryPatches/*"], + }, + js.configs.recommended, // Import recommended eslint rules + { + languageOptions: { + ecmaVersion: 2022, + sourceType: "module", + globals: { + ...globals.commonjs, + ...globals.es6, + ...globals.node, + + started: true, + srcdir: true, + botisloggedin: true, + logger: true, + extdata: true + } + }, + plugins: { + jsdoc: jsdoc + }, + rules: { + "no-var": "error", + "no-redeclare": "off", + "no-unreachable": "error", + "no-unexpected-multiline": "error", + + // Styling + "camelcase": "warn", + "capitalized-comments": ["warn", "always", { "ignoreConsecutiveComments": true }], + "comma-spacing": ["warn", { "before": false, "after": true }], + "func-call-spacing": ["error", "never"], + "indent": ["error", 4, { "ignoredNodes": ["IfStatement"], "SwitchCase": 1 }], // TODO: This also ignores if statements with wrong indentation but I couldn't get it to only ignore else in if-else one-liner + "no-tabs": "error", + "no-trailing-spaces": "error", + "no-extra-semi": "error", + "semi": ["error", "always"], + "semi-spacing": "error", + "semi-style": ["error", "last"], + "quotes": ["error", "double", { "avoidEscape": true }], + "spaced-comment": "warn", + + // JsDoc - https://github.com/gajus/eslint-plugin-jsdoc + "jsdoc/check-alignment": "warn", + "jsdoc/check-indentation": "warn", + "jsdoc/check-types": "warn", + "jsdoc/informative-docs": "warn", + "jsdoc/require-asterisk-prefix": "warn", + "jsdoc/require-description": "warn", + "jsdoc/require-jsdoc": "warn", + "jsdoc/require-param": "warn", + "jsdoc/require-param-name": "warn", + "jsdoc/valid-types": "warn", + // "jsdoc/require-returns": "warn", // Always requires @return, even when function does not return something + "jsdoc/require-returns-type": "warn", + // "jsdoc/require-returns-check": "warn", // Unnecessary when require-returns above is disabled + "jsdoc/require-returns-description": "warn" + } + } +]; diff --git a/package-lock.json b/package-lock.json index 9c1bbe39..b77f1913 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "steamid-resolver": "^1.3.4" }, "devDependencies": { + "@eslint/js": "^9.1.1", "eslint": "^9.1.1", "eslint-plugin-jsdoc": "^48.2.3", "tsd-jsdoc": "^2.5.0" diff --git a/package.json b/package.json index 92727988..03262a59 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "homepage": "https://github.com/3urobeat", "repository": "https://github.com/3urobeat/steam-comment-service-bot", "devDependencies": { + "@eslint/js": "^9.1.1", "eslint": "^9.1.1", "eslint-plugin-jsdoc": "^48.2.3", "tsd-jsdoc": "^2.5.0" diff --git a/src/bot/bot.js b/src/bot/bot.js index e0b1c0c3..e2bbdb31 100644 --- a/src/bot/bot.js +++ b/src/bot/bot.js @@ -4,7 +4,7 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2024-05-02 10:51:07 + * Last Modified: 2024-05-03 12:46:26 * Modified By: 3urobeat * * Copyright (c) 2021 - 2024 3urobeat @@ -133,7 +133,7 @@ const Bot = function(controller, index) { require("../libraryPatches/CSteamReviews.js"); require("../libraryPatches/reviews.js"); - if (global.checkm8!="b754jfJNgZWGnzogvl @@ -279,7 +279,7 @@ async function comment(commandHandler, resInfo, respond, postComment, commentArg // Comment numberOfComments times using our syncLoop helper - syncLoop(activeReqEntry.amount - (activeReqEntry.thisIteration + 1), (loop, i) => { // eslint-disable-line no-unused-vars + syncLoop(activeReqEntry.amount - (activeReqEntry.thisIteration + 1), (loop, i) => { setTimeout(async () => { diff --git a/src/commands/core/system.js b/src/commands/core/system.js index e09b8f6e..7ed6568c 100644 --- a/src/commands/core/system.js +++ b/src/commands/core/system.js @@ -4,7 +4,7 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2024-02-11 17:03:32 + * Last Modified: 2024-05-03 13:08:52 * Modified By: 3urobeat * * Copyright (c) 2021 - 2024 3urobeat @@ -233,7 +233,7 @@ module.exports.eval = { return; } - const clean = text => { // eslint-disable-line no-case-declarations + const clean = text => { if (typeof(text) === "string") return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)); else return text; }; diff --git a/src/commands/helpers/getMiscArgs.js b/src/commands/helpers/getMiscArgs.js index 5035f72b..65fcab38 100644 --- a/src/commands/helpers/getMiscArgs.js +++ b/src/commands/helpers/getMiscArgs.js @@ -4,7 +4,7 @@ * Created Date: 2023-05-28 12:18:49 * Author: 3urobeat * - * Last Modified: 2024-02-22 17:51:02 + * Last Modified: 2024-05-03 13:08:06 * Modified By: 3urobeat * * Copyright (c) 2023 - 2024 3urobeat @@ -60,7 +60,7 @@ module.exports.getMiscArgs = (commandHandler, args, cmd, resInfo, respond) => { } // Process input and check if ID is valid - commandHandler.controller.handleSteamIdResolving(args[1], null, async (err, destParam, idType) => { // eslint-disable-line no-unused-vars + commandHandler.controller.handleSteamIdResolving(args[1], null, async (err, destParam, idType) => { logger("debug", `CommandHandler getMiscArgs() success. amount: ${amount} | dest: ${destParam}`); resolve({ diff --git a/src/commands/helpers/handleCommentSkips.js b/src/commands/helpers/handleCommentSkips.js index eeab63fb..e4486b64 100644 --- a/src/commands/helpers/handleCommentSkips.js +++ b/src/commands/helpers/handleCommentSkips.js @@ -4,10 +4,10 @@ * Created Date: 2022-02-28 12:22:48 * Author: 3urobeat * - * Last Modified: 2023-12-27 14:04:37 + * Last Modified: 2024-05-03 13:08:38 * Modified By: 3urobeat * - * Copyright (c) 2022 - 2023 3urobeat + * Copyright (c) 2022 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -15,7 +15,7 @@ */ -const Bot = require("../../bot/bot.js"); // eslint-disable-line +const Bot = require("../../bot/bot.js"); const CommandHandler = require("../commandHandler.js"); // eslint-disable-line diff --git a/src/commands/helpers/handleFollowErrors.js b/src/commands/helpers/handleFollowErrors.js index 782d0cef..0d268861 100644 --- a/src/commands/helpers/handleFollowErrors.js +++ b/src/commands/helpers/handleFollowErrors.js @@ -4,10 +4,10 @@ * Created Date: 2023-09-24 22:57:21 * Author: 3urobeat * - * Last Modified: 2023-12-27 14:04:20 + * Last Modified: 2024-05-03 13:07:57 * Modified By: 3urobeat * - * Copyright (c) 2023 3urobeat + * Copyright (c) 2023 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -15,7 +15,7 @@ */ -const Bot = require("../../bot/bot.js"); // eslint-disable-line +const Bot = require("../../bot/bot.js"); /** diff --git a/src/commands/helpers/handleMiscErrors.js b/src/commands/helpers/handleMiscErrors.js index 9b07a88a..ce1f30ba 100644 --- a/src/commands/helpers/handleMiscErrors.js +++ b/src/commands/helpers/handleMiscErrors.js @@ -4,7 +4,7 @@ * Created Date: 2023-05-31 16:57:21 * Author: 3urobeat * - * Last Modified: 2024-02-20 17:19:26 + * Last Modified: 2024-05-03 13:07:47 * Modified By: 3urobeat * * Copyright (c) 2023 - 2024 3urobeat @@ -15,7 +15,7 @@ */ -const Bot = require("../../bot/bot.js"); // eslint-disable-line +const Bot = require("../../bot/bot.js"); /** diff --git a/src/controller/controller.js b/src/controller/controller.js index c858b395..dea4d1f8 100644 --- a/src/controller/controller.js +++ b/src/controller/controller.js @@ -4,7 +4,7 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2024-05-01 15:19:41 + * Last Modified: 2024-05-03 13:07:40 * Modified By: 3urobeat * * Copyright (c) 2021 - 2024 3urobeat @@ -53,7 +53,7 @@ const Controller = function() { * @param {number} timestamp UNIX timestamp to convert * @returns {string} "x seconds/minutes/hours/days" */ - timeToString: () => {}, // eslint-disable-line + timeToString: () => {}, /** * Pings a *https* URL to check if the service and this internet connection is working @@ -541,4 +541,4 @@ Controller.prototype._loggerOptionsUpdateAfterConfigLoad = function(advancedconf /** * Internal: Logs all held back messages from logAfterReady array */ -Controller.prototype._loggerLogAfterReady = function() {}; // eslint-disable-line +Controller.prototype._loggerLogAfterReady = function() {}; diff --git a/src/controller/events/statusUpdate.js b/src/controller/events/statusUpdate.js index 9109d8bf..df34c7d0 100644 --- a/src/controller/events/statusUpdate.js +++ b/src/controller/events/statusUpdate.js @@ -4,7 +4,7 @@ * Created Date: 2023-03-30 21:05:13 * Author: 3urobeat * - * Last Modified: 2024-03-08 17:49:26 + * Last Modified: 2024-05-03 13:00:59 * Modified By: 3urobeat * * Copyright (c) 2023 - 2024 3urobeat @@ -15,7 +15,7 @@ */ -const Bot = require("../../bot/bot.js"); // eslint-disable-line +const Bot = require("../../bot/bot.js"); const Controller = require("../controller"); diff --git a/src/data/fileStructure.json b/src/data/fileStructure.json index 11dfb242..441d2927 100644 --- a/src/data/fileStructure.json +++ b/src/data/fileStructure.json @@ -1,10 +1,5 @@ { "files": [ - { - "path": ".eslintrc.json", - "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/.eslintrc.json", - "checksum": "982f55cc4c53137135b87df43bbfe9c8" - }, { "path": ".github/FUNDING.yml", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/.github/FUNDING.yml", @@ -285,6 +280,11 @@ "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/docs/wiki/version_changelogs.md", "checksum": "608963ede0ef27d65adcb294666812d3" }, + { + "path": "eslint.config.mjs", + "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/eslint.config.mjs", + "checksum": "390ba7cd47f19e134891ad93f9e42918" + }, { "path": "scripts/README.md", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/scripts/README.md", @@ -318,7 +318,7 @@ { "path": "src/bot/bot.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/bot/bot.js", - "checksum": "fecb280b21cb7469ea5ff56827ce60de" + "checksum": "97b6b1fb055bd3a19c11bbe68147b8c5" }, { "path": "src/bot/events/debug.js", @@ -393,7 +393,7 @@ { "path": "src/commands/core/comment.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/core/comment.js", - "checksum": "99ec8c17453e2a055028df6024911c56" + "checksum": "c2b6ae8c06b983194d100754c65ccb61" }, { "path": "src/commands/core/favorite.js", @@ -433,7 +433,7 @@ { "path": "src/commands/core/system.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/core/system.js", - "checksum": "ae3a4efd8a7230c45211f8f80adb25c6" + "checksum": "f32dc19d1466840cce5ecc7703b4c569" }, { "path": "src/commands/core/vote.js", @@ -468,7 +468,7 @@ { "path": "src/commands/helpers/getMiscArgs.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/helpers/getMiscArgs.js", - "checksum": "488803b1fe38671e2f0d339a9c692db5" + "checksum": "9d36d31af5fa1930d4d16cefe026bfc2" }, { "path": "src/commands/helpers/getVoteBots.js", @@ -478,22 +478,22 @@ { "path": "src/commands/helpers/handleCommentSkips.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/helpers/handleCommentSkips.js", - "checksum": "8279c8a9a1d624f2212050b5b98cbca2" + "checksum": "65c29b579867daa47fb59dc921c17827" }, { "path": "src/commands/helpers/handleFollowErrors.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/helpers/handleFollowErrors.js", - "checksum": "18054a4221e795a8c5530b5a55a014ae" + "checksum": "f0901c92f89131bec0c990c0d1b553ae" }, { "path": "src/commands/helpers/handleMiscErrors.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/commands/helpers/handleMiscErrors.js", - "checksum": "9a48943369e29712e578e9b363d98545" + "checksum": "8069eda53d2ce41b38aeded139a80904" }, { "path": "src/controller/controller.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/controller/controller.js", - "checksum": "fd28817485832dadb454cef17b782c51" + "checksum": "a55c0f566ada510e247bd9d45322279b" }, { "path": "src/controller/events/ready.js", @@ -503,7 +503,7 @@ { "path": "src/controller/events/statusUpdate.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/controller/events/statusUpdate.js", - "checksum": "5a7c66ae19eb320bacf6d2c2abeba9d6" + "checksum": "fa1f97966de3948e186e025ce13c1495" }, { "path": "src/controller/events/steamGuardInput.js", @@ -588,7 +588,7 @@ { "path": "src/dataManager/dataCheck.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/dataManager/dataCheck.js", - "checksum": "12dce4d35da119566ef427ab5b6d49c5" + "checksum": "924a09d6c37e985f58a94335b2dfdc9d" }, { "path": "src/dataManager/dataExport.js", @@ -653,7 +653,7 @@ { "path": "src/dataManager/helpers/repairFile.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/dataManager/helpers/repairFile.js", - "checksum": "283942ba224a393abde0980f7ab3ef63" + "checksum": "94a83348ebe8e20c70d5c16cf77f8689" }, { "path": "src/jobs/jobManager.js", @@ -713,7 +713,7 @@ { "path": "src/pluginSystem/loadPlugins.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/pluginSystem/loadPlugins.js", - "checksum": "a2889cdf46fa8876a767ab272356b3f9" + "checksum": "035ff994c7c3c3b13009f74bea2b390c" }, { "path": "src/pluginSystem/pluginSystem.js", @@ -743,12 +743,12 @@ { "path": "src/sessions/sessionHandler.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/sessions/sessionHandler.js", - "checksum": "1138f9e889c9f4789b4c7f39766a486a" + "checksum": "6c09b6570a353148cd222757f3592118" }, { "path": "src/starter.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/starter.js", - "checksum": "b106db2dbc61e544e8f1eb37cba99d69" + "checksum": "49fb8d6713e069dddade6761a1ba03bc" }, { "path": "src/updater/compatibility/2060.js", @@ -828,12 +828,12 @@ { "path": "src/updater/helpers/prepareUpdate.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/updater/helpers/prepareUpdate.js", - "checksum": "eea0c957cfb4f73c15a0fdd78f6e9a68" + "checksum": "5acced2a4a6accfcfdd9a5a0d3ea5259" }, { "path": "src/updater/helpers/restoreBackup.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/updater/helpers/restoreBackup.js", - "checksum": "02224a065b6b3cf13558e13c487511a3" + "checksum": "aee115164a1dd4bd9842af5644094e3b" }, { "path": "src/updater/updater.js", @@ -843,7 +843,7 @@ { "path": "start.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/start.js", - "checksum": "afc9710e045984455ca0936fec484f1a" + "checksum": "3a2434b53fdb63ce224c0dfdfd7df04c" }, { "path": "types/types.d.ts", diff --git a/src/dataManager/dataCheck.js b/src/dataManager/dataCheck.js index 2a04b6dc..32104387 100644 --- a/src/dataManager/dataCheck.js +++ b/src/dataManager/dataCheck.js @@ -4,7 +4,7 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2024-05-01 13:38:35 + * Last Modified: 2024-05-03 13:00:04 * Modified By: 3urobeat * * Copyright (c) 2023 - 2024 3urobeat @@ -110,7 +110,7 @@ DataManager.prototype.checkData = function() { logWarn("warn", `You've set an invalid value '${this.advancedconfig.onlineStatus}' as 'onlineStatus' in 'advancedconfig.json'! Defaulting to 'Online'...`); this.advancedconfig.onlineStatus = "Online"; } - if (!EPersonaState[this.advancedconfig.childAccOnlineStatus] == undefined) { // Explicitly check for undefined because Offline (0) resolves to false + if (EPersonaState[this.advancedconfig.childAccOnlineStatus] != undefined) { // Explicitly check for undefined because Offline (0) resolves to false logWarn("warn", `You've set an invalid value '${this.advancedconfig.childAccOnlineStatus}' as 'childAccOnlineStatus' in 'advancedconfig.json'! Defaulting to 'Online'...`); this.advancedconfig.childAccOnlineStatus = "Online"; } diff --git a/src/dataManager/helpers/repairFile.js b/src/dataManager/helpers/repairFile.js index afe81c9e..fec2863a 100644 --- a/src/dataManager/helpers/repairFile.js +++ b/src/dataManager/helpers/repairFile.js @@ -4,10 +4,10 @@ * Created Date: 2023-03-22 12:35:01 * Author: 3urobeat * - * Last Modified: 2023-12-27 14:13:14 + * Last Modified: 2024-05-03 12:59:23 * Modified By: 3urobeat * - * Copyright (c) 2023 3urobeat + * Copyright (c) 2023 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -43,7 +43,7 @@ DataManager.prototype._restoreBackup = function(name, filepath, cacheentry, onli .replace(/\]"/g, "]") .replace(/\\"/g, '"') .replace(/""/g, '""'); - } catch (err) { + } catch { stringified = JSON.stringify(cacheentry, null, 4); } @@ -63,7 +63,7 @@ DataManager.prototype._restoreBackup = function(name, filepath, cacheentry, onli logger("info", `Successfully restored backup of '${name}'!\n`, true); resolve(require(filepath)); - } catch (err) { // Worst case, even the backup seems to be broken (seems like this can't happen anymore since 2.11 because cache.json will get cleared before we get here if it contains an error) + } catch { // Worst case, even the backup seems to be broken (seems like this can't happen anymore since 2.11 because cache.json will get cleared before we get here if it contains an error) this._pullNewFile(name, filepath, resolve); } diff --git a/src/pluginSystem/loadPlugins.js b/src/pluginSystem/loadPlugins.js index 2bc71bdc..06d4ed80 100644 --- a/src/pluginSystem/loadPlugins.js +++ b/src/pluginSystem/loadPlugins.js @@ -4,7 +4,7 @@ * Created Date: 2023-06-04 15:37:17 * Author: DerDeathraven * - * Last Modified: 2024-05-01 14:54:49 + * Last Modified: 2024-05-03 12:52:12 * Modified By: 3urobeat * * Copyright (c) 2023 - 2024 3urobeat @@ -153,7 +153,6 @@ PluginSystem.prototype._loadPlugins = async function () { // Call the exposed event functions if they exist Object.entries(PLUGIN_EVENTS).forEach(([eventName, event]) => { // eslint-disable-line no-unused-vars - // eslint-disable-line this.controller.events.on(event, (...args) => pluginInstance[event]?.call(pluginInstance, ...args)); }); } diff --git a/src/sessions/sessionHandler.js b/src/sessions/sessionHandler.js index 37e4d2d4..52ec74d4 100644 --- a/src/sessions/sessionHandler.js +++ b/src/sessions/sessionHandler.js @@ -4,7 +4,7 @@ * Created Date: 2022-10-09 12:47:27 * Author: 3urobeat * - * Last Modified: 2024-02-28 22:31:15 + * Last Modified: 2024-05-03 12:51:51 * Modified By: 3urobeat * * Copyright (c) 2022 - 2024 3urobeat @@ -15,7 +15,7 @@ */ -const SteamSession = require("steam-session"); // eslint-disable-line +const SteamSession = require("steam-session"); const Bot = require("../bot/bot.js"); // eslint-disable-line const EStatus = require("../bot/EStatus.js"); diff --git a/src/starter.js b/src/starter.js index 3b9151d8..a7d3aeed 100644 --- a/src/starter.js +++ b/src/starter.js @@ -4,10 +4,10 @@ * Created Date: 2021-07-10 10:26:00 * Author: 3urobeat * - * Last Modified: 2023-12-27 14:17:17 + * Last Modified: 2024-05-03 12:51:33 * Modified By: 3urobeat * - * Copyright (c) 2021 - 2023 3urobeat + * Copyright (c) 2021 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -264,7 +264,7 @@ module.exports.checkAndGetFile = (file, logger, norequire = false, force = false try { branch = require("./data/data.json").branch; // Try to read from data.json - } catch (err) { + } catch { try { let otherdata = require("./data.json"); // Then try to get the other, "compatibility" data file to check if versionstr includes the word BETA @@ -335,7 +335,7 @@ module.exports.checkAndGetFile = (file, logger, norequire = false, force = false let fileToLoad = require("." + file); resolve(fileToLoad); // Seems to be fine, otherwise we would already be in the catch block - } catch (err) { + } catch { logger("warn", `It looks like file ${file} is corrupted. Trying to pull new file from GitHub...`, false, true); getNewFile(); diff --git a/src/updater/helpers/prepareUpdate.js b/src/updater/helpers/prepareUpdate.js index 08e5f04e..960c7d03 100644 --- a/src/updater/helpers/prepareUpdate.js +++ b/src/updater/helpers/prepareUpdate.js @@ -4,10 +4,10 @@ * Created Date: 2021-07-09 16:26:00 * Author: 3urobeat * - * Last Modified: 2023-12-27 14:18:10 + * Last Modified: 2024-05-03 12:51:26 * Modified By: 3urobeat * - * Copyright (c) 2021 - 2023 3urobeat + * Copyright (c) 2021 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -34,7 +34,7 @@ module.exports.run = (controller, respondModule, resInfo) => { logger("info", "Bot is logged in. Checking for active requests...", false, true, logger.animation("loading")); - /* eslint-disable no-inner-declarations, jsdoc/require-jsdoc */ + /* eslint-disable jsdoc/require-jsdoc */ function initiateUpdate() { // Make initiating the update a function to simplify the activerequest check below controller.info.relogAfterDisconnect = false; // Prevents disconnect event (which will be called by logOff) to relog accounts @@ -72,7 +72,7 @@ module.exports.run = (controller, respondModule, resInfo) => { initiateUpdate(); } } - /* eslint-enable no-inner-declarations, jsdoc/require-jsdoc */ + /* eslint-enable jsdoc/require-jsdoc */ // Check for active request process. If obj not empty then first sort out all invalid/expired entries. diff --git a/src/updater/helpers/restoreBackup.js b/src/updater/helpers/restoreBackup.js index 17cdab3a..334e6a48 100644 --- a/src/updater/helpers/restoreBackup.js +++ b/src/updater/helpers/restoreBackup.js @@ -4,10 +4,10 @@ * Created Date: 2022-02-26 20:16:44 * Author: 3urobeat * - * Last Modified: 2023-12-27 14:18:01 + * Last Modified: 2024-05-03 12:49:17 * Modified By: 3urobeat * - * Copyright (c) 2022 - 2023 3urobeat + * Copyright (c) 2022 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -38,7 +38,7 @@ module.exports.run = () => { * @param {string} dest To path * @param {boolean} firstCall Set to `true` on first call, will be set to `false` on recursive call */ - function copyFolderRecursiveSync(src, dest, firstCall) { // eslint-disable-line no-inner-declarations + function copyFolderRecursiveSync(src, dest, firstCall) { let files = []; // Check if folder needs to be created diff --git a/start.js b/start.js index 4bd7e33e..d8517cd1 100644 --- a/start.js +++ b/start.js @@ -4,10 +4,10 @@ * Created Date: 2020-01-15 10:38:00 * Author: 3urobeat * - * Last Modified: 2023-12-27 13:57:29 + * Last Modified: 2024-05-03 12:51:07 * Modified By: 3urobeat * - * Copyright (c) 2020 - 2023 3urobeat + * Copyright (c) 2020 - 2024 3urobeat * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -29,7 +29,7 @@ function getExtdata() { try { // Just try to require, if it should fail then the actual restoring process will be handled later return require("./src/data/data.json"); - } catch (err) { + } catch { return { filetostart: "./src/starter.js", filetostarturl: "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/starter.js" }; } }