Skip to content

Commit

Permalink
remove prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Sep 16, 2024
1 parent 5399a67 commit 66b2cf6
Show file tree
Hide file tree
Showing 70 changed files with 448 additions and 444 deletions.
3 changes: 0 additions & 3 deletions .prettierrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/engine.io-client/lib/globals.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function parse(setCookieString: string): Cookie {
case "Max-Age":
const expiration = new Date();
expiration.setUTCSeconds(
expiration.getUTCSeconds() + parseInt(value, 10)
expiration.getUTCSeconds() + parseInt(value, 10),
);
cookie.expires = expiration;
break;
Expand Down
10 changes: 5 additions & 5 deletions packages/engine.io-client/lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export class SocketWithoutUpgrade extends Emitter<
transportOptions: {},
closeOnBeforeunload: false,
},
opts
opts,
);

this.opts.path =
Expand All @@ -434,7 +434,7 @@ export class SocketWithoutUpgrade extends Emitter<
addEventListener(
"beforeunload",
this._beforeunloadEventListener,
false
false,
);
}
if (this.hostname !== "localhost") {
Expand Down Expand Up @@ -484,7 +484,7 @@ export class SocketWithoutUpgrade extends Emitter<
secure: this.secure,
port: this.port,
},
this.opts.transportOptions[name]
this.opts.transportOptions[name],
);

debug("options: %j", opts);
Expand Down Expand Up @@ -749,7 +749,7 @@ export class SocketWithoutUpgrade extends Emitter<
type: PacketType,
data?: RawData,
options?: WriteOptions,
fn?: () => void
fn?: () => void,
) {
if ("function" === typeof data) {
fn = data;
Expand Down Expand Up @@ -874,7 +874,7 @@ export class SocketWithoutUpgrade extends Emitter<
removeEventListener(
"beforeunload",
this._beforeunloadEventListener,
false
false,
);
removeEventListener("offline", this._offlineEventListener, false);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/engine.io-client/lib/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class TransportError extends Error {
constructor(
reason: string,
readonly description: any,
readonly context: any
readonly context: any,
) {
super(reason);
}
Expand Down Expand Up @@ -79,7 +79,7 @@ export abstract class Transport extends Emitter<
protected onError(reason: string, description: any, context?: any) {
super.emitReserved(
"error",
new TransportError(reason, description, context)
new TransportError(reason, description, context),
);
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/engine.io-client/lib/transports/polling-xhr.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export class XHR extends BaseXHR {
Object.assign(
opts,
{ xd: this.xd, cookieJar: this.socket?._cookieJar },
this.opts
this.opts,
);
return new Request(
(opts) => new XMLHttpRequest(opts),
this.uri(),
opts as RequestOptions
opts as RequestOptions,
);
}
}
8 changes: 4 additions & 4 deletions packages/engine.io-client/lib/transports/polling-xhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class Request extends Emitter<
constructor(
private readonly createRequest: (opts: RequestOptions) => XMLHttpRequest,
uri: string,
opts: RequestOptions
opts: RequestOptions,
) {
super();
installTimerFunctions(this, opts);
Expand Down Expand Up @@ -151,7 +151,7 @@ export class Request extends Emitter<
"ca",
"ciphers",
"rejectUnauthorized",
"autoUnref"
"autoUnref",
);
opts.xdomain = !!this._opts.xd;

Expand Down Expand Up @@ -197,7 +197,7 @@ export class Request extends Emitter<
if (xhr.readyState === 3) {
this._opts.cookieJar?.parseCookies(
// @ts-ignore
xhr.getResponseHeader("set-cookie")
xhr.getResponseHeader("set-cookie"),
);
}

Expand Down Expand Up @@ -354,7 +354,7 @@ function newRequest(opts) {
if (!xdomain) {
try {
return new globalThis[["Active"].concat("Object").join("X")](
"Microsoft.XMLHTTP"
"Microsoft.XMLHTTP",
);
} catch (e) {}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/engine.io-client/lib/transports/websocket.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class WS extends BaseWS {
createSocket(
uri: string,
protocols: string | string[] | undefined,
opts: Record<string, any>
opts: Record<string, any>,
) {
if (this.socket?._cookieJar) {
opts.headers = opts.headers || {};
Expand Down
6 changes: 3 additions & 3 deletions packages/engine.io-client/lib/transports/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export abstract class BaseWS extends Transport {
"origin",
"maxPayload",
"family",
"checkServerIdentity"
"checkServerIdentity",
);

if (this.opts.extraHeaders) {
Expand All @@ -64,7 +64,7 @@ export abstract class BaseWS extends Transport {
abstract createSocket(
uri: string,
protocols: string | string[] | undefined,
opts: Record<string, any>
opts: Record<string, any>,
);

/**
Expand Down Expand Up @@ -166,7 +166,7 @@ export class WS extends BaseWS {
createSocket(
uri: string,
protocols: string | string[] | undefined,
opts: Record<string, any>
opts: Record<string, any>,
) {
return !isReactNative
? protocols
Expand Down
4 changes: 2 additions & 2 deletions packages/engine.io-client/lib/transports/webtransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class WT extends Transport {
// @ts-ignore
this._transport = new WebTransport(
this.createUri("https"),
this.opts.transportOptions[this.name]
this.opts.transportOptions[this.name],
);
} catch (err) {
return this.emitReserved("error", err);
Expand All @@ -51,7 +51,7 @@ export class WT extends Transport {
this._transport.createBidirectionalStream().then((stream) => {
const decoderStream = createPacketDecoderStream(
Number.MAX_SAFE_INTEGER,
this.socket.binaryType
this.socket.binaryType,
);
const reader = stream.readable.pipeThrough(decoderStream).getReader();

Expand Down
4 changes: 2 additions & 2 deletions packages/engine.io-client/test/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ describe("connection", function () {
const socket = new Socket();
socket.on("open", () => {
socket.send(
"\uD800\uDC00-\uDB7F\uDFFF\uDB80\uDC00-\uDBFF\uDFFF\uE000-\uF8FF"
"\uD800\uDC00-\uDB7F\uDFFF\uDB80\uDC00-\uDBFF\uDFFF\uE000-\uF8FF",
);
socket.on("message", (data) => {
if ("hi" === data) return;
expect(data).to.be(
"\uD800\uDC00-\uDB7F\uDFFF\uDB80\uDC00-\uDBFF\uDFFF\uE000-\uF8FF"
"\uD800\uDC00-\uDB7F\uDFFF\uDB80\uDC00-\uDBFF\uDFFF\uE000-\uF8FF",
);
socket.close();
done();
Expand Down
4 changes: 2 additions & 2 deletions packages/engine.io-client/test/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("Socket", function () {

socket.on("error", (err) => {
expect(err.message).to.eql(
useFetch ? "fetch read error" : "xhr poll error"
useFetch ? "fetch read error" : "xhr poll error",
);
done();
});
Expand Down Expand Up @@ -237,7 +237,7 @@ describe("Socket", function () {
// err.context is a XMLHttpRequest object
expect(err.context.readyState).to.eql(4);
expect(err.context.responseText).to.eql(
'{"code":1,"message":"Session ID unknown"}'
'{"code":1,"message":"Session ID unknown"}',
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/engine.io-client/test/support/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports.mochaHooks = {
maxHttpBufferSize: 100,
allowRequest: (req, fn) => {
const denyRequest = new URL(`http://${req.url}`).searchParams.has(
"deny"
"deny",
);
fn(null, !denyRequest);
},
Expand Down
6 changes: 3 additions & 3 deletions packages/engine.io-client/test/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe("Transport", () => {
timestampRequests: false,
});
expect(polling.uri()).to.contain(
"http://localhost:3000/engine.io?sid=test"
"http://localhost:3000/engine.io?sid=test",
);
});

Expand All @@ -124,7 +124,7 @@ describe("Transport", () => {
timestampRequests: true,
});
expect(polling.uri()).to.match(
/http:\/\/localhost\/engine\.io\?(j=[0-9]+&)?(t=[0-9A-Za-z-_]+)/
/http:\/\/localhost\/engine\.io\?(j=[0-9]+&)?(t=[0-9A-Za-z-_]+)/,
);
});

Expand Down Expand Up @@ -180,7 +180,7 @@ describe("Transport", () => {
timestampRequests: true,
});
expect(ws.uri()).to.match(
/ws:\/\/localhost\/engine\.io\?woot=[0-9A-Za-z-_]+/
/ws:\/\/localhost\/engine\.io\?woot=[0-9A-Za-z-_]+/,
);
});

Expand Down
12 changes: 6 additions & 6 deletions packages/engine.io-client/test/webtransport.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function setup(opts, cb) {
[{ shortName: "CN", value: "localhost" }],
{
days: 14, // the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements)
}
},
);

const engine = new Server(opts);
Expand Down Expand Up @@ -73,8 +73,8 @@ function createSocket(port, certificate, opts) {
},
},
},
opts
)
opts,
),
);
}

Expand Down Expand Up @@ -113,7 +113,7 @@ describe("WebTransport", () => {
httpServer.close();
success(engine, h3Server, done);
});
}
},
);
});

Expand All @@ -137,7 +137,7 @@ describe("WebTransport", () => {
httpServer.close();
success(engine, h3Server, done);
});
}
},
);
});

Expand All @@ -160,7 +160,7 @@ describe("WebTransport", () => {
success(engine, h3Server, done);
}
});
}
},
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/engine.io-parser/lib/decodePacket.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const withNativeArrayBuffer = typeof ArrayBuffer === "function";

export const decodePacket = (
encodedPacket: RawData,
binaryType?: BinaryType
binaryType?: BinaryType,
): Packet => {
if (typeof encodedPacket !== "string") {
return {
Expand Down
4 changes: 2 additions & 2 deletions packages/engine.io-parser/lib/decodePacket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

export const decodePacket = (
encodedPacket: RawData,
binaryType?: BinaryType
binaryType?: BinaryType,
): Packet => {
if (typeof encodedPacket !== "string") {
return {
Expand Down Expand Up @@ -47,7 +47,7 @@ const mapBinary = (data: RawData, binaryType?: BinaryType) => {
// from HTTP long-polling
return data.buffer.slice(
data.byteOffset,
data.byteOffset + data.byteLength
data.byteOffset + data.byteLength,
);
} else {
// from WebTransport (Uint8Array)
Expand Down
6 changes: 3 additions & 3 deletions packages/engine.io-parser/lib/encodePacket.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const isView = (obj) => {
const encodePacket = (
{ type, data }: Packet,
supportsBinary: boolean,
callback: (encodedPacket: RawData) => void
callback: (encodedPacket: RawData) => void,
) => {
if (withNativeBlob && data instanceof Blob) {
if (supportsBinary) {
Expand All @@ -40,7 +40,7 @@ const encodePacket = (

const encodeBlobAsBase64 = (
data: Blob,
callback: (encodedPacket: RawData) => void
callback: (encodedPacket: RawData) => void,
) => {
const fileReader = new FileReader();
fileReader.onload = function () {
Expand All @@ -64,7 +64,7 @@ let TEXT_ENCODER;

export function encodePacketToBinary(
packet: Packet,
callback: (encodedPacket: RawData) => void
callback: (encodedPacket: RawData) => void,
) {
if (withNativeBlob && packet.data instanceof Blob) {
return packet.data.arrayBuffer().then(toArray).then(callback);
Expand Down
6 changes: 3 additions & 3 deletions packages/engine.io-parser/lib/encodePacket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { PACKET_TYPES, Packet, RawData } from "./commons.js";
export const encodePacket = (
{ type, data }: Packet,
supportsBinary: boolean,
callback: (encodedPacket: RawData) => void
callback: (encodedPacket: RawData) => void,
) => {
if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
return callback(
supportsBinary ? data : "b" + toBuffer(data, true).toString("base64")
supportsBinary ? data : "b" + toBuffer(data, true).toString("base64"),
);
}
// plain string
Expand All @@ -31,7 +31,7 @@ let TEXT_ENCODER;

export function encodePacketToBinary(
packet: Packet,
callback: (encodedPacket: RawData) => void
callback: (encodedPacket: RawData) => void,
) {
if (packet.data instanceof ArrayBuffer || ArrayBuffer.isView(packet.data)) {
return callback(toBuffer(packet.data, false));
Expand Down
Loading

0 comments on commit 66b2cf6

Please sign in to comment.