diff --git a/package.json b/package.json index 7f46b04..807d4a0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "eslint-config-prettier": "6.10.1", "eslint-plugin-prettier": "3.1.4", "express": "4.17.1", - "prettier": "1.19.1", + "prettier": "2.0.5", "socket.io": "2.3.0" }, "devDependencies": { diff --git a/src/index.ts b/src/index.ts index 351b6ad..ac9f2a7 100755 --- a/src/index.ts +++ b/src/index.ts @@ -17,21 +17,21 @@ server.listen(port, () => { }); const io = socketIO(server, { - handlePreflightRequest: function(req, res) { + handlePreflightRequest: function (req, res) { var headers = { "Access-Control-Allow-Headers": "Content-Type, Authorization", "Access-Control-Allow-Origin": req.header ? req.header.origin : "*", - "Access-Control-Allow-Credentials": true + "Access-Control-Allow-Credentials": true, }; res.writeHead(200, headers); res.end(); - } + }, }); -io.on("connection", socket => { +io.on("connection", (socket) => { ioDebug("connection established!"); io.to(`${socket.id}`).emit("init-room"); - socket.on("join-room", roomID => { + socket.on("join-room", (roomID) => { socketDebug(`${socket.id} has joined ${roomID}`); socket.join(roomID); if (io.sockets.adapter.rooms[roomID].length <= 1) { @@ -67,7 +67,7 @@ io.on("connection", socket => { const rooms = io.sockets.adapter.rooms; for (const roomID in socket.rooms) { const clients = Object.keys(rooms[roomID].sockets).filter( - id => id !== socket.id + (id) => id !== socket.id ); if (clients.length > 0) { socket.broadcast.to(roomID).emit("room-user-change", clients); diff --git a/yarn.lock b/yarn.lock index 6931019..2c5e226 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1054,10 +1054,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" - integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +prettier@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" + integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== progress@^2.0.0: version "2.0.3"