Skip to content

chore: Bump dependencies #287

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

Merged
merged 13 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from 10 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
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

husky deprecated having to include this

yarn lint-staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
38 changes: 38 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import vitest from "@vitest/eslint-plugin";
import globals from "globals";

// @ts-check

export default tseslint.config(
{ ignores: ["dist"] },
eslint.configs.recommended,
tseslint.configs.recommended,
{
files: ["test/**/*.{ts,js}", "vitest.setup.js", "vitest.globalsetup.js"],
...vitest.configs.recommended,
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.es2025,
...vitest.environments.env.globals,
},
},
},
{
files: ["source/**/*.{ts,js}"],
languageOptions: {
globals: { ...globals.browser, ...globals.node, ...globals.es2025 },
},
},
{
files: ["**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/ban-ts-comment": "off",
},
},
);
36 changes: 19 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,24 @@
"dist"
],
"devDependencies": {
"@types/uuid": "^9.0.8",
"cross-fetch": "^4.0.0",
"dayjs": "^1.11.10",
"eslint": "^8.56.0",
"eslint-config-react-app": "^7.0.1",
"husky": "^9.0.10",
"jsdom": "^24.0.0",
"lint-staged": "^15.2.2",
"msw": "^2.2.0",
"@types/node": "^22.13.9",
"@types/uuid": "^10.0.0",
"@vitest/eslint-plugin": "^1.1.36",
"dayjs": "^1.11.13",
"eslint": "^9.21.0",
"globals": "^16.0.0",
"husky": "^9.1.7",
"jsdom": "^26.0.0",
"lint-staged": "^15.4.3",
"msw": "^2.7.3",
"pinst": "^3.0.0",
"prettier": "^3.2.5",
"typescript": "^5.3.3",
"vite": "^5.4.7",
"vite-plugin-dts": "^3.7.2",
"vitest": "^1.2.2",
"ws": "^8.16.0"
"prettier": "^3.5.3",
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.0",
"vite": "^6.2.0",
"vite-plugin-dts": "^4.5.3",
"vitest": "^3.0.7",
"ws": "^8.18.1"
},
"repository": {
"type": "git",
Expand All @@ -59,9 +61,9 @@
"homepage": "http://ftrack.com",
"dependencies": {
"isomorphic-ws": "^5.0.0",
"loglevel": "^1.9.1",
"loglevel": "^1.9.2",
"moment": "^2.30.1",
"uuid": "^9.0.1"
"uuid": "^11.1.0"
},
"peerDependencies": {
"ws": "^8.13.0"
Expand Down
4 changes: 2 additions & 2 deletions source/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export class Session<
if (data && data.constructor === Object) {
const out: Data = {};
for (const key in data) {
if (data.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
out[key] = this.encode(data[key]);
}
}
Expand Down Expand Up @@ -545,7 +545,7 @@ export class Session<
const mergedEntity = identityMap[identifier];

for (const key in entity) {
if (entity.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(entity, key)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eslint - avoid calling hasOwnProperty on the object directly

Copy link
Contributor

Choose a reason for hiding this comment

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

Use Object.hasOwn() instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

mergedEntity[key] = this.decode(entity[key], identityMap, {
decodeDatesAsIso,
ensureSerializableResponse,
Expand Down
1 change: 1 addition & 0 deletions source/simple_socketio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export default class SimpleSocketIOClient {
// Set transport.websocket property as a public alias of the websocket
this.socket.transport.websocket = this.webSocket;
this.addInitialEventListeners(this.webSocket);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
this.reconnecting = false;
}
Expand Down
19 changes: 7 additions & 12 deletions source/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,9 @@ export class Uploader<TEntityTypeMap extends Record<string, any>> {
part: MultiPartUploadPart,
onUploadChunkStart: () => void,
): Promise<void> {
try {
const status = await this.uploadFileChunk(
chunk,
part,
onUploadChunkStart,
);
if (status !== 200) {
throw new CreateComponentError(`Failed to upload file part: ${status}`);
}
} catch (error) {
throw error;
const status = await this.uploadFileChunk(chunk, part, onUploadChunkStart);
if (status !== 200) {
throw new CreateComponentError(`Failed to upload file part: ${status}`);
}
}

Expand Down Expand Up @@ -516,7 +508,10 @@ export class Uploader<TEntityTypeMap extends Record<string, any>> {
};

for (const key in headers) {
if (headers.hasOwnProperty(key) && key !== "Content-Length") {
if (
Object.prototype.hasOwnProperty.call(headers, key) &&
key !== "Content-Length"
) {
this.xhr.setRequestHeader(key, headers[key]);
}
}
Expand Down
1 change: 1 addition & 0 deletions source/util/convert_to_iso_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function convertToIsoString(
// wrap it new Date() to convert it to UTC based ISO string in case it is in another timezone
try {
return new Date(data as any).toISOString();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return null;
}
Expand Down
13 changes: 0 additions & 13 deletions test/.eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion test/event_hub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe("EventHub", () => {
expect(callback).not.toHaveBeenCalled();
});

test("should handle events with unexpected topics", () => {
test("should handle events with more unexpected topics", () => {
const callback = vi.fn();
eventHub.subscribe("topic=*", callback);
const testEvent = { topic: null, data: {} };
Expand Down
21 changes: 11 additions & 10 deletions test/server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// :copyright: Copyright (c) 2022 ftrack
import { HttpResponse, type PathParams, http, HttpHandler } from "msw";
import fs from "fs/promises";
import querySchemas from "./fixtures/query_schemas.json";
import queryServerInformation from "./fixtures/query_server_information.json";
import getUploadMetadata from "./fixtures/get_upload_metadata.json";
import completeMultipartUpload from "./fixtures/complete_multipart_upload.json";
import exampleQuery from "./fixtures/query_select_name_from_task_limit_1.json";
import querySchemas from "./fixtures/query_schemas.json" with { type: "json" };
import queryServerInformation from "./fixtures/query_server_information.json" with { type: "json" };
import getUploadMetadata from "./fixtures/get_upload_metadata.json" with { type: "json" };
import completeMultipartUpload from "./fixtures/complete_multipart_upload.json" with { type: "json" };
import exampleQuery from "./fixtures/query_select_name_from_task_limit_1.json" with { type: "json" };
import { setupServer } from "msw/node";
const InvalidCredentialsError = {
content:
Expand All @@ -25,7 +25,7 @@ function authenticate(info: Parameters<Parameters<typeof http.post>[1]>[0]) {

function pick<T>(object: T, keys: (keyof T)[]) {
return keys.reduce((obj, key) => {
if (object && object.hasOwnProperty(key)) {
if (object && Object.prototype.hasOwnProperty.call(object, key)) {
obj[key] = object[key];
}
return obj;
Expand Down Expand Up @@ -66,7 +66,7 @@ export const handlers: HttpHandler[] = [
return queryServerInformation;
case "query_schemas":
return querySchemas;
case "create":
case "create": {
// create are fetched from test/fixtures where the file name matches the full expression
const createFixture = await fs.readFile(
`${__dirname}/fixtures/create_${entityType.toLowerCase()}.json`,
Expand All @@ -82,6 +82,7 @@ export const handlers: HttpHandler[] = [
...pick(entityData, ["id"]),
},
};
}
case "delete":
return {
action: "delete",
Expand Down Expand Up @@ -128,7 +129,7 @@ export const handlers: HttpHandler[] = [
},
});
}),
http.put("http://ftrack.test/file-url", async (info) => {
http.put("http://ftrack.test/file-url", async () => {
return new Response(null, {
status: 200,
headers: { "Access-Control-Allow-Origin": "*" },
Expand All @@ -137,11 +138,11 @@ export const handlers: HttpHandler[] = [
// Get socket io session id
http.get("https://ftrack.test/socket.io/1/", handleSocketIORequest),
http.get("http://ftrack.test/socket.io/1/", handleSocketIORequest),
http.get("https://ftrack.test/*", (info) => {
http.get("https://ftrack.test/*", () => {
return new Response(null, { status: 200 });
}),

http.get("http://ftrack.test:8080/*", (info) => {
http.get("http://ftrack.test:8080/*", () => {
return new Response(null, { status: 200 });
}),
];
Expand Down
Loading