LisahMan / Chat-Application

Use const declarations for variables that are never reassigned JS-0242
Anti-pattern
Minor
a year agoa year old
'allUsers' is never reassigned. Use 'const' instead.
 31      sockets[socket.id] = socket;
 32
 33      socket.emit('signupsuccessful',"Ok");
 34      let allUsers = await userController.get_all_users(data.name); 35      socket.emit('allusers',allUsers);
 36    }
 37    catch(error){
'sockets' is never reassigned. Use 'const' instead.
 16const userController = require('./api/controller/users');
 17const messageController = require('./api/controller/messages');
 18
 19let sockets = {}; 20
 21io.on("connection",(socket)=>{
 22 console.log("New user joins");
'result' is never reassigned. Use 'const' instead.
 23
 24socket.on('signup',async (data)=>{
 25    try{
 26      let result = await userController.signup_user(data.name,data.password,socket.id); 27      if(result=="Name is taken"){
 28          socket.emit('nameerr',result);
 29          return;
'result' is never reassigned. Use 'const' instead.
163async function getARoom (sendby,sendto) {
164    try{
165        let room = sendby+sendto+"Room";
166        let result = await userController.add_rooms(sendby,sendto,room);167        return room;
168    }
169    catch(error){
'room' is never reassigned. Use 'const' instead.
162
163async function getARoom (sendby,sendto) {
164    try{
165        let room = sendby+sendto+"Room";166        let result = await userController.add_rooms(sendby,sendto,room);
167        return room;
168    }