Skip to content

Commit

Permalink
feat: Migrate eslint config for v9
Browse files Browse the repository at this point in the history
  • Loading branch information
3urobeat committed May 3, 2024
1 parent 7f6e337 commit 92a661c
Show file tree
Hide file tree
Showing 22 changed files with 158 additions and 134 deletions.
67 changes: 0 additions & 67 deletions .eslintrc.json

This file was deleted.

90 changes: 90 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/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 <https://www.gnu.org/licenses/>.
*/


/*
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"
}
}
];
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/bot/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/3urobeat>
Expand Down Expand Up @@ -133,7 +133,7 @@ const Bot = function(controller, index) {
require("../libraryPatches/CSteamReviews.js");
require("../libraryPatches/reviews.js");

if (global.checkm8!="b754jfJNgZWGnzogvl<rsHGTR4e368essegs9<") this.controller.stop(); // eslint-disable-line
if (global.checkm8!="b754jfJNgZWGnzogvl<rsHGTR4e368essegs9<") this.controller.stop();


// Attach all SteamUser event listeners we need
Expand Down
4 changes: 2 additions & 2 deletions src/commands/core/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: 2021-07-09 16:26:00
* Author: 3urobeat
*
* Last Modified: 2024-03-02 13:48:36
* Last Modified: 2024-05-03 13:08:59
* Modified By: 3urobeat
*
* Copyright (c) 2021 - 2024 3urobeat <https://github.com/3urobeat>
Expand Down Expand Up @@ -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 () => {

Expand Down
4 changes: 2 additions & 2 deletions src/commands/core/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/3urobeat>
Expand Down Expand Up @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions src/commands/helpers/getMiscArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/3urobeat>
Expand Down Expand Up @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions src/commands/helpers/handleCommentSkips.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* 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 <https://github.com/3urobeat>
* Copyright (c) 2022 - 2024 3urobeat <https://github.com/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 <https://www.gnu.org/licenses/>.
*/


const Bot = require("../../bot/bot.js"); // eslint-disable-line
const Bot = require("../../bot/bot.js");
const CommandHandler = require("../commandHandler.js"); // eslint-disable-line


Expand Down
6 changes: 3 additions & 3 deletions src/commands/helpers/handleFollowErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* 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 <https://github.com/3urobeat>
* Copyright (c) 2023 - 2024 3urobeat <https://github.com/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 <https://www.gnu.org/licenses/>.
*/


const Bot = require("../../bot/bot.js"); // eslint-disable-line
const Bot = require("../../bot/bot.js");


/**
Expand Down
4 changes: 2 additions & 2 deletions src/commands/helpers/handleMiscErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/3urobeat>
Expand All @@ -15,7 +15,7 @@
*/


const Bot = require("../../bot/bot.js"); // eslint-disable-line
const Bot = require("../../bot/bot.js");


/**
Expand Down
6 changes: 3 additions & 3 deletions src/controller/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/3urobeat>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() {};
4 changes: 2 additions & 2 deletions src/controller/events/statusUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/3urobeat>
Expand All @@ -15,7 +15,7 @@
*/


const Bot = require("../../bot/bot.js"); // eslint-disable-line
const Bot = require("../../bot/bot.js");
const Controller = require("../controller");


Expand Down

1 comment on commit 92a661c

@3urobeat
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was meant to be tagged with chore, not feat. Whoops!

Please sign in to comment.