sisoe24 / Nuke-Tools

Consider using arrow functions for callbacks JS-0241
Anti-pattern
Minor
5 months ago5 months old
Unexpected function expression
22            console.log(`Server :: Data received from client: ${chunk.toString()}`);
23        });
24
25        socket.on("end", function () {26            console.log("Server :: Closing connection with the client");27            _server.close();28        });29    });
30
31    _server.on("close", () => {
Unexpected function expression
18    _server.on("connection", function (socket) {
19        socket.write("Hello, server.");
20
21        socket.on("data", function (chunk) {22            console.log(`Server :: Data received from client: ${chunk.toString()}`);23        });24
25        socket.on("end", function () {
26            console.log("Server :: Closing connection with the client");
Unexpected function expression
15
16    await testUtils.sleep(100);
17
18    _server.on("connection", function (socket) {19        socket.write("Hello, server.");2021        socket.on("data", function (chunk) {22            console.log(`Server :: Data received from client: ${chunk.toString()}`);23        });2425        socket.on("end", function () {26            console.log("Server :: Closing connection with the client");27            _server.close();28        });29    });30
31    _server.on("close", () => {
32        console.log("Server :: Closing server.");
Unexpected function expression
298        /**
299         * Emitted when the other end of the socket signals the end of transmission.
300         */
301        client.on("end", function () {302            logDebugNetwork("Connection ended.");303        });304
305    });
306}
Unexpected function expression
291        /**
292         * Emitted once the socket is fully closed.
293         */
294        client.on("close", function (hadError: boolean) {295            logDebugNetwork(`Connection closed. Had Errors: ${hadError.toString()}`);296        });297
298        /**
299         * Emitted when the other end of the socket signals the end of transmission.