Skip to content

Commit 528a61f

Browse files
refactor: bump prettier to version 2.8.1
This major bump creates a lot of noise, but it is necessary for prettier to be able to parse new syntax such as: - typed imports: `import { type xxx } from ...` - private attributes: `class A { #b; #c() {} }`
1 parent 721837c commit 528a61f

29 files changed

+191
-188
lines changed

lib/socket.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
332332
addTrailingSlash: true,
333333
rejectUnauthorized: true,
334334
perMessageDeflate: {
335-
threshold: 1024
335+
threshold: 1024,
336336
},
337337
transportOptions: {},
338-
closeOnBeforeunload: true
338+
closeOnBeforeunload: true,
339339
},
340340
opts
341341
);
@@ -374,7 +374,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
374374
if (this.hostname !== "localhost") {
375375
this.offlineEventListener = () => {
376376
this.onClose("transport close", {
377-
description: "network connection lost"
377+
description: "network connection lost",
378378
});
379379
};
380380
addEventListener("offline", this.offlineEventListener, false);
@@ -413,7 +413,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
413413
socket: this,
414414
hostname: this.hostname,
415415
secure: this.secure,
416-
port: this.port
416+
port: this.port,
417417
}
418418
);
419419

@@ -481,7 +481,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
481481
.on("drain", this.onDrain.bind(this))
482482
.on("packet", this.onPacket.bind(this))
483483
.on("error", this.onError.bind(this))
484-
.on("close", reason => this.onClose("transport close", reason));
484+
.on("close", (reason) => this.onClose("transport close", reason));
485485
}
486486

487487
/**
@@ -502,7 +502,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
502502

503503
debug('probe transport "%s" opened', name);
504504
transport.send([{ type: "ping", data: "probe" }]);
505-
transport.once("packet", msg => {
505+
transport.once("packet", (msg) => {
506506
if (failed) return;
507507
if ("pong" === msg.type && "probe" === msg.data) {
508508
debug('probe transport "%s" pong', name);
@@ -549,7 +549,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
549549
}
550550

551551
// Handle any error that happens while probing
552-
const onerror = err => {
552+
const onerror = (err) => {
553553
const error = new Error("probe error: " + err);
554554
// @ts-ignore
555555
error.transport = transport.name;
@@ -828,7 +828,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
828828
const packet = {
829829
type: type,
830830
data: data,
831-
options: options
831+
options: options,
832832
};
833833
this.emitReserved("packetCreate", packet);
834834
this.writeBuffer.push(packet);

lib/transports/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { WS } from "./websocket.js";
33

44
export const transports = {
55
websocket: WS,
6-
polling: Polling
6+
polling: Polling,
77
};

lib/transports/polling.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const debug = debugModule("engine.io-client:polling"); // debug()
1313

1414
function empty() {}
1515

16-
const hasXHR2 = (function() {
16+
const hasXHR2 = (function () {
1717
const xhr = new XMLHttpRequest({
18-
xdomain: false
18+
xdomain: false,
1919
});
2020
return null != xhr.responseType;
2121
})();
@@ -96,7 +96,7 @@ export class Polling extends Transport {
9696
if (this.polling) {
9797
debug("we are currently polling - waiting to pause");
9898
total++;
99-
this.once("pollComplete", function() {
99+
this.once("pollComplete", function () {
100100
debug("pre-pause polling complete");
101101
--total || pause();
102102
});
@@ -105,7 +105,7 @@ export class Polling extends Transport {
105105
if (!this.writable) {
106106
debug("we are currently writing - waiting to pause");
107107
total++;
108-
this.once("drain", function() {
108+
this.once("drain", function () {
109109
debug("pre-pause writing complete");
110110
--total || pause();
111111
});
@@ -134,7 +134,7 @@ export class Polling extends Transport {
134134
*/
135135
onData(data) {
136136
debug("polling got data %s", data);
137-
const callback = packet => {
137+
const callback = (packet) => {
138138
// if its the first message we consider the transport open
139139
if ("opening" === this.readyState && packet.type === "open") {
140140
this.onOpen();
@@ -199,7 +199,7 @@ export class Polling extends Transport {
199199
write(packets) {
200200
this.writable = false;
201201

202-
encodePayload(packets, data => {
202+
encodePayload(packets, (data) => {
203203
this.doWrite(data, () => {
204204
this.writable = true;
205205
this.emitReserved("drain");
@@ -269,7 +269,7 @@ export class Polling extends Transport {
269269
doWrite(data, fn) {
270270
const req = this.request({
271271
method: "POST",
272-
data: data
272+
data: data,
273273
});
274274
req.on("success", fn);
275275
req.on("error", (xhrStatus, context) => {

lib/transports/websocket-constructor.browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const nextTick = (() => {
44
const isPromiseAvailable =
55
typeof Promise === "function" && typeof Promise.resolve === "function";
66
if (isPromiseAvailable) {
7-
return cb => Promise.resolve().then(cb);
7+
return (cb) => Promise.resolve().then(cb);
88
} else {
99
return (cb, setTimeoutFn) => setTimeoutFn(cb, 0);
1010
}

lib/transports/websocket.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
defaultBinaryType,
77
nextTick,
88
usingBrowserWebSocket,
9-
WebSocket
9+
WebSocket,
1010
} from "./websocket-constructor.js";
1111
import debugModule from "debug"; // debug()
1212
import { encodePacket } from "engine.io-parser";
@@ -111,13 +111,13 @@ export class WS extends Transport {
111111
}
112112
this.onOpen();
113113
};
114-
this.ws.onclose = closeEvent =>
114+
this.ws.onclose = (closeEvent) =>
115115
this.onClose({
116116
description: "websocket connection closed",
117-
context: closeEvent
117+
context: closeEvent,
118118
});
119-
this.ws.onmessage = ev => this.onData(ev.data);
120-
this.ws.onerror = e => this.onError("websocket error", e);
119+
this.ws.onmessage = (ev) => this.onData(ev.data);
120+
this.ws.onerror = (e) => this.onError("websocket error", e);
121121
}
122122

123123
/**
@@ -135,7 +135,7 @@ export class WS extends Transport {
135135
const packet = packets[i];
136136
const lastPacket = i === packets.length - 1;
137137

138-
encodePacket(packet, this.supportsBinary, data => {
138+
encodePacket(packet, this.supportsBinary, (data) => {
139139
// always create a new object (GH-437)
140140
const opts: { compress?: boolean } = {};
141141
if (!usingBrowserWebSocket) {

package-lock.json

Lines changed: 11 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"expect.js": "^0.3.1",
6363
"express": "^4.17.1",
6464
"mocha": "^3.2.0",
65-
"prettier": "^1.19.1",
65+
"prettier": "^2.8.1",
6666
"rollup": "^2.58.0",
6767
"rollup-plugin-terser": "^7.0.2",
6868
"socket.io-browsers": "~1.0.4",

support/prod.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ module.exports = {
44
...config,
55
output: {
66
...config.output,
7-
filename: "engine.io.min.js"
7+
filename: "engine.io.min.js",
88
},
99
mode: "production",
1010
module: {
1111
rules: [
1212
...config.module.rules,
1313
{
1414
test: /\.js$/,
15-
loader: "webpack-remove-debug"
16-
}
17-
]
18-
}
15+
loader: "webpack-remove-debug",
16+
},
17+
],
18+
},
1919
};

support/rollup.config.esm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ module.exports = {
1616
format: "esm",
1717
sourcemap: true,
1818
plugins: [terser()],
19-
banner
19+
banner,
2020
},
2121
plugins: [
2222
nodeResolve({
23-
browser: true
23+
browser: true,
2424
}),
25-
commonjs()
26-
]
25+
commonjs(),
26+
],
2727
};

support/rollup.config.umd.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ module.exports = {
1818
format: "umd",
1919
name: "eio",
2020
sourcemap: true,
21-
banner
21+
banner,
2222
},
2323
{
2424
file: "./dist/engine.io.min.js",
2525
format: "umd",
2626
name: "eio",
2727
sourcemap: true,
2828
plugins: [terser()],
29-
banner
30-
}
29+
banner,
30+
},
3131
],
3232
plugins: [
3333
nodeResolve({
34-
browser: true
34+
browser: true,
3535
}),
3636
commonjs(),
3737
babel({
3838
babelHelpers: "bundled",
3939
presets: [["@babel/env"]],
40-
plugins: ["@babel/plugin-transform-object-assign"]
41-
})
42-
]
40+
plugins: ["@babel/plugin-transform-object-assign"],
41+
}),
42+
],
4343
};

0 commit comments

Comments
 (0)