mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-07 22:23:57 -05:00
refactor: upgrade to prettier 3
This commit is contained in:
30
lib/index.ts
30
lib/index.ts
@@ -150,12 +150,12 @@ export class ClusterAdapter extends Adapter {
|
||||
packet: arg,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
super.broadcast(
|
||||
message.data.packet,
|
||||
ClusterAdapter.deserializeOptions(message.data.opts)
|
||||
ClusterAdapter.deserializeOptions(message.data.opts),
|
||||
);
|
||||
}
|
||||
break;
|
||||
@@ -177,7 +177,7 @@ export class ClusterAdapter extends Adapter {
|
||||
debug("calling addSockets with opts %j", message.data.opts);
|
||||
super.addSockets(
|
||||
ClusterAdapter.deserializeOptions(message.data.opts),
|
||||
message.data.rooms
|
||||
message.data.rooms,
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export class ClusterAdapter extends Adapter {
|
||||
debug("calling delSockets with opts %j", message.data.opts);
|
||||
super.delSockets(
|
||||
ClusterAdapter.deserializeOptions(message.data.opts),
|
||||
message.data.rooms
|
||||
message.data.rooms,
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -193,14 +193,14 @@ export class ClusterAdapter extends Adapter {
|
||||
debug("calling disconnectSockets with opts %j", message.data.opts);
|
||||
super.disconnectSockets(
|
||||
ClusterAdapter.deserializeOptions(message.data.opts),
|
||||
message.data.close
|
||||
message.data.close,
|
||||
);
|
||||
break;
|
||||
}
|
||||
case EventType.FETCH_SOCKETS: {
|
||||
debug("calling fetchSockets with opts %j", message.data.opts);
|
||||
const localSockets = await super.fetchSockets(
|
||||
ClusterAdapter.deserializeOptions(message.data.opts)
|
||||
ClusterAdapter.deserializeOptions(message.data.opts),
|
||||
);
|
||||
|
||||
this.publish({
|
||||
@@ -227,7 +227,7 @@ export class ClusterAdapter extends Adapter {
|
||||
|
||||
request.current++;
|
||||
message.data.sockets.forEach((socket: any) =>
|
||||
request.responses.push(socket)
|
||||
request.responses.push(socket),
|
||||
);
|
||||
|
||||
if (request.current === request.expected) {
|
||||
@@ -294,7 +294,7 @@ export class ClusterAdapter extends Adapter {
|
||||
debug(
|
||||
"publish event of type %s for namespace %s",
|
||||
message.type,
|
||||
message.nsp
|
||||
message.nsp,
|
||||
);
|
||||
|
||||
process.send(message, null, {}, ignoreError);
|
||||
@@ -344,7 +344,7 @@ export class ClusterAdapter extends Adapter {
|
||||
packet: any,
|
||||
opts: BroadcastOptions,
|
||||
clientCountCallback: (clientCount: number) => void,
|
||||
ack: (...args: any[]) => void
|
||||
ack: (...args: any[]) => void,
|
||||
) {
|
||||
const onlyLocal = opts?.flags?.local;
|
||||
if (!onlyLocal) {
|
||||
@@ -453,8 +453,8 @@ export class ClusterAdapter extends Adapter {
|
||||
if (storedRequest) {
|
||||
reject(
|
||||
new Error(
|
||||
`timeout reached: only ${storedRequest.current} responses received out of ${storedRequest.expected}`
|
||||
)
|
||||
`timeout reached: only ${storedRequest.current} responses received out of ${storedRequest.expected}`,
|
||||
),
|
||||
);
|
||||
this.requests.delete(requestId);
|
||||
}
|
||||
@@ -505,7 +505,7 @@ export class ClusterAdapter extends Adapter {
|
||||
|
||||
debug(
|
||||
'waiting for %d responses to "serverSideEmit" request',
|
||||
expectedResponseCount
|
||||
expectedResponseCount,
|
||||
);
|
||||
|
||||
if (expectedResponseCount <= 0) {
|
||||
@@ -519,9 +519,9 @@ export class ClusterAdapter extends Adapter {
|
||||
if (storedRequest) {
|
||||
ack(
|
||||
new Error(
|
||||
`timeout reached: only ${storedRequest.current} responses received out of ${storedRequest.expected}`
|
||||
`timeout reached: only ${storedRequest.current} responses received out of ${storedRequest.expected}`,
|
||||
),
|
||||
storedRequest.responses
|
||||
storedRequest.responses,
|
||||
);
|
||||
this.requests.delete(requestId);
|
||||
}
|
||||
@@ -589,7 +589,7 @@ export function setupPrimary() {
|
||||
data: worker.id,
|
||||
},
|
||||
null,
|
||||
ignoreError
|
||||
ignoreError,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
2882
package-lock.json
generated
2882
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,8 @@
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "npm run format:check && tsc && nyc mocha --require ts-node/register test/index.ts",
|
||||
"format:check": "prettier --parser typescript --check 'lib/**/*.ts' 'test/**/*.ts'",
|
||||
"format:fix": "prettier --parser typescript --write 'lib/**/*.ts' 'test/**/*.ts'",
|
||||
"format:check": "prettier --check 'lib/**/*.ts' 'test/**/*.ts'",
|
||||
"format:fix": "prettier --write 'lib/**/*.ts' 'test/**/*.ts'",
|
||||
"prepack": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -31,7 +31,7 @@
|
||||
"expect.js": "0.3.1",
|
||||
"mocha": "^10.0.0",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^2.1.2",
|
||||
"prettier": "~3.6.2",
|
||||
"socket.io": "^4.6.1",
|
||||
"socket.io-client": "^4.7.1",
|
||||
"ts-node": "^9.1.1",
|
||||
|
||||
@@ -181,7 +181,7 @@ describe("@socket.io/cluster-adapter", () => {
|
||||
});
|
||||
|
||||
workers[0].send(
|
||||
"broadcasts with multiple acknowledgements (binary content)"
|
||||
"broadcasts with multiple acknowledgements (binary content)",
|
||||
);
|
||||
|
||||
workers[0].on("message", (result) => {
|
||||
@@ -240,7 +240,7 @@ describe("@socket.io/cluster-adapter", () => {
|
||||
workers[2].send("join room1");
|
||||
|
||||
workers[0].send(
|
||||
"makes the matching socket instances join the specified room"
|
||||
"makes the matching socket instances join the specified room",
|
||||
);
|
||||
|
||||
await sleep(100);
|
||||
@@ -270,7 +270,7 @@ describe("@socket.io/cluster-adapter", () => {
|
||||
workers[2].send("join room2");
|
||||
|
||||
workers[0].send(
|
||||
"makes the matching socket instances leave the specified room"
|
||||
"makes the matching socket instances leave the specified room",
|
||||
);
|
||||
|
||||
await sleep(100);
|
||||
@@ -333,13 +333,13 @@ describe("@socket.io/cluster-adapter", () => {
|
||||
|
||||
it("sends an event and receives a response from the other server instances", (done) => {
|
||||
workers[0].send(
|
||||
"sends an event and receives a response from the other server instances (1)"
|
||||
"sends an event and receives a response from the other server instances (1)",
|
||||
);
|
||||
workers[1].send(
|
||||
"sends an event and receives a response from the other server instances (2)"
|
||||
"sends an event and receives a response from the other server instances (2)",
|
||||
);
|
||||
workers[2].send(
|
||||
"sends an event and receives a response from the other server instances (3)"
|
||||
"sends an event and receives a response from the other server instances (3)",
|
||||
);
|
||||
|
||||
workers[0].on("message", (result) => {
|
||||
@@ -351,13 +351,13 @@ describe("@socket.io/cluster-adapter", () => {
|
||||
|
||||
it("sends an event but timeout if one server does not respond", (done) => {
|
||||
workers[0].send(
|
||||
"sends an event but timeout if one server does not respond (1)"
|
||||
"sends an event but timeout if one server does not respond (1)",
|
||||
);
|
||||
workers[1].send(
|
||||
"sends an event but timeout if one server does not respond (2)"
|
||||
"sends an event but timeout if one server does not respond (2)",
|
||||
);
|
||||
workers[2].send(
|
||||
"sends an event but timeout if one server does not respond (3)"
|
||||
"sends an event but timeout if one server does not respond (3)",
|
||||
);
|
||||
|
||||
workers[0].on("message", (result) => {
|
||||
|
||||
Reference in New Issue
Block a user