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' }}>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import isNumber from 'lodash/isNumber';
22
import filter from 'lodash/filter';
33
import isString from 'lodash/isString';
4-
import get from 'lodash/get';
54
import isEmpty from 'lodash/isEmpty';
65
import { FC, useEffect } from 'react';
76
import { HomeOutlined, PageviewOutlined } from '@mui/icons-material';
@@ -186,7 +185,7 @@ const Finish = () => {
186185
triggerPost(args)
187186
}, []);
188187

189-
const hasTopics = (genDatasetResp: any) => {
188+
const hasTopics = (genDatasetResp: unknown) => {
190189
return !Array.isArray(genDatasetResp?.results)
191190
}
192191

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

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,11 @@ import isEmpty from 'lodash/isEmpty';
33
import first from 'lodash/first';
44
import toString from 'lodash/toString';
55
import React, { FunctionComponent, useState, useMemo, useCallback, useEffect } from 'react';
6-
// import { themeBalham } from '@ag-grid-community/theming';
76
import { AgGridReact } from 'ag-grid-react';
8-
// import { Grid } from '@ag-grid-community/core';
9-
// import 'ag-grid-community/styles/ag-grid.min.css';
10-
// import 'ag-grid-community/styles/ag-theme-balham.css';
11-
// import 'ag-grid-community/styles/ag-theme-quartz.css';
12-
// // import 'ag-grid-community/styles/ag-theme-alpine.min.css';
13-
// import "ag-grid-community/styles/ag-grid.css";
14-
// import "ag-grid-community/styles/ag-theme-quartz.css";
15-
//import "ag-grid-community/styles/ag-grid.css";
16-
//import "ag-grid-community/styles/ag-theme-quartz.css";
17-
18-
// // import { AllCommunityModule, ModuleRegistry } from "ag-grid-community";
197

208
// // Register all Community features
219
// // ModuleRegistry.registerModules([AllCommunityModule]);
22-
import {
23-
themeAlpine,
24-
themeBalham,
25-
themeMaterial,
26-
themeQuartz,
27-
} from "ag-grid-community";
28-
29-
const themes: Record<string, Theme> = {
30-
quartz: themeQuartz,
31-
material: themeMaterial,
32-
balham: themeBalham,
33-
alpine: themeAlpine,
34-
};
35-
const theme = themeQuartz;
10+
import { themeMaterial } from "ag-grid-community";
3611

3712
import {
3813
ModuleRegistry,
@@ -41,23 +16,11 @@ import {
4116
type ColDef,
4217
type GetRowIdFunc,
4318
type GetRowIdParams
44-
} from 'ag-grid-community';
45-
46-
import { themeAlpine } from 'ag-grid-community';
19+
} from 'ag-grid-community';
4720

48-
import { ModuleRegistry } from 'ag-grid-community';
49-
// import { RowGroupingModule } from 'ag-grid-community';
50-
// import { PivotModule } from 'ag-grid-community';
51-
// import { TreeDataModule } from 'ag-grid-community';
52-
// import { ClientSideRowModelModule } from 'ag-grid-community';
53-
// import { AllModules } from 'ag-grid-community';
5421
import { TextFilterModule } from 'ag-grid-community';
5522
import { NumberFilterModule } from 'ag-grid-community';
5623
import { DateFilterModule } from 'ag-grid-community';
57-
// import { SetFilterModule } from 'ag-grid-community';
58-
// import { MultiFilterModule } from 'ag-grid-community';
59-
// import { GroupFilterModule } from 'ag-grid-community';
60-
// import { CustomFilterModule } from 'ag-grid-community';
6124

6225
// Register all Community features (if needed, specify valid modules here)
6326
ModuleRegistry.registerModules([
@@ -79,7 +42,7 @@ ModuleRegistry.registerModules([
7942
]);
8043

8144
interface Props {
82-
data: Record<string, any>[];
45+
data: Record<string, unknown>[];
8346
}
8447

8548
const FreeFormExampleTable: FunctionComponent<Props> = ({ data }) => {

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

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,10 @@ import isEmpty from 'lodash/isEmpty';
33
import first from 'lodash/first';
44
import toString from 'lodash/toString';
55
import React, { FunctionComponent, useState, useMemo, useCallback, useEffect } from 'react';
6-
// import { themeBalham } from '@ag-grid-community/theming';
76
import { AgGridReact } from 'ag-grid-react';
8-
// import { Grid } from '@ag-grid-community/core';
9-
// import 'ag-grid-community/styles/ag-grid.min.css';
10-
// import 'ag-grid-community/styles/ag-theme-balham.css';
11-
// import 'ag-grid-community/styles/ag-theme-quartz.css';
12-
// // import 'ag-grid-community/styles/ag-theme-alpine.min.css';
13-
// import "ag-grid-community/styles/ag-grid.css";
14-
// import "ag-grid-community/styles/ag-theme-quartz.css";
15-
//import "ag-grid-community/styles/ag-grid.css";
16-
//import "ag-grid-community/styles/ag-theme-quartz.css";
17-
18-
// // import { AllCommunityModule, ModuleRegistry } from "ag-grid-community";
19-
207
// // Register all Community features
218
// // ModuleRegistry.registerModules([AllCommunityModule]);
22-
import {
23-
themeAlpine,
24-
themeBalham,
25-
themeMaterial,
26-
themeQuartz,
27-
} from "ag-grid-community";
28-
29-
const themes: Record<string, Theme> = {
30-
quartz: themeQuartz,
31-
material: themeMaterial,
32-
balham: themeBalham,
33-
alpine: themeAlpine,
34-
};
35-
const theme = themeQuartz;
9+
import { themeMaterial } from 'ag-grid-community';
3610

3711
import {
3812
ModuleRegistry,
@@ -41,11 +15,8 @@ import {
4115
type ColDef,
4216
type GetRowIdFunc,
4317
type GetRowIdParams
44-
} from 'ag-grid-community';
18+
} from 'ag-grid-community';
4519

46-
import { themeAlpine } from 'ag-grid-community';
47-
48-
import { ModuleRegistry } from 'ag-grid-community';
4920
// import { RowGroupingModule } from 'ag-grid-community';
5021
// import { PivotModule } from 'ag-grid-community';
5122
// import { TreeDataModule } from 'ag-grid-community';
@@ -65,21 +36,12 @@ ModuleRegistry.registerModules([
6536
TextFilterModule,
6637
NumberFilterModule,
6738
DateFilterModule,
68-
// SetFilterModule,
69-
// MultiFilterModule,
70-
// GroupFilterModule,
71-
// CustomFilterModule,
72-
73-
// ModuleRegistry,
74-
// RowGroupingModule,
75-
// PivotModule,
76-
// TreeDataModule,
7739
ClientSideRowModelModule,
7840
ValidationModule
7941
]);
8042

8143
interface Props {
82-
data: Record<string, any>[];
44+
data: Record<string, unknown>[];
8345
}
8446

8547
const FreeFormTable: FunctionComponent<Props> = ({ data }) => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled from 'styled-components';
33

44
import Markdown from '../../components/Markdown';
55
import TooltipIcon from '../../components/TooltipIcon';
6-
import { JustificationScore, QuestionSolution } from './types';
6+
import { QuestionSolution } from './types';
77

88
const { Title } = Typography;
99
const Container = styled(Flex)`

0 commit comments

Comments
 (0)