Skip to content

Commit

Permalink
Update dependencies:
Browse files Browse the repository at this point in the history
* Updated most packages.
* Fixed new errors brought up by Eslint related package changes.
* Eslint:
  - Fixed new errors brought up by Eslint related package changes.
  - Not updated to version 9 yet.
  - eslint-plugin-cypress held at ^3.6.0, ≥4 requires Eslint ≥9.
  - eslint-plugin-lodash held at ^7.4.0, ≥8 requires Eslint ≥9.
  - eslint-plugin-jsx-a11y pinned at 6.7.1, newer versions still have
    excessively strict rules. Needs to be rectifies during or before
    migrating to Eslint 9.
* Actual UI:
  - @headlessui/react still held at ^1.7.10, v2 is not compatable with
     our fucked up codebase.
  - @types/mapbox__mapbox-gl-draw, still pinned at 1.4.6, due to
    conflicting typings, with some of the map related deps.
  - React+dom+typings held at lates V18 release. Our codebase should
    preferably be able to run in <StrictMode>, mefore React update.
  - Next + eslint config, held at V14, should be replaced with Vite.
  - maplibre-gl held at ^4.7.1, V5 has API changes.
  - react-router-dom held at ^6.28.1, V7 needs some bigger changes.
  - utf-8-validate still pinned at 6.0.3, newer versions require newer
    node versions too.
* Other version holds
  - @rollup/plugin-typescript in TDB held at ^11.1.6, our current
    configuration is not compatible with ≥12.1.2.
  - @types/node held at ^18.19.70, as we are still running on node 18.
  - uuid + types, still held at ^9.0.8, as the ≥10 version needs a
    newer version of node.
  • Loading branch information
Huulivoide committed Jan 15, 2025
1 parent feeb9f9 commit 6b91981
Show file tree
Hide file tree
Showing 30 changed files with 3,391 additions and 3,134 deletions.
18 changes: 9 additions & 9 deletions codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
},
"dependencies": {
"@graphql-codegen/add": "^5.0.3",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/introspection": "^4.0.3",
"@graphql-codegen/typescript": "^4.0.9",
"@graphql-codegen/typescript-operations": "^4.2.3",
"@graphql-codegen/typescript-react-apollo": "^4.3.1",
"@graphql-tools/load": "^8.0.2",
"@graphql-tools/merge": "^9.0.7",
"@graphql-tools/schema": "^10.0.6",
"@parcel/watcher": "^2.4.1",
"graphql": "^16.9.0",
"@graphql-codegen/typescript": "^4.1.2",
"@graphql-codegen/typescript-operations": "^4.4.0",
"@graphql-codegen/typescript-react-apollo": "^4.3.2",
"@graphql-tools/load": "^8.0.12",
"@graphql-tools/merge": "^9.0.17",
"@graphql-tools/schema": "^10.0.16",
"@parcel/watcher": "^2.5.0",
"graphql": "^16.10.0",
"graphql-tag": "^2.12.6"
}
}
12 changes: 6 additions & 6 deletions cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"@cypress/grep": "^4.1.0",
"@hsl/jore4-test-db-manager": "1.0.0",
"@hsl/timetables-data-inserter": "1.0.0",
"cypress": "^13.14.2",
"cypress": "^13.17.0",
"lodash": "^4.17.21",
"luxon": "^3.5.0",
"qs": "^6.13.0"
"qs": "^6.13.1"
},
"devDependencies": {
"@types/lodash": "^4.17.7",
"@types/qs": "^6.9.15",
"@types/lodash": "^4.17.14",
"@types/luxon": "^3.4.2",
"eslint-plugin-cypress": "^3.5.0",
"find-test-names": "^1.28.29"
"@types/qs": "^6.9.18",
"eslint-plugin-cypress": "^3.6.0",
"find-test-names": "^1.29.2"
}
}
2 changes: 1 addition & 1 deletion jore4-hasura
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,30 @@
},
"dependencies": {},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/node": "^18.19.50",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"concurrently": "^9.0.0",
"eslint": "^8.57.0",
"@types/jest": "^29.5.14",
"@types/node": "^18.19.70",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"concurrently": "^9.1.2",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-config-prettier": "^10.0.1",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-i18n-json": "^4.0.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-i18n-json": "^4.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.10.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.6",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.9",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "^5.7.3"
},
"workspaces": [
"codegen",
Expand Down
16 changes: 8 additions & 8 deletions test-db-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
"ts:build": "yarn tsc --build"
},
"dependencies": {
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^11.1.6",
"cross-fetch": "^4.0.0",
"graphql": "^16.9.0",
"cross-fetch": "^4.1.0",
"graphql": "^16.10.0",
"graphql-tag": "^2.12.6",
"knex": "^3.1.0",
"lodash": "^4.17.21",
"luxon": "^3.5.0",
"pg": "^8.12.0",
"rollup": "^4.21.2",
"pg": "^8.13.1",
"rollup": "^4.30.1",
"rollup-plugin-dts": "^6.1.1",
"ts-node": "^10.9.2",
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/geojson": "^7946.0.14",
"@types/geojson": "^7946.0.15",
"@types/luxon": "^3.4.2",
"@types/pg": "^8.11.8"
"@types/pg": "^8.11.10"
}
}
2 changes: 1 addition & 1 deletion test-db-manager/src/DbManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DatabaseConnectionInfo } from './config';

export const getDbConnection = (knexConfig: DatabaseConnectionInfo): Knex => {
// TODO: not sure how to properly import knex without getting type errors
// eslint-disable-next-line @typescript-eslint/no-var-requires, global-require
// eslint-disable-next-line @typescript-eslint/no-require-imports,global-require
const db = require('knex')({ client: 'pg', connection: knexConfig });
return db;
};
Expand Down
9 changes: 6 additions & 3 deletions ui/graphql.schema.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"__schema": {
"queryType": {
"name": "query_root"
"name": "query_root",
"kind": "OBJECT"
},
"mutationType": {
"name": "mutation_root"
"name": "mutation_root",
"kind": "OBJECT"
},
"subscriptionType": {
"name": "subscription_root"
"name": "subscription_root",
"kind": "OBJECT"
},
"types": [
{
Expand Down
88 changes: 43 additions & 45 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,76 +16,74 @@
"start": "next start"
},
"dependencies": {
"@apollo/client": "^3.11.8",
"@apollo/client": "^3.12.5",
"@graphql-typed-document-node/core": "^3.2.0",
"@headlessui/react": "1.7.10",
"@headlessui/tailwindcss": "^0.2.1",
"@hookform/resolvers": "^3.9.0",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@hookform/resolvers": "^3.10.0",
"@mapbox/mapbox-gl-draw": "^1.5.0",
"@nebula.gl/edit-modes": "^1.0.4",
"@reduxjs/toolkit": "^2.2.7",
"@reduxjs/toolkit": "^2.5.0",
"@seznam/compose-react-refs": "^1.0.6",
"@turf/along": "^7.1.0",
"@turf/distance": "^7.1.0",
"@turf/flatten": "^7.1.0",
"@turf/helpers": "^7.1.0",
"@turf/length": "^7.1.0",
"@turf/nearest-point-on-line": "^7.1.0",
"@turf/point-to-line-distance": "7.1.0",
"@types/geojson": "^7946.0.14",
"@turf/along": "^7.2.0",
"@turf/distance": "^7.2.0",
"@turf/flatten": "^7.2.0",
"@turf/helpers": "^7.2.0",
"@turf/length": "^7.2.0",
"@turf/nearest-point-on-line": "^7.2.0",
"@turf/point-to-line-distance": "^7.2.0",
"@types/geojson": "^7946.0.15",
"apollo-link-scalars": "^4.0.3",
"axios": "^1.7.7",
"eslint-config-next": "^14.2.8",
"graphql": "^16.9.0",
"graphql-ws": "^5.16.0",
"axios": "^1.7.9",
"eslint-config-next": "^14.2.23",
"graphql": "^16.10.0",
"graphql-ws": "^5.16.2",
"hsl-map-style": "HSLdevcom/hsl-map-style#114c58e",
"i18next": "^23.14.0",
"i18next": "^24.2.1",
"immer": "^10.1.1",
"lodash": "^4.17.21",
"luxon": "^3.5.0",
"maplibre-gl": "^4.7.0",
"next": "^14.2.8",
"qs": "^6.13.0",
"maplibre-gl": "^4.7.1",
"next": "^14.2.23",
"qs": "^6.13.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-helmet-async": "^2.0.5",
"react-hook-form": "^7.53.0",
"react-hot-toast": "^2.4.1",
"react-i18next": "^15.0.1",
"react-icons": "^5.3.0",
"react-map-gl": "^7.1.7",
"react-redux": "^9.1.2",
"react-router-dom": "^6.26.1",
"react-spinners": "^0.14.1",
"react-hook-form": "^7.54.2",
"react-hot-toast": "^2.5.1",
"react-i18next": "^15.4.0",
"react-icons": "^5.4.0",
"react-map-gl": "^7.1.8",
"react-redux": "^9.2.0",
"react-router-dom": "^6.28.1",
"react-spinners": "^0.15.0",
"redux-logger": "^3.0.6",
"remeda": "^2.12.0",
"tailwind-merge": "^2.5.2",
"zod": "^3.23.8"
"remeda": "^2.19.1",
"tailwind-merge": "^2.6.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@hsl/jore4-test-db-manager": "1.0.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@types/geojson": "^7946.0.14",
"@types/lodash": "^4.17.7",
"@types/luxon": "^3.4.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@types/lodash": "^4.17.14",
"@types/mapbox__mapbox-gl-draw": "1.4.6",
"@types/qs": "^6.9.15",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/qs": "^6.9.18",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@types/react-router": "^5.1.20",
"@types/redux-logger": "^3.0.13k",
"autoprefixer": "^10.4.20",
"bufferutil": "^4.0.8",
"cross-fetch": "^4.0.0",
"bufferutil": "^4.0.9",
"cross-fetch": "^4.1.0",
"csstype": "^3.1.3",
"encoding": "^0.1.13",
"eslint-plugin-jest-formatting": "^3.1.0",
"express": "^4.19.2",
"http-proxy-middleware": "^3.0.2",
"postcss": "^8.4.45",
"tailwindcss": "^3.4.10",
"express": "^4.21.2",
"http-proxy-middleware": "^3.0.3",
"postcss": "^8.5.0",
"tailwindcss": "^3.4.17",
"utf-8-validate": "6.0.3"
}
}
2 changes: 1 addition & 1 deletion ui/src/auth/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const UserProvider: FC<PropsWithChildren> = ({ children }) => {
try {
const response = await Api.user.getUserInfo();
dispatch(loginSuccessAction(response.data));
} catch (error) {
} catch {
dispatch(loginFailedAction());
}
}, [dispatch]);
Expand Down
52 changes: 37 additions & 15 deletions ui/src/components/forms/common/EnumDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,48 @@ const testIds = {
// at least without using 'as' in many places (which in itself isn't type safe). Therefore,
// this was implemented by processing the Enum values as strings.

export interface EnumDropdownProps<TEnum> extends FormInputProps {
id?: string;
testId?: string;
className?: string;
// eslint-disable-next-line @typescript-eslint/ban-types
enumType: Object;
uiNameMapper: (key: TEnum) => string;
placeholder: string;
buttonClassName?: string;
includeAllOption?: boolean;
includeNullOption?: boolean;
nullOptionText?: string;
}
type EnumDropdownBaseProps<TEnum extends string> = FormInputProps & {
readonly id?: string;
readonly testId?: string;
readonly className?: string;
readonly buttonClassName?: string;
readonly placeholder: string;
readonly enumType: Readonly<Record<string, TEnum>>;
};

type EnumDropdownWithNullOptionProps = {
readonly includeNullOption: true;
readonly nullOptionText?: string;
};

type EnumDropdownWithoutNullOptionProps = {
readonly includeNullOption?: never | false;
readonly nullOptionText?: never;
};

type EnumDropdownWithPotentialAllOptionProps<TEnum extends string> = {
readonly includeAllOption: boolean;
readonly uiNameMapper: (key: TEnum | AllOptionEnum.All) => string;
};

type EnumDropdownWithoutAllOptionProps<TEnum extends string> = {
readonly includeAllOption?: never;
readonly uiNameMapper: (key: TEnum) => string;
};

export type EnumDropdownProps<TEnum extends string> =
EnumDropdownBaseProps<TEnum> &
(EnumDropdownWithNullOptionProps | EnumDropdownWithoutNullOptionProps) &
(
| EnumDropdownWithPotentialAllOptionProps<TEnum>
| EnumDropdownWithoutAllOptionProps<TEnum>
);

/**
* Creates dropdown from enum values. This dropdown can be enrichted with 'All' option by giving
* it the includeAllOption flag as true.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export const EnumDropdown = <TEnum extends Object>({
export const EnumDropdown = <TEnum extends string>({
id,
testId,
enumType,
Expand Down
3 changes: 1 addition & 2 deletions ui/src/components/forms/common/EnumMultiSelectDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import { EnumDropdownProps } from './EnumDropdown';
const testIds = {
enumDropdown: 'EnumDropdown',
};
// eslint-disable-next-line @typescript-eslint/ban-types
export const EnumMultiSelectDropdown = <TEnum extends Object>({
export const EnumMultiSelectDropdown = <TEnum extends string>({
id,
testId,
enumType,
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/forms/line/LineTypeDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next';
import { RouteTypeOfLineEnum } from '../../../generated/graphql';
import { mapLineTypeToUiName } from '../../../i18n/uiNameMappings';
import { FormInputProps } from '../../../uiComponents';
import { EnumDropdown } from '../common/EnumDropdown';
import { EnumDropdown } from '../common';

interface Props extends FormInputProps {
id?: string;
Expand All @@ -19,13 +19,13 @@ export const LineTypeDropdown = ({
const { t } = useTranslation();

return (
<EnumDropdown<RouteTypeOfLineEnum>
<EnumDropdown
id={id}
testId={testId}
enumType={RouteTypeOfLineEnum}
placeholder={t('lines.chooseTypeOfLine')}
uiNameMapper={mapLineTypeToUiName}
includeAllOption={includeAllOption}
includeAllOption={!!includeAllOption}
// eslint-disable-next-line react/jsx-props-no-spreading
{...formInputProps}
/>
Expand Down
Loading

0 comments on commit 6b91981

Please sign in to comment.