Skip to content

Commit 0fe43e5

Browse files
authored
chore: Bump dependencies (#287)
* bump node * fix flaky tests * bump test packages * bump typescript * bump vite to fix types issue * allow bypassing onUnhandledRequest to fix socketio tests * remove cross-fetch, no longer needed * bump patch versions * bump more patch versions * bump eslint * remove unnecessary tsconfig changes * better eslint rule * Object.hasOwn
1 parent 8c94a3a commit 0fe43e5

17 files changed

+1602
-4792
lines changed

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

.husky/pre-commit

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
yarn lint-staged

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
22

eslint.config.mjs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import eslint from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
import vitest from "@vitest/eslint-plugin";
4+
import globals from "globals";
5+
6+
// @ts-check
7+
8+
export default tseslint.config(
9+
{ ignores: ["dist"] },
10+
eslint.configs.recommended,
11+
tseslint.configs.recommended,
12+
{
13+
files: ["test/**/*.{ts,js}", "vitest.setup.js", "vitest.globalsetup.js"],
14+
...vitest.configs.recommended,
15+
languageOptions: {
16+
globals: {
17+
...globals.browser,
18+
...globals.node,
19+
...globals.es2025,
20+
...vitest.environments.env.globals,
21+
},
22+
},
23+
},
24+
{
25+
files: ["source/**/*.{ts,js}"],
26+
languageOptions: {
27+
globals: { ...globals.browser, ...globals.node, ...globals.es2025 },
28+
},
29+
},
30+
{
31+
files: ["**/*.ts"],
32+
rules: {
33+
"@typescript-eslint/no-explicit-any": "off",
34+
"@typescript-eslint/no-empty-object-type": "off",
35+
"@typescript-eslint/ban-ts-comment": "off",
36+
"@typescript-eslint/no-unused-vars": [
37+
"error",
38+
{
39+
caughtErrors: "none",
40+
ignoreRestSiblings: true,
41+
},
42+
],
43+
},
44+
},
45+
);

package.json

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,24 @@
2525
"dist"
2626
],
2727
"devDependencies": {
28-
"@types/uuid": "^9.0.8",
29-
"cross-fetch": "^4.0.0",
30-
"dayjs": "^1.11.10",
31-
"eslint": "^8.56.0",
32-
"eslint-config-react-app": "^7.0.1",
33-
"husky": "^9.0.10",
34-
"jsdom": "^24.0.0",
35-
"lint-staged": "^15.2.2",
36-
"msw": "^2.2.0",
28+
"@types/node": "^22.13.9",
29+
"@types/uuid": "^10.0.0",
30+
"@vitest/eslint-plugin": "^1.1.36",
31+
"dayjs": "^1.11.13",
32+
"eslint": "^9.21.0",
33+
"globals": "^16.0.0",
34+
"husky": "^9.1.7",
35+
"jsdom": "^26.0.0",
36+
"lint-staged": "^15.4.3",
37+
"msw": "^2.7.3",
3738
"pinst": "^3.0.0",
38-
"prettier": "^3.2.5",
39-
"typescript": "^5.3.3",
40-
"vite": "^5.4.7",
41-
"vite-plugin-dts": "^3.7.2",
42-
"vitest": "^1.2.2",
43-
"ws": "^8.16.0"
39+
"prettier": "^3.5.3",
40+
"typescript": "^5.8.2",
41+
"typescript-eslint": "^8.26.0",
42+
"vite": "^6.2.0",
43+
"vite-plugin-dts": "^4.5.3",
44+
"vitest": "^3.0.7",
45+
"ws": "^8.18.1"
4446
},
4547
"repository": {
4648
"type": "git",
@@ -59,9 +61,9 @@
5961
"homepage": "http://ftrack.com",
6062
"dependencies": {
6163
"isomorphic-ws": "^5.0.0",
62-
"loglevel": "^1.9.1",
64+
"loglevel": "^1.9.2",
6365
"moment": "^2.30.1",
64-
"uuid": "^9.0.1"
66+
"uuid": "^11.1.0"
6567
},
6668
"peerDependencies": {
6769
"ws": "^8.13.0"

source/session.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export class Session<
306306
if (data && data.constructor === Object) {
307307
const out: Data = {};
308308
for (const key in data) {
309-
if (data.hasOwnProperty(key)) {
309+
if (Object.hasOwn(data, key)) {
310310
out[key] = this.encode(data[key]);
311311
}
312312
}
@@ -545,7 +545,7 @@ export class Session<
545545
const mergedEntity = identityMap[identifier];
546546

547547
for (const key in entity) {
548-
if (entity.hasOwnProperty(key)) {
548+
if (Object.hasOwn(entity, key)) {
549549
mergedEntity[key] = this.decode(entity[key], identityMap, {
550550
decodeDatesAsIso,
551551
ensureSerializableResponse,

source/uploader.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,9 @@ export class Uploader<TEntityTypeMap extends Record<string, any>> {
322322
part: MultiPartUploadPart,
323323
onUploadChunkStart: () => void,
324324
): Promise<void> {
325-
try {
326-
const status = await this.uploadFileChunk(
327-
chunk,
328-
part,
329-
onUploadChunkStart,
330-
);
331-
if (status !== 200) {
332-
throw new CreateComponentError(`Failed to upload file part: ${status}`);
333-
}
334-
} catch (error) {
335-
throw error;
325+
const status = await this.uploadFileChunk(chunk, part, onUploadChunkStart);
326+
if (status !== 200) {
327+
throw new CreateComponentError(`Failed to upload file part: ${status}`);
336328
}
337329
}
338330

@@ -516,7 +508,7 @@ export class Uploader<TEntityTypeMap extends Record<string, any>> {
516508
};
517509

518510
for (const key in headers) {
519-
if (headers.hasOwnProperty(key) && key !== "Content-Length") {
511+
if (Object.hasOwn(headers, key) && key !== "Content-Length") {
520512
this.xhr.setRequestHeader(key, headers[key]);
521513
}
522514
}

test/.eslintrc

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/event_hub.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe("EventHub", () => {
123123
expect(callback).not.toHaveBeenCalled();
124124
});
125125

126-
test("should handle events with unexpected topics", () => {
126+
test("should handle events with more unexpected topics", () => {
127127
const callback = vi.fn();
128128
eventHub.subscribe("topic=*", callback);
129129
const testEvent = { topic: null, data: {} };

test/server.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// :copyright: Copyright (c) 2022 ftrack
22
import { HttpResponse, type PathParams, http, HttpHandler } from "msw";
33
import fs from "fs/promises";
4-
import querySchemas from "./fixtures/query_schemas.json";
5-
import queryServerInformation from "./fixtures/query_server_information.json";
6-
import getUploadMetadata from "./fixtures/get_upload_metadata.json";
7-
import completeMultipartUpload from "./fixtures/complete_multipart_upload.json";
8-
import exampleQuery from "./fixtures/query_select_name_from_task_limit_1.json";
4+
import querySchemas from "./fixtures/query_schemas.json" with { type: "json" };
5+
import queryServerInformation from "./fixtures/query_server_information.json" with { type: "json" };
6+
import getUploadMetadata from "./fixtures/get_upload_metadata.json" with { type: "json" };
7+
import completeMultipartUpload from "./fixtures/complete_multipart_upload.json" with { type: "json" };
8+
import exampleQuery from "./fixtures/query_select_name_from_task_limit_1.json" with { type: "json" };
99
import { setupServer } from "msw/node";
1010
const InvalidCredentialsError = {
1111
content:
@@ -25,7 +25,7 @@ function authenticate(info: Parameters<Parameters<typeof http.post>[1]>[0]) {
2525

2626
function pick<T>(object: T, keys: (keyof T)[]) {
2727
return keys.reduce((obj, key) => {
28-
if (object && object.hasOwnProperty(key)) {
28+
if (object && Object.hasOwn(object, key)) {
2929
obj[key] = object[key];
3030
}
3131
return obj;
@@ -66,7 +66,7 @@ export const handlers: HttpHandler[] = [
6666
return queryServerInformation;
6767
case "query_schemas":
6868
return querySchemas;
69-
case "create":
69+
case "create": {
7070
// create are fetched from test/fixtures where the file name matches the full expression
7171
const createFixture = await fs.readFile(
7272
`${__dirname}/fixtures/create_${entityType.toLowerCase()}.json`,
@@ -82,6 +82,7 @@ export const handlers: HttpHandler[] = [
8282
...pick(entityData, ["id"]),
8383
},
8484
};
85+
}
8586
case "delete":
8687
return {
8788
action: "delete",
@@ -128,7 +129,7 @@ export const handlers: HttpHandler[] = [
128129
},
129130
});
130131
}),
131-
http.put("http://ftrack.test/file-url", async (info) => {
132+
http.put("http://ftrack.test/file-url", async () => {
132133
return new Response(null, {
133134
status: 200,
134135
headers: { "Access-Control-Allow-Origin": "*" },
@@ -137,11 +138,11 @@ export const handlers: HttpHandler[] = [
137138
// Get socket io session id
138139
http.get("https://ftrack.test/socket.io/1/", handleSocketIORequest),
139140
http.get("http://ftrack.test/socket.io/1/", handleSocketIORequest),
140-
http.get("https://ftrack.test/*", (info) => {
141+
http.get("https://ftrack.test/*", () => {
141142
return new Response(null, { status: 200 });
142143
}),
143144

144-
http.get("http://ftrack.test:8080/*", (info) => {
145+
http.get("http://ftrack.test:8080/*", () => {
145146
return new Response(null, { status: 200 });
146147
}),
147148
];

0 commit comments

Comments
 (0)