Skip to content

Commit 8aa3091

Browse files
committed
add linting.yml, run format all
1 parent fc4eff1 commit 8aa3091

8 files changed

Lines changed: 45 additions & 48 deletions

File tree

frontend/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ComparisonForm from "./components/ComparisonForm";
1+
import ComparisonForm from './components/ComparisonForm';
22

33
function App() {
44
return (

frontend/src/components/ComparisonForm.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, { useState } from "react";
2-
import { Form, Button, Input, Typography, message } from "antd";
3-
import UploadModel from "./components/UploadModel";
4-
import MethodsSelection from "./components/MethodsSelection";
1+
import React, { useState } from 'react';
2+
import { Form, Button, Input, Typography, message } from 'antd';
3+
import UploadModel from './components/UploadModel';
4+
import MethodsSelection from './components/MethodsSelection';
55

66
const { Title } = Typography;
77

@@ -16,37 +16,37 @@ const ComparisonForm: React.FC = () => {
1616

1717
const onFinish = async (values: FieldType) => {
1818
if (!file) {
19-
message.error("Please upload a model file first.");
19+
message.error('Please upload a model file first.');
2020
return;
2121
}
2222
if (methods.length === 0) {
23-
message.error("Please select at least one method.");
23+
message.error('Please select at least one method.');
2424
return;
2525
}
2626

2727
const formData = new FormData();
28-
formData.append("file", file);
29-
formData.append("experiment", values.experiment);
30-
formData.append("email", values.email);
31-
formData.append("methods", JSON.stringify(methods));
28+
formData.append('file', file);
29+
formData.append('experiment', values.experiment);
30+
formData.append('email', values.email);
31+
formData.append('methods', JSON.stringify(methods));
3232

3333
try {
34-
const res = await fetch("http://localhost:8000/api/upload", {
35-
method: "POST",
34+
const res = await fetch('http://localhost:8000/api/upload', {
35+
method: 'POST',
3636
body: formData,
3737
});
38-
if (!res.ok) throw new Error("Upload failed");
38+
if (!res.ok) throw new Error('Upload failed');
3939
const data = await res.json();
4040
message.success(data.message);
4141
console.log(data);
4242
} catch (err) {
4343
console.error(err);
44-
message.error("Submission failed");
44+
message.error('Submission failed');
4545
}
4646
};
4747

4848
const onFinishFailed = (errorInfo) => {
49-
console.log("Failed:", errorInfo);
49+
console.log('Failed:', errorInfo);
5050
};
5151

5252
return (
@@ -57,32 +57,32 @@ const ComparisonForm: React.FC = () => {
5757
onFinishFailed={onFinishFailed}
5858
autoComplete="off"
5959
>
60-
<Title level={2} style={{ textAlign: "center" }}>
60+
<Title level={2} style={{ textAlign: 'center' }}>
6161
Comparison of the model with the baseline
6262
</Title>
6363

6464
<Form.Item
6565
label="Your experiment name"
6666
name="experiment"
67-
rules={[{ required: true, message: "Enter experiment name" }]}
67+
rules={[{ required: true, message: 'Enter experiment name' }]}
6868
>
6969
<Input />
7070
</Form.Item>
7171

72-
<Form.Item label={null} style={{ textAlign: "center" }}>
72+
<Form.Item label={null} style={{ textAlign: 'center' }}>
7373
<UploadModel onFileChange={(f) => setFile(f?.originFileObj || null)} />
7474
</Form.Item>
7575

76-
<Form.Item label={null} style={{ textAlign: "center" }}>
76+
<Form.Item label={null} style={{ textAlign: 'center' }}>
7777
<MethodsSelection onChange={setMethods} />
7878
</Form.Item>
7979

8080
<Form.Item
8181
label="Email"
8282
name="email"
8383
rules={[
84-
{ required: true, message: "Enter email address" },
85-
{ type: "email", message: "Enter a valid email address" },
84+
{ required: true, message: 'Enter email address' },
85+
{ type: 'email', message: 'Enter a valid email address' },
8686
]}
8787
>
8888
<Input />

frontend/src/components/components/MethodsSelection.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { useState } from "react";
2-
import { TreeSelect } from "antd";
3-
import { METHODS } from "./Methods";
1+
import React, { useState } from 'react';
2+
import { TreeSelect } from 'antd';
3+
import { METHODS } from './Methods';
44

55
const { SHOW_PARENT } = TreeSelect;
66

@@ -24,7 +24,7 @@ const MethodsSelection: React.FC<MethodsSelectionProps> = ({ onChange }) => {
2424
treeCheckable
2525
showCheckedStrategy={SHOW_PARENT}
2626
placeholder="Please select methods"
27-
style={{ width: "100%" }}
27+
style={{ width: '100%' }}
2828
maxTagCount={2}
2929
maxTagPlaceholder={(omittedValues) => `+${omittedValues.length} selected`}
3030
/>

frontend/src/components/components/UploadModel.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, { useState } from "react";
2-
import { InboxOutlined } from "@ant-design/icons";
3-
import type { UploadProps, UploadFile } from "antd";
4-
import { message, Upload } from "antd";
1+
import React, { useState } from 'react';
2+
import { InboxOutlined } from '@ant-design/icons';
3+
import type { UploadProps, UploadFile } from 'antd';
4+
import { message, Upload } from 'antd';
55

66
const { Dragger } = Upload;
77

@@ -13,29 +13,29 @@ const UploadModel: React.FC<UploadModelProps> = ({ onFileChange }) => {
1313
const [fileList, setFileList] = useState<UploadFile[]>([]);
1414

1515
const props: UploadProps = {
16-
name: "file",
17-
accept: ".onnx",
16+
name: 'file',
17+
accept: '.onnx',
1818
multiple: false,
1919
fileList,
2020
onChange(info) {
2121
const newFileList = info.fileList.slice(-1);
2222
setFileList(newFileList);
2323
onFileChange(newFileList[0] || null);
2424
const { status } = info.file;
25-
if (status !== "uploading") {
25+
if (status !== 'uploading') {
2626
console.log(info.file, info.fileList);
2727
}
2828
},
2929
onDrop(e) {
30-
console.log("Dropped files", e.dataTransfer.files);
30+
console.log('Dropped files', e.dataTransfer.files);
3131
},
3232
beforeUpload(file) {
3333
if (fileList.length >= 1) {
34-
message.warning("You can only upload one file.");
34+
message.warning('You can only upload one file.');
3535
return Upload.LIST_IGNORE;
3636
}
37-
if (file.name.split(".").pop()?.toLowerCase() !== "onnx") {
38-
message.error("Only .onnx files are allowed!");
37+
if (file.name.split('.').pop()?.toLowerCase() !== 'onnx') {
38+
message.error('Only .onnx files are allowed!');
3939
return Upload.LIST_IGNORE;
4040
}
4141
return false;

frontend/src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "tailwindcss";
1+
@import 'tailwindcss';
22
:root {
33
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
44
line-height: 1.5;

frontend/src/main.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { createRoot } from "react-dom/client";
2-
import "./index.css";
3-
import App from "./App.tsx";
1+
import { createRoot } from 'react-dom/client';
2+
import './index.css';
3+
import App from './App.tsx';
44

5-
createRoot(document.getElementById("root")!).render(<App />);
5+
createRoot(document.getElementById('root')!).render(<App />);

frontend/tsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"files": [],
3-
"references": [
4-
{ "path": "./tsconfig.app.json" },
5-
{ "path": "./tsconfig.node.json" }
6-
]
3+
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
74
}

frontend/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { defineConfig } from "vite";
2-
import tailwindcss from "@tailwindcss/vite";
1+
import { defineConfig } from 'vite';
2+
import tailwindcss from '@tailwindcss/vite';
33

44
export default defineConfig({
55
plugins: [tailwindcss()],

0 commit comments

Comments
 (0)