Skip to content

Commit 5cf9f12

Browse files
committed
fix: eslint issue
1 parent 461a6f3 commit 5cf9f12

27 files changed

+44
-68
lines changed

controllers/tasks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ const updateTaskStatus = async (req, res, next) => {
375375
const isCurrProgress100 = parseInt(task.taskData.percentCompleted || 0) === 100;
376376
const isCurrProgress0 = parseInt(task.taskData.percentCompleted || 0) === 0;
377377
const isNewProgress100 = !!req.body.percentCompleted && parseInt(req.body.percentCompleted) === 100;
378-
const isNewProgress0 = !!req.body.percentCompleted !== undefined && parseInt(req.body.percentCompleted) === 0;
378+
const percentCompleted = req.body.percentCompleted;
379+
const isNewProgress0 = percentCompleted !== undefined && parseInt(percentCompleted) === 0;
379380

380381
if (
381382
!isCurrProgress100 &&

eslint.config.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
const { defineConfig } = require("eslint/config");
2-
const globals = require("globals");
3-
const mocha = require("eslint-plugin-mocha");
4-
const security = require("eslint-plugin-security");
5-
const prettier = require("eslint-plugin-prettier");
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import mochaPlugin from "eslint-plugin-mocha";
4+
import securityPlugin from "eslint-plugin-security";
5+
import prettierPlugin from "eslint-plugin-prettier";
66

7-
module.exports = defineConfig([
7+
export default [
88
{
99
ignores: ["dist/*", "**/.eslintrc.js", "public/*"],
1010
},
11+
js.configs.recommended,
1112
{
1213
languageOptions: {
14+
ecmaVersion: "latest",
15+
sourceType: "module",
1316
globals: {
14-
...globals.commonjs,
1517
...globals.node,
1618
...globals.mocha,
17-
...globals.es2021,
1819
config: "readonly",
1920
logger: "readonly",
2021
},
21-
22-
ecmaVersion: 13,
23-
parserOptions: {},
2422
},
25-
2623
plugins: {
27-
mocha,
28-
security,
29-
prettier,
24+
mocha: mochaPlugin,
25+
security: securityPlugin,
26+
prettier: prettierPlugin,
3027
},
31-
3228
rules: {
3329
// Custom eslint rules
3430
"no-trailing-spaces": "error",
3531
"consistent-return": "error",
3632
"no-console": "error",
3733

38-
// Custom mocha rules
39-
"mocha/no-skipped-tests": "error",
34+
// Mocha rules
4035
"mocha/no-exclusive-tests": "error",
4136

4237
// Prettier for formatting
4338
"prettier/prettier": "error",
39+
40+
"no-unused-vars": "off",
4441
},
42+
ignores: ["public/*", "dist/*"],
4543
},
46-
]);
44+
];

models/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const createEventCode = async (eventCodeData) => {
214214
const data = docSnapshot.data();
215215

216216
const previouslyPresentEventCodes = eventSnapshotData?.event_codes?.by_role?.mavens && [
217-
...eventSnapshotData?.event_codes?.by_role?.mavens,
217+
...eventSnapshotData.event_codes.by_role.mavens,
218218
];
219219

220220
if (!data) throw new Error();

models/items.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ const getItemBasedOnFilter = async (query) => {
7070
try {
7171
let call = itemTagsModel;
7272
Object.keys(query).forEach((key) => {
73-
// eslint-disable-next-line security/detect-object-injection
7473
call = call.where(key, "==", query[key]);
7574
});
7675
const items = [];

models/logs.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ const fetchLogs = async (query, param) => {
4646
try {
4747
let call = logsModel.where("type", "==", param);
4848
Object.keys(query).forEach((key) => {
49-
// eslint-disable-next-line security/detect-object-injection
5049
if (key !== "limit" && key !== "lastDocId") {
51-
// eslint-disable-next-line security/detect-object-injection
5250
call = call.where(key, "==", query[key]);
5351
}
5452
});

models/userStatus.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
const { Forbidden, NotFound } = require("http-errors");
32
const admin = require("firebase-admin");
43
const firestore = require("../utils/firestore");

server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ function onError(error) {
5454
case "EACCES":
5555
logger.error(bind + " requires elevated privileges");
5656
process.exit(1);
57-
// eslint-disable-next-line no-unreachable
57+
5858
break;
5959

6060
case "EADDRINUSE":
6161
logger.error(bind + " is already in use");
6262
process.exit(1);
63-
// eslint-disable-next-line no-unreachable
63+
6464
break;
6565

6666
default:

services/discordService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const setInDiscordFalseScript = async () => {
4444
const updateUsersPromises = [];
4545
users.forEach((user) => {
4646
const id = user.id;
47-
// eslint-disable-next-line security/detect-object-injection
47+
4848
delete user[id];
4949
const userData = {
5050
...user,

test/fixtures/discordResponse/discord-response.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ const getOnboarding31DPlusMembers = [
273273
nick: "john",
274274
pending: false,
275275
premium_since: null,
276-
// eslint-disable-next-line no-loss-of-precision
276+
277277
roles: ["9876543210", "11334336"],
278278
user: {
279279
id: "9653710123456",

test/integration/contributions.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-unused-expressions */
21
const chai = require("chai");
32
const sinon = require("sinon");
43
const { expect } = chai;

0 commit comments

Comments
 (0)