Skip to content

Commit acac0c5

Browse files
author
Keivan Vosoughi
committed
Fix Lint Errors
1 parent c1d2cd0 commit acac0c5

40 files changed

+95
-252
lines changed

app/client/src/Container.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ const PageHeader = styled(Header)`
4848
height: fit-content;
4949
padding: 5px 15px
5050
`;
51-
const StyledImg = styled.img`
52-
height: ${props => props?.height && `${props.height}px`}
53-
`
5451

5552
const StyledText = styled.div`
5653
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';

app/client/src/api/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ interface UsePostApiReturn<T> {
106106
data: T | null;
107107
loading: boolean;
108108
error: Error | null;
109-
triggerPost: (body: Record<string, any>) => Promise<void>;
109+
triggerPost: (body: Record<string, unknown>) => Promise<void>;
110110
}
111111

112112
export function usePostApi<T>(url: string): UsePostApiReturn<T> {
113113
const [data, setData] = useState<T | null>(null);
114114
const [loading, setLoading] = useState(false);
115115
const [error, setError] = useState<Error | null>(null);
116116

117-
const triggerPost = async (body: Record<string, any>) => {
117+
const triggerPost = async (body: Record<string, unknown>) => {
118118
setLoading(true);
119119
setError(null); // Reset error on each request
120120

app/client/src/components/RouteAccessControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Navigate, useLocation } from "react-router-dom";
1010
*/
1111
interface RouteACProps{
1212
element: ReactNode;
13-
validator: (state: any | null) => boolean;
13+
validator: (state: unknown | null) => boolean;
1414
reroutePath?: string;
1515
}
1616
const RouteAccessControl: FC<RouteACProps> = ({ element, validator, reroutePath = '/' }) => {

app/client/src/components/TelemetryDashboard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React, { useState, useEffect } from 'react';
22
import {
33
BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer,
4-
LineChart, Line, AreaChart, Area
4+
LineChart, Line
55
} from 'recharts';
66
import axios from 'axios';
77
import {
88
Card, Typography, Row, Col, Statistic, Select, Spin, Empty, Table, Tag, Tabs, Alert, Progress, Space, Badge, Button
99
} from 'antd';
1010
import {
1111
DashboardOutlined, ApiOutlined, CloudServerOutlined, RocketOutlined, SyncOutlined,
12-
PieChartOutlined, BarChartOutlined, CodeOutlined, WarningOutlined, CheckCircleOutlined, CloseCircleOutlined
12+
CodeOutlined, WarningOutlined, CheckCircleOutlined, CloseCircleOutlined
1313
} from '@ant-design/icons';
1414

1515
const { Title, Text } = Typography;
@@ -19,7 +19,7 @@ const SUCCESS_COLOR = '#52c41a';
1919
const ERROR_COLOR = '#f5222d';
2020
const WARNING_COLOR = '#faad14';
2121
const INFO_COLOR = '#1890ff';
22-
const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042', '#8884d8', '#4CAF50', '#F44336', '#9C27B0'];
22+
// const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042', '#8884d8', '#4CAF50', '#F44336', '#9C27B0'];
2323

2424
const TelemetryDashboard = () => {
2525
const [loading, setLoading] = useState(true);

app/client/src/pages/DataGenerator/Configure.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import endsWith from 'lodash/endsWith';
22
import isEmpty from 'lodash/isEmpty';
3+
import isFunction from 'lodash/isFunction';
34
import { useEffect, useState } from 'react';
45
import { Flex, Form, Input, Select, Typography } from 'antd';
56
import styled from 'styled-components';
@@ -9,8 +10,7 @@ import { MODEL_PROVIDER_LABELS } from './constants';
910
import { ModelProviders, ModelProvidersDropdownOpts } from './types';
1011
import { useWizardCtx } from './utils';
1112
import FileSelectorButton from './FileSelectorButton';
12-
import first from 'lodash/first';
13-
import get from 'lodash/get';
13+
1414

1515
const StepContainer = styled(Flex)`
1616
background: white;
@@ -58,10 +58,10 @@ const Configure = () => {
5858
delete values.output_value;
5959

6060
const allFieldsFilled = Object.values(values).every(value => Boolean(value));
61-
if (allFieldsFilled) {
62-
setIsStepValid && setIsStepValid(true)
63-
} else {
64-
setIsStepValid && setIsStepValid(false)
61+
if (allFieldsFilled && isFunction(setIsStepValid)) {
62+
setIsStepValid(true)
63+
} else if (isFunction(setIsStepValid)) {
64+
setIsStepValid(false)
6565
}
6666
}
6767
useEffect(() => {
@@ -93,7 +93,7 @@ const Configure = () => {
9393
form.setFieldValue('doc_paths', paths);
9494
}
9595

96-
const onFilesChange = (selections: any) => {
96+
const onFilesChange = (selections: unknown) => {
9797
if (Array.isArray(selections) && !isEmpty(selections)) {
9898
const paths = selections.map((file: File) => (
9999
{

app/client/src/pages/DataGenerator/CustomPromptButton.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { Button, Flex, Form, Input, Modal, notification, Spin } from "antd";
1+
import { Button, Form, Input, Modal, notification } from "antd";
22
import { useEffect, useState } from "react";
33
import { useMutation } from "@tanstack/react-query";
44
import styled from "styled-components";
5-
import { LoadingOutlined } from '@ant-design/icons';
6-
import { fetchCustomPrompt, fetchPrompt } from "./hooks";
5+
import { fetchCustomPrompt } from "./hooks";
76
import Loading from "../Evaluator/Loading";
87

98
interface Props {

app/client/src/pages/DataGenerator/DataGenerator.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import isEmpty from 'lodash/isEmpty';
22
import isString from 'lodash/isString';
33
import { useRef, useState } from 'react';
44
import { useLocation } from 'react-router-dom';
5-
import { Button, Flex, Form, Layout, Steps, Typography } from 'antd';
5+
import { Button, Flex, Form, Layout, Steps } from 'antd';
66
import type { FormInstance } from 'antd';
77
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
88
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
@@ -117,10 +117,10 @@ const DataGenerator = () => {
117117

118118
}
119119

120-
if (datasetDetailsReq && datasetDetailsReq.data &&
121-
!isEmpty(datasetDetailsReq?.data?.generate_file_name)) {
122-
initialData.example_path = initialData?.example_path;
123-
}
120+
// if (datasetDetailsReq && datasetDetailsReq.data &&
121+
// !isEmpty(datasetDetailsReq?.data?.generate_file_name)) {
122+
// initialData.example_path = initialData?.example_path;
123+
// }
124124

125125
if (Array.isArray(initialData?.input_paths) && !isEmpty(initialData?.input_paths) ) {
126126
initialData.doc_paths = initialData?.input_paths.map((path: string) => ({

app/client/src/pages/DataGenerator/Examples.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import first from 'lodash/first';
22
import get from 'lodash/get';
33
import isEmpty from 'lodash/isEmpty';
44
import React, { useEffect } from 'react';
5-
import { Button, Form, Modal, Space, Table, Tooltip, Typography, Flex, Input, Empty, Alert } from 'antd';
5+
import { Button, Form, Modal, Space, Table, Tooltip, Typography, Flex, Input, Empty } from 'antd';
66
import { CloudUploadOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons';
77
import styled from 'styled-components';
88
import { useMutation } from "@tanstack/react-query";
@@ -56,7 +56,6 @@ enum ExampleType {
5656

5757
const Examples: React.FC = () => {
5858
const form = Form.useFormInstance();
59-
const formData = Form.useWatch((values) => values, form);
6059
const [exampleType, setExampleType] = useState(ExampleType.PROMPT_COMPLETION);
6160

6261
const mutation = useMutation({
@@ -260,8 +259,9 @@ const Examples: React.FC = () => {
260259
<Button onClick={() => Modal.destroyAll()}>{'Cancel'}</Button>
261260
<Button
262261
onClick={() => {
263-
examples?.examples &&
262+
if (examples?.examples) {
264263
form.setFieldValue('examples', [...examples.examples]);
264+
}
265265
Modal.destroyAll();
266266
}}
267267
type='primary'

app/client/src/pages/DataGenerator/FileSelectorButton.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import get from 'lodash/get';
21
import { Button, Modal } from 'antd';
32
import React, { useState } from 'react';
43
import FilesTable from './FilesTable';

app/client/src/pages/DataGenerator/FilesTable.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import endsWith from 'lodash/endsWith';
22
import filter from 'lodash/filter';
33
import clone from 'lodash/clone';
4+
import set from 'lodash/set';
5+
import forEach from 'lodash/forEach';
46
import React, { useEffect, useState } from 'react';
57
import { Badge, Breadcrumb, Button, Col, Flex, List, Popover, Row, Table, Tooltip, Typography } from 'antd';
68
import styled from 'styled-components';
@@ -9,7 +11,7 @@ import { getFileSize, isDirectory } from './utils';
911
import { File, WorkflowType } from './types';
1012
import { useGetProjectFiles } from './hooks';
1113
import isEmpty from 'lodash/isEmpty';
12-
import { forEach, set, uniq } from 'lodash';
14+
import Loading from '../Evaluator/Loading';
1315

1416
const DIRECTORY_MIME_TYPE = 'inode/directory';
1517

@@ -81,12 +83,12 @@ const FilesTable: React.FC<Props> = ({ onSelectedRows, workflowType }) => {
8183
const [paths, setPaths] = useState<string[] | null>(null);
8284
const [path, setPath] = useState<string | null>(null);
8385
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
84-
const [selectedRows, setSelectedRows] = useState<File[]>([]);
86+
const [, setSelectedRows] = useState<File[]>([]);
8587
// row selection map: path as key -> list of row keys
8688
const [rowSelectionMap, setRowSelectionMap] = useState<RowSelectionMap>({});
8789
// row selection map: path as key -> list of files
8890
const [fileSelectionMap, setFileSelectionMap] = useState<FileSelectionMap>({});
89-
const { fetching, listProjectFiles, data } = useGetProjectFiles(paths || []);
91+
const { fetching, listProjectFiles, data } = useGetProjectFiles();
9092

9193
useEffect(() => {
9294
if (!isEmpty(path) || paths === null || isEmpty(paths)) {
@@ -151,7 +153,7 @@ const FilesTable: React.FC<Props> = ({ onSelectedRows, workflowType }) => {
151153
key: 'name',
152154
ellipsis: true,
153155
render: (file: File) => {
154-
const { name, url } = file;
156+
const { name } = file;
155157

156158
if (file?.mime !== DIRECTORY_MIME_TYPE) {
157159
return (
@@ -205,6 +207,7 @@ const FilesTable: React.FC<Props> = ({ onSelectedRows, workflowType }) => {
205207
</Breadcrumb>
206208
)}
207209
</Col>
210+
{fetching && <Loading />}
208211

209212
<Col sm={4}>
210213
<Flex style={{ flexDirection: 'row-reverse' }}>

0 commit comments

Comments
 (0)