mirror of
https://github.com/Discreetly/server.git
synced 2026-04-17 03:00:55 -04:00
chore(eslintrc.cjs): add ESLint configuration file to the project
fix(rooms.ts): remove unused import and type declaration fix(mock.ts): change variable declaration from 'let' to 'const' for loop variable fix(startup.ts): change variable declaration from 'let' to 'const' for userCount fix(utils.ts): change parameter type from 'BigInt' to 'bigint' in findGroupById function fix(verifier.ts): remove unused import statement for poseidon1 function
This commit is contained in:
committed by
AtHeartEngineer
parent
ac7b6207d4
commit
b60f014933
18
.eslintrc.cjs
Normal file
18
.eslintrc.cjs
Normal file
@@ -0,0 +1,18 @@
|
||||
/* eslint-env node */
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ["@typescript-eslint"],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.tsx'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
],
|
||||
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'], // Specify it only for TypeScript files
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MembershipI, RoomGroupI, ServerI } from 'discreetly-interfaces';
|
||||
import type { RoomGroupI, ServerI } from 'discreetly-interfaces';
|
||||
import { genId } from 'discreetly-interfaces';
|
||||
import 'dotenv/config';
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function Mock(io: SocketIOServer) {
|
||||
this.weightSums = [];
|
||||
let sum = 0;
|
||||
|
||||
for (let weight of weights) {
|
||||
for (const weight of weights) {
|
||||
sum += weight;
|
||||
this.weightSums.push(sum);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ export default function Mock(io: SocketIOServer) {
|
||||
|
||||
pick() {
|
||||
const rand = Math.random() * this.weightSums[this.weightSums.length - 1];
|
||||
let index = this.weightSums.findIndex((sum) => rand < sum);
|
||||
const index = this.weightSums.findIndex((sum) => rand < sum);
|
||||
return this.values[index]();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export async function initRedisVariables(redisClient: RedisClientType): Promise<
|
||||
}
|
||||
|
||||
export function initSockets(io: SocketIOServer, loadedRooms: RoomGroupI[]) {
|
||||
let userCount: userCountI = {};
|
||||
const userCount: userCountI = {};
|
||||
io.on('connection', (socket: Socket) => {
|
||||
pp('SocketIO: a user connected', 'debug');
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export function findRoomById(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function findGroupById(roomGroups: RoomGroupI[], groupId: BigInt): RoomGroupI {
|
||||
export function findGroupById(roomGroups: RoomGroupI[], groupId: bigint): RoomGroupI {
|
||||
const group = roomGroups.find((group) => group.id === groupId);
|
||||
console.log(roomGroups, groupId);
|
||||
if (!group) {
|
||||
@@ -36,7 +36,7 @@ export function addIdentityToRoom(
|
||||
roomID: bigint,
|
||||
identityCommitment: bigint,
|
||||
roomGroups: RoomGroupI[]
|
||||
): { status: Boolean; roomGroups: RoomGroupI[] } {
|
||||
): { status: boolean; roomGroups: RoomGroupI[] } {
|
||||
let added = false;
|
||||
const r = findRoomById(roomGroups, roomID);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { MessageI, RoomGroupI } from 'discreetly-interfaces';
|
||||
import { str2BigInt } from 'discreetly-interfaces';
|
||||
import { RLNVerifier } from 'rlnjs';
|
||||
import vkey from './verification_key.js';
|
||||
import { poseidon1 } from 'poseidon-lite/poseidon1';
|
||||
import { findRoomById } from './utils.js';
|
||||
import { Group } from '@semaphore-protocol/group';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user