Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [22.10.0]
node-version: [22.16.0]

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion controllers/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
message: "task returned successfully",
taskData: { ...taskData, dependsOn: dependencyDocReference },
});
} catch (err) {

Check warning on line 297 in controllers/tasks.js

View workflow job for this annotation

GitHub Actions / build (22.16.0)

'err' is defined but never used
return res.boom.badImplementation(INTERNAL_SERVER_ERROR);
}
};
Expand Down Expand Up @@ -348,7 +348,7 @@
* @param req {Object} - Express request object
* @param res {Object} - Express response object
*/
const updateTaskStatus = async (req, res, next) => {

Check warning on line 351 in controllers/tasks.js

View workflow job for this annotation

GitHub Actions / build (22.16.0)

'next' is defined but never used
try {
req.body.updatedAt = Math.round(new Date().getTime() / 1000);
let userStatusUpdate;
Expand All @@ -375,7 +375,8 @@
const isCurrProgress100 = parseInt(task.taskData.percentCompleted || 0) === 100;
const isCurrProgress0 = parseInt(task.taskData.percentCompleted || 0) === 0;
const isNewProgress100 = !!req.body.percentCompleted && parseInt(req.body.percentCompleted) === 100;
const isNewProgress0 = !!req.body.percentCompleted !== undefined && parseInt(req.body.percentCompleted) === 0;
const percentCompleted = req.body.percentCompleted;
const isNewProgress0 = percentCompleted !== undefined && parseInt(percentCompleted) === 0;

if (
!isCurrProgress100 &&
Expand Down
44 changes: 44 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import js from "@eslint/js";
import globals from "globals";
import mochaPlugin from "eslint-plugin-mocha";
import securityPlugin from "eslint-plugin-security";
import prettierPlugin from "eslint-plugin-prettier";

export default [
{
ignores: ["dist/*", "**/.eslintrc.js", "public/*"],
},
js.configs.recommended,
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.node,
...globals.mocha,
config: "readonly",
logger: "readonly",
},
},
plugins: {
mocha: mochaPlugin,
security: securityPlugin,
prettier: prettierPlugin,
},
rules: {
// Custom eslint rules
"no-trailing-spaces": "error",
"consistent-return": "error",
"no-console": "error",

// Mocha rules
"mocha/no-pending-tests": "error",
"mocha/no-exclusive-tests": "error",

// Prettier for formatting
"prettier/prettier": "error",

"no-unused-vars": "warn",
},
},
];
2 changes: 1 addition & 1 deletion models/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const createEventCode = async (eventCodeData) => {
const data = docSnapshot.data();

const previouslyPresentEventCodes = eventSnapshotData?.event_codes?.by_role?.mavens && [
...eventSnapshotData?.event_codes?.by_role?.mavens,
...eventSnapshotData.event_codes.by_role.mavens,
];

if (!data) throw new Error();
Expand Down
78 changes: 40 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,75 +16,77 @@
"tdd:watch": "sh scripts/tests/tdd.sh"
},
"dependencies": {
"@aws-sdk/client-identitystore": "^3.665.0",
"@types/nodemailer": "^6.4.15",
"axios": "1.7.4",
"cloudinary": "2.0.3",
"@aws-sdk/client-identitystore": "3.821.0",
"@types/nodemailer": "6.4.17",
"axios": "1.9.0",
"cloudinary": "2.6.1",
"config": "3.3.7",
"cookie-parser": "1.4.6",
"cookie-parser": "1.4.7",
"cors": "2.8.5",
"datauri": "4.1.0",
"debug": "4.3.5",
"express": "~4.18.3",
"debug": "4.4.1",
"express": "5.1.0",
"express-boom": "3.0.0",
"firebase-admin": "12.1.1",
"firebase-admin": "13.4.0",
"helmet": "7.1.0",
"http-errors": "~2.0.0",
"joi": "17.12.2",
"jsdoc": "4.0.2",
"joi": "17.13.3",
"jsdoc": "4.0.4",
"jsonwebtoken": "^8.5.1",
"morgan": "1.10.0",
"multer": "1.4.5-lts.1",
"newrelic": "11.19.0",
"nodemailer": "^6.9.15",
"nodemailer-mock": "^2.0.6",
"newrelic": "12.20.0",
"nodemailer": "7.0.3",
"nodemailer-mock": "2.0.8",
"passport": "0.7.0",
"passport-github2": "0.1.12",
"passport-google-oauth20": "^2.0.0",
"rate-limiter-flexible": "5.0.3",
"winston": "3.13.0"
"rate-limiter-flexible": "7.1.1",
"winston": "3.17.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.9",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "9.28.0",
"@types/chai": "4.3.16",
"@types/config": "3.3.4",
"@types/config": "3.3.5",
"@types/express": "4.17.21",
"@types/jest": "29.5.12",
"@types/mocha": "10.0.6",
"@types/node": "20.11.24",
"@types/sinon": "17.0.3",
"@typescript-eslint/parser": "^7.1.1",
"@types/jest": "29.5.14",
"@types/mocha": "10.0.10",
"@types/node": "22.15.29",
"@types/sinon": "17.0.4",
"@typescript-eslint/parser": "8.33.0",
"chai": "4.4.1",
"chai-http": "4.4.0",
"cross-env": "7.0.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-mocha": "^10.0.0",
"eslint": "9.28.0",
"eslint-config-prettier": "10.1.5",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-mocha": "^11.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-security": "^1.7.1",
"firebase-tools": "13.4.0",
"mocha": "10.3.0",
"eslint-plugin-prettier": "5.4.1",
"eslint-plugin-security": "^3.0.1",
"firebase-tools": "14.5.1",
"globals": "^16.2.0",
"mocha": "11.5.0",
"nock": "13.2.9",
"nodemon": "3.1.3",
"nyc": "15.1.0",
"nodemon": "3.1.10",
"nyc": "17.1.0",
"pre-commit": "1.2.2",
"prettier": "^2.5.1",
"sinon": "18.0.0",
"sinon": "20.0.0",
"ts-node": "10.9.2",
"ts-node-dev": "2.0.0",
"typescript": "5.3.3"
"typescript": "5.8.3"
},
"engines": {
"node": "22.10.0"
"node": "22.16.0"
},
"pre-commit": [
"lint"
],
"volta": {
"node": "22.10.0",
"yarn": "1.22.21"
"node": "22.16.0",
"yarn": "1.22.22"
}
}
19 changes: 9 additions & 10 deletions test/integration/discordactions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ describe("Discord actions", function () {
});
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
describe.skip("GET /discord-actions/invite", function () {
it("should return the invite for the user if no userId is provided in the params and the invite exists", async function () {
await addInviteToInviteModel({ userId: superUserId, inviteLink: "discord.gg/apQYT7HB" });
Expand Down Expand Up @@ -995,7 +995,7 @@ describe("Discord actions", function () {
});

// <------ Will revisit this later https://github.com/Real-Dev-Squad/website-backend/issues/2078 --->
// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
describe.skip("POST /discord-actions/invite", function () {
afterEach(function () {
sinon.restore();
Expand All @@ -1011,7 +1011,7 @@ describe("Discord actions", function () {
expect(res.body.message).to.be.equal("User should be super user to generate link for other users");
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should return 403 if the user has discord id in their user object, which means user is already in discord", async function () {
const res = await chai
.request(app)
Expand All @@ -1022,7 +1022,7 @@ describe("Discord actions", function () {
expect(res.body.message).to.be.equal("Only users who have never joined discord can generate invite link");
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should return 403 if user has role archieved", async function () {
archievedUserId = await addUser(archievedUser);
archievedUserToken = authService.generateAuthToken({ userId: archievedUserId });
Expand All @@ -1035,7 +1035,7 @@ describe("Discord actions", function () {
expect(res.body.message).to.be.equal("Archived users cannot generate invite");
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should return 403 if the user doesn't have role designer, product_manager, or mavens", async function () {
developerUserWithoutApprovedProfileStatusId = await addUser(developerUserWithoutApprovedProfileStatus);
developerUserWithoutApprovedProfileStatusToken = authService.generateAuthToken({
Expand All @@ -1050,7 +1050,7 @@ describe("Discord actions", function () {
expect(res.body.message).to.be.equal("Only selected roles can generate discord link directly");
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should generate discord link if user is a product mananger", async function () {
fetchStub.returns(
Promise.resolve({
Expand All @@ -1071,7 +1071,7 @@ describe("Discord actions", function () {
expect(res.body.inviteLink).to.be.equal("discord.gg/xyz");
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should generate discord link if user is a designer", async function () {
fetchStub.returns(
Promise.resolve({
Expand All @@ -1092,7 +1092,7 @@ describe("Discord actions", function () {
expect(res.body.inviteLink).to.be.equal("discord.gg/zlmfasd");
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should generate discord link if user is a maven", async function () {
fetchStub.returns(
Promise.resolve({
Expand Down Expand Up @@ -1153,7 +1153,7 @@ describe("Discord actions", function () {
);
});

// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should generate discord link if user has an approved application", async function () {
sinon.stub(ApplicationModel, "getUserApplications").resolves([{ status: "accepted" }]);
fetchStub.returns(
Expand Down Expand Up @@ -1367,7 +1367,6 @@ describe("Discord actions", function () {
.request(app)
.get("/discord-actions/groups?dev=true")
.set("cookie", `${cookieName}=${userAuthToken}`)
// eslint-disable-next-line node/handle-callback-err
.end((err, res) => {
expect(res).to.have.status(500);
expect(res.body).to.be.an("object");
Expand Down
2 changes: 1 addition & 1 deletion test/integration/notify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Notify Test", function () {
});

describe("POST call to notify", function () {
// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("should send message to specified users", async function () {
// skipping the test because it connects with firebase cloud messaging service which we are unable to mock.

Expand Down
4 changes: 2 additions & 2 deletions test/integration/userStatus.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ describe("UserStatus", function () {
});

// Skipping this as the users are not allowed to mark them as active or idle. Will remove the test while removing the feature flag.
// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("Should update the User Status", function (done) {
chai
.request(app)
Expand Down Expand Up @@ -382,7 +382,7 @@ describe("UserStatus", function () {
});

// Skipping this as the users are not allowed to mark them as active or idle. Will remove the test while removing the feature flag.
// eslint-disable-next-line mocha/no-skipped-tests
// eslint-disable-next-line mocha/no-pending-tests
it.skip("Should update the User Status when requested by Super User", function (done) {
chai
.request(app)
Expand Down
1 change: 0 additions & 1 deletion test/integration/usersFilter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ describe("Filter Users", function () {
await cleanDb();
});

// eslint-disable-next-line mocha/no-skipped-tests
describe("GET /users/search", function () {
it("Should search users based on state", function (done) {
chai
Expand Down
Loading
Loading