Skip to content

Commit 3bdf903

Browse files
authored
[Feature]: Update git hooks and package json #2705 (#2706)
1 parent 2617c0f commit 3bdf903

File tree

15 files changed

+111
-79
lines changed

15 files changed

+111
-79
lines changed

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,21 @@ repos:
1717
rev: v5.0.0
1818
hooks:
1919
- id: end-of-file-fixer
20+
21+
- repo: https://github.com/pre-commit/mirrors-eslint
22+
rev: ''
23+
hooks:
24+
- id: eslint
25+
name: ESLint
26+
entry: eslint --fix --config frontend/.eslintrc --ignore-path frontend/.eslintignore
27+
language: node
28+
pass_filenames: false
29+
cwd: "frontend/"
30+
additional_dependencies:
31+
- eslint@8.31.0
32+
- eslint-config-prettier@8.10.0
33+
- eslint-plugin-i18n@2.4.0
34+
- eslint-plugin-prettier@4.2.1
35+
- eslint-plugin-simple-import-sort@10.0.0
36+
- '@typescript-eslint/eslint-plugin@5.48.1'
37+
- '@typescript-eslint/parser@5.48.1'

frontend/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ src/locale
55
src/types
66
src/setupProxy.js
77
webpack/**
8+
webpack/env.js
9+
webpack/prod.js
810
public
911
staticServer.js
1012
webpack.config.js

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"main": "src/index.ts",
55
"repository": "git@gitlab.com:dstackai/dstackai-website.git",
66
"author": "Oleg Vavilov",
7-
"license": "MIT",
7+
"license": "Apache 2.0",
88
"private": true,
99
"scripts": {
1010
"start": "cross-env NODE_ENV=development webpack serve --config webpack.config.js",

frontend/src/components/FileUploader/FileEntry/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const FileEntry: React.FC<IProps> = ({ file, showImage = false, truncateL
2222
};
2323
reader.readAsDataURL(file);
2424

25+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2526
const ext = file.name.split('.').pop()!;
2627
const displayFileName =
2728
file.name.length - ext.length - 1 > truncateLength ? `${file.name.slice(0, truncateLength)}... .${ext}` : file.name;

frontend/src/layouts/AppLayout/TutorialPanel/hooks.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { useCallback, useEffect, useMemo, useRef } from 'react';
22
import { useNavigate } from 'react-router-dom';
33

4-
import { DISCORD_URL, QUICK_START_URL, TALLY_FORM_ID } from 'consts';
4+
import {
5+
DISCORD_URL,
6+
QUICK_START_URL,
7+
// TALLY_FORM_ID
8+
} from 'consts';
59
import { useAppDispatch, useAppSelector } from 'hooks';
610
import { goToUrl } from 'libs';
711
import { useGetRunsQuery } from 'services/run';
@@ -60,6 +64,7 @@ export const useTutorials = () => {
6064
dispatch(updateTutorialPanelState({ billingCompleted: true }));
6165
}, []);
6266

67+
// eslint-disable-next-line @typescript-eslint/no-empty-function
6368
const startConfigCliTutorial = useCallback(() => {}, [billingUrl]);
6469

6570
const finishConfigCliTutorial = useCallback(() => {

frontend/src/libs/fetchBaseQueryHeaders.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,4 @@ function baseQueryHeaders(headers: Headers, { getState }: Pick<BaseQueryApi, 'ge
1515
return headers;
1616
}
1717

18-
export function unauthorizedQueryHeaders(headers: Headers, { getState }: Pick<BaseQueryApi, 'getState'>): Headers {
19-
headers.set('X-API-VERSION', 'latest');
20-
return headers;
21-
}
22-
2318
export default baseQueryHeaders;

frontend/src/libs/serverErrors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function isResponseServerError(formErrors: unknown): formErrors is Respon
3636
);
3737
}
3838

39+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3940
export function getServerError(error: any): string {
4041
let errorText = error?.error;
4142

frontend/src/pages/Runs/Details/index.tsx

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect } from 'react';
22
import { useTranslation } from 'react-i18next';
3-
import { Outlet, useNavigate, useParams } from 'react-router-dom';
3+
import { Outlet, /*useNavigate,*/ useParams } from 'react-router-dom';
44
import Button from '@cloudscape-design/components/button';
55

66
import { ContentLayout, DetailsHeader, Tabs } from 'components';
@@ -10,7 +10,11 @@ import { getServerError, riseRouterException } from 'libs';
1010
import { ROUTES } from 'routes';
1111
import { useDeleteRunsMutation, useGetRunQuery, useStopRunsMutation } from 'services/run';
1212

13-
import { isAvailableAbortingForRun, isAvailableDeletingForRun, isAvailableStoppingForRun } from '../utils';
13+
import {
14+
isAvailableAbortingForRun,
15+
isAvailableStoppingForRun,
16+
// isAvailableDeletingForRun,
17+
} from '../utils';
1418

1519
import styles from './styles.module.scss';
1620

@@ -21,7 +25,7 @@ enum CodeTab {
2125

2226
export const RunDetailsPage: React.FC = () => {
2327
const { t } = useTranslation();
24-
const navigate = useNavigate();
28+
// const navigate = useNavigate();
2529
const params = useParams();
2630
const paramProjectName = params.projectName ?? '';
2731
const paramRunId = params.runId ?? '';
@@ -41,7 +45,7 @@ export const RunDetailsPage: React.FC = () => {
4145
}, [runError]);
4246

4347
const [stopRun, { isLoading: isStopping }] = useStopRunsMutation();
44-
const [deleteRun, { isLoading: isDeleting }] = useDeleteRunsMutation();
48+
const [, /* deleteRun ,*/ { isLoading: isDeleting }] = useDeleteRunsMutation();
4549

4650
useBreadcrumbs([
4751
{
@@ -100,30 +104,30 @@ export const RunDetailsPage: React.FC = () => {
100104
});
101105
};
102106

103-
const deleteClickHandle = () => {
104-
if (!runData) {
105-
return;
106-
}
107-
108-
deleteRun({
109-
project_name: paramProjectName,
110-
runs_names: [runData.run_spec.run_name],
111-
})
112-
.unwrap()
113-
.then(() => {
114-
navigate(ROUTES.RUNS.LIST);
115-
})
116-
.catch((error) => {
117-
pushNotification({
118-
type: 'error',
119-
content: t('common.server_error', { error: getServerError(error) }),
120-
});
121-
});
122-
};
107+
// const deleteClickHandle = () => {
108+
// if (!runData) {
109+
// return;
110+
// }
111+
//
112+
// deleteRun({
113+
// project_name: paramProjectName,
114+
// runs_names: [runData.run_spec.run_name],
115+
// })
116+
// .unwrap()
117+
// .then(() => {
118+
// navigate(ROUTES.RUNS.LIST);
119+
// })
120+
// .catch((error) => {
121+
// pushNotification({
122+
// type: 'error',
123+
// content: t('common.server_error', { error: getServerError(error) }),
124+
// });
125+
// });
126+
// };
123127

124128
const isDisabledAbortButton = !runData || !isAvailableAbortingForRun(runData.status) || isStopping || isDeleting;
125129
const isDisabledStopButton = !runData || !isAvailableStoppingForRun(runData.status) || isStopping || isDeleting;
126-
const isDisabledDeleteButton = !runData || !isAvailableDeletingForRun(runData.status) || isStopping || isDeleting;
130+
// const isDisabledDeleteButton = !runData || !isAvailableDeletingForRun(runData.status) || isStopping || isDeleting;
127131

128132
return (
129133
<div className={styles.page}>

frontend/src/pages/Runs/List/index.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import styles from './styles.module.scss';
2525

2626
export const RunList: React.FC = () => {
2727
const { t } = useTranslation();
28-
const [searchParams, setSearchParams] = useSearchParams();
28+
const [, setSearchParams] = useSearchParams();
2929
const [preferences] = useRunListPreferences();
3030

3131
useBreadcrumbs([
@@ -50,7 +50,10 @@ export const RunList: React.FC = () => {
5050

5151
const { stopRuns, isStopping } = useStopRuns();
5252
const { abortRuns, isAborting } = useAbortRuns();
53-
const { deleteRuns, isDeleting } = useDeleteRuns();
53+
const {
54+
// deleteRuns,
55+
isDeleting,
56+
} = useDeleteRuns();
5457

5558
const { columns } = useColumnsDefinitions();
5659

@@ -75,7 +78,11 @@ export const RunList: React.FC = () => {
7578

7679
const { selectedItems } = collectionProps;
7780

78-
const { isDisabledAbortButton, isDisabledStopButton, isDisabledDeleteButton } = useDisabledStatesForButtons({
81+
const {
82+
isDisabledAbortButton,
83+
isDisabledStopButton,
84+
// isDisabledDeleteButton
85+
} = useDisabledStatesForButtons({
7986
selectedRuns: selectedItems,
8087
isStopping,
8188
isAborting,
@@ -94,11 +101,11 @@ export const RunList: React.FC = () => {
94101
stopRuns([...selectedItems]).then(() => actions.setSelectedItems([]));
95102
};
96103

97-
const deleteClickHandle = () => {
98-
if (!selectedItems?.length) return;
99-
100-
deleteRuns([...selectedItems]).catch(console.log);
101-
};
104+
// const deleteClickHandle = () => {
105+
// if (!selectedItems?.length) return;
106+
//
107+
// deleteRuns([...selectedItems]).catch(console.log);
108+
// };
102109

103110
return (
104111
<Table

frontend/src/pages/User/Details/Billing/index.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ROUTES } from 'routes';
1212
import {
1313
useGetUserBillingInfoQuery,
1414
useUserBillingCheckoutSessionMutation,
15-
useUserBillingPortalSessionMutation,
15+
// useUserBillingPortalSessionMutation,
1616
} from 'services/user';
1717
import { GlobalUserRole } from 'types';
1818

@@ -37,7 +37,7 @@ export const Billing: React.FC = () => {
3737

3838
const { data, isLoading } = useGetUserBillingInfoQuery({ username: paramUserName });
3939
const [billingCheckout, { isLoading: isLoadingBillingCheckout }] = useUserBillingCheckoutSessionMutation();
40-
const [billingPortalSession, { isLoading: isLoadingBillingPortalSession }] = useUserBillingPortalSessionMutation();
40+
// const [billingPortalSession, { isLoading: isLoadingBillingPortalSession }] = useUserBillingPortalSessionMutation();
4141

4242
useBreadcrumbs([
4343
{
@@ -81,20 +81,21 @@ export const Billing: React.FC = () => {
8181
setShowPaymentModal(true);
8282
};
8383

84-
const editPaymentMethod = () => {
85-
billingPortalSession({
86-
username: paramUserName,
87-
})
88-
.unwrap()
89-
.then((data) => goToUrl(data.url))
90-
.catch((error) => {
91-
pushNotification({
92-
type: 'error',
93-
content: t('common.server_error', { error: getServerError(error) }),
94-
});
95-
})
96-
.finally(closeModal);
97-
};
84+
// const editPaymentMethod = () => {
85+
// billingPortalSession({
86+
// username: paramUserName,
87+
// })
88+
// .unwrap()
89+
// .then((data) => goToUrl(data.url))
90+
// .catch((error) => {
91+
// pushNotification({
92+
// type: 'error',
93+
// content: t('common.server_error', { error: getServerError(error) }),
94+
// });
95+
// })
96+
// .finally(closeModal);
97+
// };
98+
9899
const closeModal = () => {
99100
setShowPaymentModal(false);
100101
};

0 commit comments

Comments
 (0)