Skip to content

Commit 04195ef

Browse files
committed
refactor(eslint): upgrade eslint to v9 and fix breaking changes with @squonk/eslint v3
1 parent 795e23c commit 04195ef

13 files changed

+714
-629
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@
103103
"@bufbuild/protoc-gen-es": "2.2.5",
104104
"@next/bundle-analyzer": "15.2.4",
105105
"@playwright/test": "1.51.1",
106-
"@squonk/eslint-config": "2.2.0",
106+
"@squonk/eslint-config": "3.0.0",
107107
"dotenv": "16.4.7",
108-
"eslint": "8.57.1",
108+
"eslint": "9.25.1",
109109
"husky": "9.1.7",
110110
"identity-obj-proxy": "3.0.0",
111111
"lint-staged": "15.5.0",

pnpm-lock.yaml

+701-594
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/SMILESInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const SMILESInput = ({
117117
}
118118

119119
const saveHandler = async () => {
120-
const ketcher = global.ketcher;
120+
const ketcher = globalThis.ketcher;
121121
try {
122122
const smi = await ketcher?.getSmiles();
123123
if (smi === undefined) {

src/components/Sketcher.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const Sketcher = ({ smiles }: SketcherProps) => {
8080

8181
// Synchronise the react state to the component
8282
useEffect(() => {
83-
void global.ketcher?.setMolecule(smiles);
83+
void globalThis.ketcher?.setMolecule(smiles);
8484
}, [smiles]);
8585

8686
return (
@@ -97,7 +97,7 @@ export const Sketcher = ({ smiles }: SketcherProps) => {
9797
staticResourcesUrl="./" // TODO: Config for subpaths
9898
structServiceProvider={new StandaloneStructServiceProvider()}
9999
onInit={(ketcher: Ketcher) => {
100-
global.ketcher = ketcher;
100+
globalThis.ketcher = ketcher;
101101
void ketcher.setMolecule(smiles);
102102
window.parent.postMessage({ eventType: "init" }, "*");
103103
}}

src/components/runCards/JobCard/JobInputFields.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export const JobInputFields = ({
9797
} else if (type === "molecules-smi") {
9898
// Going to replace the "molecules-smi" type as this is specified by "multiple".
9999
// For now though, we assume it's always multiple molecules
100+
// eslint-disable-next-line no-useless-assignment
100101
multiple = true;
101102

102103
const required = inputs.required?.includes(key);

src/features/SDFViewer/SDFViewerData.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useMemo, useState } from "react";
22

3-
import { type SDFRecord } from "@squonk/sdf-parser";
3+
import { type SDFRecord } from "@squonk/sdf-parser/web";
44

55
import { Alert, AlertTitle, Box, LinearProgress, Typography } from "@mui/material";
66
import { useQuery } from "@tanstack/react-query";

src/features/SDFViewer/useGetSDFSchema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useGetProjectFile } from "@squonk/data-manager-client/project";
2-
import { createSDFTransformer } from "@squonk/sdf-parser";
2+
import { createSDFTransformer } from "@squonk/sdf-parser/web";
33

44
import { useQuery } from "@tanstack/react-query";
55

src/hooks/useTimeElapsed.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useLayoutEffect, useRef, useState } from "react";
22

3-
const useIsomorphicEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
3+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
4+
const useIsomorphicEffect = globalThis.window === undefined ? useEffect : useLayoutEffect;
45

56
export interface Props {
67
/** Animation duration in seconds */

src/pages/_app.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ const App = ({ Component, pageProps }: CustomAppProps) => {
4444
// React-Query
4545
const queryClient = useMemo(() => new QueryClient(), []);
4646

47-
// Vercel specific code is only imported if needed
48-
// if (process.env.NEXT_PUBLIC_VERCEL_URL) {
49-
// import("../utils/next/vercelRedirect").then(({ vercelRedirect }) => vercelRedirect());
50-
// }
51-
5247
return (
5348
<StrictMode>
5449
<AppCacheProvider {...pageProps}>

src/pages/api/sdf-parser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
type FilterRule,
44
NodeSDFTransformer,
55
type SDFRecord,
6-
} from "@squonk/sdf-parser";
6+
} from "@squonk/sdf-parser/node";
77

88
import { getAccessToken, withApiAuthRequired } from "@auth0/nextjs-auth0";
99
import { type NextApiRequest, type NextApiResponse } from "next";

src/utils/app/routes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const projectFileURL: (typeof API_ROUTES)["projectFile"] = (project, path
1717
process.env.DATA_MANAGER_API_SERVER + API_ROUTES.projectFile(project, path, file);
1818

1919
export const projectURL = (projectId: string) =>
20-
window.location.origin +
20+
globalThis.location.origin +
2121
(process.env.NEXT_PUBLIC_BASE_PATH ?? "") +
2222
"/project?" +
2323
new URLSearchParams([["project", projectId]]).toString();

src/utils/next/vercelRedirect.ts

-19
This file was deleted.

tests/project-bootstrap.browser-authenticated.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ test("Project bootstrap works", async ({ page, baseURL }) => {
9999
await page.locator(`button:has-text("Create")`).isDisabled();
100100

101101
const regexp = new RegExp(
102-
baseURL + "/?\\?project=project-[\\w\\d]+-[\\w\\d]+-[\\w\\d]+-[\\w\\d]+-[\\w\\d]+",
102+
baseURL + String.raw`/?\?project=project-[\w\d]+-[\w\d]+-[\w\d]+-[\w\d]+-[\w\d]+`,
103103
"u",
104104
);
105105
await expect(page).toHaveURL(regexp, { timeout: 30_000 });

0 commit comments

Comments
 (0)