Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove prettier v2 #5169

Merged
merged 6 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "socket.io",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes package-lock.json to contain a stable root package name (otherwise it uses the directory name)

"private": true,
"workspaces": [
"packages/socket.io-component-emitter",
Expand Down Expand Up @@ -52,7 +53,7 @@
"mocha": "^10.6.0",
"node-forge": "^1.3.1",
"nyc": "^17.0.0",
"prettier": "^2.8.8",
"prettier": "^3.3.2",
"redis": "^4.6.15",
"rimraf": "^6.0.0",
"rollup": "^2.79.1",
Expand Down
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
14 changes: 7 additions & 7 deletions packages/engine.io-client/lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ export class SocketWithoutUpgrade extends Emitter<
(typeof location !== "undefined" && location.port
? location.port
: this.secure
? "443"
: "80");
? "443"
: "80");

this.transports = [];
this._transportsByName = {};
Expand All @@ -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
3 changes: 0 additions & 3 deletions packages/engine.io-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"require": "./build/cjs/index.js"
},
"types": "build/esm/index.d.ts",
"devDependencies": {
"prettier": "^3.3.2"
},
"scripts": {
"compile": "rimraf ./build && tsc && tsc -p tsconfig.esm.json && ./postcompile.sh",
"test": "npm run format:check && npm run compile && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi",
Expand Down
Loading